Thank you, I tried to add the /isvalidresponse to my trial but now all my trials are incorrect even if I press the correct keys, as if the other keys aren't even recorded.
Perhaps the structure of my trial helps to clarify the issue. I have 2 letters appearing on a horizontal line made of 6 spaces (erasers) plus another distractor letter appearing above/below the letters line. One of the two letters on the horizontal line is the target (in this trial it's is a K). Participant have to press key J whenever they see a K and that is stored as correct response. However, now that I've added to the script the code to store the number of times the spacebar is pressed, in the resulting data table the response column contains only "0" and all responses are marked as incorrect.. :(
<trial set2KTARGET>
/ ontrialbegin = [
values.valid = 0;
values.spacebarscount = 0;
values.latencies="";
values.validcorrect = 0;
values.trialcount += 1]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2filler1K.nextvalue,500);]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2filler2K.nextvalue,500);]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2filler3K.nextvalue,500);]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2filler4K.nextvalue,500);]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2filler5K.nextvalue,500);]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.s2targetK.nextvalue,500);]
/ ontrialbegin = [values.fillerhpos1 = list.s2filler1_hK.nextvalue]
/ ontrialbegin = [values.fillervpos1 = list.s2filler1_vK.nextvalue]
/ ontrialbegin = [values.fillerhpos2 = list.s2filler2_hK.nextvalue]
/ ontrialbegin = [values.fillervpos2 = list.s2filler2_vK.nextvalue]
/ ontrialbegin = [values.fillerhpos3 = list.s2filler3_hK.nextvalue]
/ ontrialbegin = [values.fillervpos3 = list.s2filler3_vK.nextvalue]
/ ontrialbegin = [values.fillerhpos4 = list.s2filler4_hK.nextvalue]
/ ontrialbegin = [values.fillervpos4 = list.s2filler4_vK.nextvalue]
/ ontrialbegin = [values.fillerhpos5 = list.s2filler5_hK.nextvalue]
/ ontrialbegin = [values.fillervpos5 = list.s2filler5_vK.nextvalue]
/ ontrialbegin = [values.Ktargetpos_h = list.s2target_hK.nextvalue]
/ ontrialbegin = [values.Ktargetpos_v = list.s2target_vK.nextvalue]
/ ontrialbegin = [trial.set2KTARGET.insertstimulustime(list.set2distractorK.nextvalue,500);]
/ ontrialbegin = [values.distractor = list.set2distractorK.currentvalue;]
/ ontrialbegin = [
if (contains(list.set2distractorK.currentvalue, ".K")) expressions.category = "congruent"
else if (contains(list.set2distractorK.currentvalue, ".H")) expressions.category = "incongruent";
]
/ ontrialbegin = [
if (expressions.category== "congruent") values.count_congruent += 1;
else if (expressions.category== "incongruent") values.count_incongruent += 1;
]
/ ontrialend = [trial.set2KTARGET.resetstimulusframes(); ]
/ stimulustimes = [1=fixation; 500=fixationcover; 600=sequence (eraser1, eraser2, eraser3, eraser4, eraser5, eraser6, eraserleft, eraserright)]
/ validresponse = (36, 23, 57)
/ correctresponse = (36)
/ response = timeout(1900)
/ beginresponsetime = 100
/ ontrialend = [
if (trial.set2KTARGET.latency >= parameters.minimum_latency)
values.valid = 1;
if (values.valid == 1) {
if (trial.set2KTARGET.correct) {
values.validcorrect = 1;
values.sumcorrect += 1;
values.sumrt += trial.set2KTARGET.latency
if (expressions.category == "congruent") {
values.sumcorrect_congruent += 1;
values.sumrt_congruent += trial.set2KTARGET.latency;
list.latencies_congruent.insertitem(trial.set2KTARGET.latency, 1);
list.latencies.insertitem(trial.set2KTARGET.latency, 1);
} else {
values.sumcorrect_incongruent += 1;
values.sumrt_incongruent += trial.set2KTARGET.latency;
list.latencies_incongruent.insertitem(trial.set2KTARGET.latency, 1);
list.latencies.insertitem(trial.set2KTARGET.latency, 1);
}
}
} ;
list.accuracy.insertitem(values.validcorrect, 1);
values.testeracc = list.accuracy.currentindex
if (expressions.category == "congruent") {
list.accuracy_congruent.insertitem(values.validcorrect, 1);
} else {
list.accuracy_incongruent.insertitem(values.validcorrect, 1);
};
]
/ ontrialend= [values.TrialNum = values.TrialNum + 1]
/ isvalidresponse = [if(trial.set2KTARGET.response==57){values.spacebarscount += 1; values.latencies=concat(concat(values.latencies, trial.set2KTARGET.latency),","); false}; ]
/ responseinterrupt = trial
</trial>