Hi forum,
I am struggling to get my inquisit code to correctly apply the if statement that suggests when another stimulus should be displayed on screen within a trial.
My current code reads as:
<trial practice_go>
/pretrialpause = values.iti
/ontrialbegin = [
values.trialtype = "Go";
values.digit = list.practice_digitsequence.nextvalue;
values.fontsize = list.practice_fontsizes.nextvalue;
if (mod(values.digit, 2) == 0) {
values.even = true;
values.correctresponsekey = values.responsekey2;
}
else {
values.even = false;
values.correctresponsekey = values.responsekey1;
}
trial.practice_go.insertstimulustime(text.mask, values.digitpresentationtime);
trial.practice_go.insertstimulustime(shape.background, (values.digitpresentationtime + values.maskpresentationtime));
if(trial.practice_go.response == values.correctresponsekey) { trial.practice_go.insertstimulustime(text.correctfeedback, 2000); } else trial.practice_go.insertstimulustime(text.errorfeedback, 2000)]/ontrialend = [
trial.practice_go.resetstimulusframes();
]
/stimulustimes = [0 = background, digit]
/responsetime = 0
/responseinterrupt = frames
/monkeyresponse = (24,18)
/iscorrectresponse = [trial.practice_go.response == values.correctresponsekey]
/trialduration = values.digitpresentationtime + values.maskpresentationtime
The bolded text is where I'm having the issue within this trial. I am trying to get correctfeedback text to be displayed only when the correctresponse key is pressed after 2000 ms into the trial. Where correctresponsekey is defined immediately above. However when I run the code, the text is not being appropriately presented depending on if the correctrepsonse is pressed or not.
Is the if statement incorrectly defined? How can I fix this to ensure that correct feedback is displayed so when an ODD digit is presented and O key (scancode 24) is pressed correct feedback is presented and if and EVEN digit is displayed and the E key (scancode 18) is pressed correct feedback is also displayed. And if the correct corresponding key in NOT pressed the error feedback is displayed?
Any suggestions would be greatly appreciated. Thanks very much.
Alicia