Thanks! I did that (see above), and the script runs, but it doesn't record correct responses as correct.
Here is what I did:
1. I created a variable responsecode and set the value to 0
<values userparams>
/ responsecode = 0
</values>
2. In the first trial, no response is required, and I set value.responsecude to 1.
<trial starttrial>
/ inputdevice = mouse
/ validresponse = (smallgreen; noresponse)
/ stimulustimes = [1=smallgreen; 1500 = white]
/ timeout = 1500
/ responsetime = 10
/ontrialend = [values.responsecode==1]
</trial>
3. At the next trials, I specify iscorrectresponse such that clicking on the stimulus is correct only when value.responsecode==1. At the end of the trial, I update the responsecode. Here two example trials (participants are supposed to click on a stimulus if the last stimulus was green but not blue).
<trial smallgreenWM>
/ inputdevice = mouse
/ validresponse = (smallgreen; noresponse)
/ iscorrectresponse = [trial.smallgreenWM.response==smallgreen && values.responsecode==1]
/ stimulustimes = [1=smallgreen; 1500 = white]
/ timeout = 1500
/ responsetime = 10
/ontrialend = [values.responsecode==1]
/ errormessage = true(errortext, 500)
</trial>
<trial smallblueWM>
/ inputdevice = mouse
/ validresponse = (smallblue; noresponse)
/ iscorrectresponse = [trial.smallblueWM.response==smallblue && values.responsecode==1]
/ stimulustimes = [1=smallblue; 1500 = white]
/ timeout = 1500
/ responsetime = 10
/ontrialend = [values.responsecode=0]
/ errormessage = true(errortext, 500)
</trial>
When I look at the data, I see that correct is always 0 regardless of how I respond. The same happens when I set values.responsecode=1 at the beginning.