+x+xHi everyone,
we want to run a Stop-Signal-Task (SST). Unfortunately, we get an error message for the following line:
iscorrectresponse = [(values.expcondition == 1 && if(values.stimulus=40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey) ||
(values.expcondition == 2 && if(values.stimulus40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey)]
Expression ' if (values.stimulus<=90)trial.p_nstrial.response==values.leftkey else trial.p_nstrial.response==values.rightkey)||(values.expcondition==2&& if (values.stimulus>90)trial.p_nstrial.response==values.leftkey else trial.p_nstrial.response==values.rightkey)' is invalid. Unmatched parenthesis.
We would appreciate any help!
Best,
Franziska Motka
(1) The line
iscorrectresponse = [(values.expcondition == 1 && if(values.stimulus=40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey) ||
(values.expcondition == 2 && if(values.stimulus40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey)]
is not what the error message references.
Expression ' if (values.stimulus<=90)trial.p_nstrial.response==values.leftkey else trial.p_nstrial.response==values.rightkey)||(values.expcondition==2&& if (values.stimulus>90)trial.p_nstrial.response==values.leftkey else trial.p_nstrial.response==values.rightkey)' is invalid. Unmatched parenthesis.
(2) Providing a single, isolated line of code is not useful. Provide the actual script including any and all files the script requires to run.
(3) Please make sure your code is properly documented, i.e. comments should explain clearly and precisely what the given code is intended to do. This is especially important because there are multiple syntax issues even in the single line you posted. It's not self-evident what this code is supposed to do.
Thank you for your answer and sorry for the mistake. Here is the proper code:
***********************************************************************************************************************************************************************
No-Signal-Trial
***********************************************************************************************************************************************************************
***********************************************************************************************************************************************************************
<trial nstrial>
/ ontrialbegin = [values.stimulus=list.ns_stims.nextvalue; values.signal=0; values.trialnumber+=1; values.ssd=0]
/ ontrialend = [if(trial.nstrial.correct==1)values.correct=2 else values.correct=0]
/ ontrialend = [if(trial.nstrial.response==0)values.rt=0 else values.rt=trial.nstrial.latency]
/ ontrialend = [if(trial.nstrial.response!=0){
values.ns_rtsum=values.ns_rtsum+values.rt; values.ns_nresp+=1}]
/ ontrialend = [if(trial.nstrial.response==0)values.ns_nnoresp+=1]
/ ontrialend = [if(expressions.trialnumber!=0)values.raw_rtsum=values.raw_rtsum+values.rt]
/ ontrialend = [if(expressions.trialnumber!=0)values.ns_ntotal+=1]
/ ontrialend = [if(expressions.trialnumber!=0 && trial.nstrial.response==0)values.ns_nmiss+=1]
/ ontrialend = [if(values.correct==2 && expressions.trialnumber!=0){
values.ns_ncorr+=1; values.ns_rtcorrsum=values.ns_rtcorrsum+values.rt}]
/ ontrialend = [if(trial.nstrial.response==values.leftkey)values.response=1]
/ ontrialend = [if(trial.nstrial.response==values.rightkey)values.response=2]
/ ontrialend = [if(trial.nstrial.response==0)values.response=0]
/ stimulustimes = [0=fixation; 250=stim; 1500=erasestim]
/ responsetime = 250
/ pretrialpause = values.pretrialpause
/ posttrialpause = values.posttrialpause
/ trialduration = values.trialduration
/ responseinterrupt = frames
/ isvalidresponse = [trial.nstrial.response==0||trial.nstrial.response==values.leftkey||trial.nstrial.response==values.rightkey]
/ iscorrectresponse = [(values.expcondition == 1 && if(values.stimulus<=40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey) ||
(values.expcondition == 2 && if(values.stimulus>40)trial.nstrial.response==values.leftkey else trial.nstrial.response==values.rightkey)]
/ monkeyresponse = (values.leftkey, values.rightkey)
</trial>
/ iscorrectresponse = [(values.expcondition == 1 && trial.practicetrial_a.responsey < values.mouse_y) ||
(values.expcondition == 2 && trial.practicetrial_a.responsey > values.mouse_y)]