How to use 'continueRoutine' to provide feedback when no response received

I’ve got a column in my Excel file that provides the ($)correct answer (correct/ incorrect) to a dot probe task. While I want Psychopy to store this, I don’t want feedback to be displayed to the participant unless they have not responded within a set time window/limit following stimulus presentation, in which case the display should say ‘incorrect’. I’ve been told that feedback can be skipped over differentially using ‘continueRoutine = False’. However, I’m unsure how to implement this.

My keyboard component is named ‘pictureResp’ and I’m assuming that an ‘if…else…’ function is required but I’m not sure what it should be exactly?

Use two routines. The first is for presenting the stimuli and collecting the response. The second is for (conditionally) presenting feedback.

In the first routine, make sure all components have a finite duration so that the routine will end even if no key is pressed.

In the second routine, insert a code component and in its Begin routine tab, put something like this:

# check if a key was pressed:
if pictureResp.keys: # if the list contains at least one entry,
    continueRoutine = False # don't show this feedback routine

i.e. this checks if the list of keypresses is not empty. If it does contain a keypress, then you don’t want to continue this routine. If no key was pressed (so the empty list of keys evaluates to False), then do show feedback.

Hi Michael,

Thanks for your reply.

That seems to work for my main experimental trials but not for my practice trials for some reason, and I can’t work out why.

The practice trials are on a separate routine (as is the feedback for the practice trials) but I’ve used the same code, changing only the name of the keyboard component. The timing out/ automatic ‘Incorrect’ response is still there yet, it shows up as ‘Incorrect’ whatever key I press. I’m not sure whether not asking it to store anything has anything to do with it? …as I want to discard all the data (reaction times and key presses) for the practice trials and only have data outputs from my experimental trials.

The timing out/ automatic ‘Incorrect’ response is still there yet, it shows up as ‘Incorrect’ whatever key I press. I’m not sure whether not asking it to store anything has anything to do with it?

So the problem is probably with the keyboard component. You need to choose “store correct” as otherwise you can’t specify a variable to define what the correct answer is.

I want to discard all the data (reaction times and key presses) for the practice trials and only have data outputs from my experimental trials

Don’t get hung up on this. It is trivial to filter out data at the analysis stage, but you can never get back something you’ve chosen to discard. You never know in advance what odd thing might be revealed in the analysis and the question comes up “I wonder what they were doing during the practice phase?”…

1 Like

Thank you. That turned out to the problem indeed!