Hi Josh,
That fixed it but now I’m finding another error, namely if the previous trial was correct, the timeout does not show a timeout single stim trial afterwards. However, it does if the previous trial was incorrect.
To explain, it’s usually [trial1] [timeout if necessary] [trial2] [timeout] etc. but if [trial1] is correctly responded to, a no-response [timeout] after [trial2] doesn’t occur, it just skips to [trial3] and so on.
I laid out a timeout like so:
chunk_type: 'if',
timeline: [delay_trial],
conditional_function: function(){
var data = jsPsych.data.getLastTrialData();
return !data.correct || data.timeout;
}
}
and in the plugin added an extra data variable of timeout:
if (trial.timing_stim > 0) {
setTimeoutHandlers.push(setTimeout(function() {
timeout = true;
display_element.append(trial.noresp_text);
$('#jspsych-categorize-stimulus').css('visibility', 'hidden');
clearTimeout(setTimeoutHandlers[i]);
jsPsych.pluginAPI.cancelAllKeyboardResponses();
setTimeout(function(){
endTrial();
}, 500); // adjust this parameter as needed, or make it a plugin parameter
}, trial.timing_stim));
}
I thought it was because a previously-correct trial would cause a no-response trial to not meet the conditions of the if chunk, but even removing !data.correct in the if chunk doesn’t fix it. I also changed the if-statement later to:
if (trial.key_answer == info.key && !timeout) {
correct = true;
}
So, I’m not sure where the problem could lie. Do you have any ideas?
Many thanks!