Force end of routine key press except for one value in a text component

OS (e.g. Win10): MacOS Ventura Version 13.4.1
PsychoPy version (e.g. 1.84.x): 2023 1.3
What are you trying to achieve?:
I want to program a SART task where participants see a number a press the space bar, except they are supposed to withhold a response when they see the target number 3
What did you try to make it work?:
Right now I have a text component that is a fixation cross then another text component that calls on a list of numbers 1-9 on a spreadsheet and a key response component with the force end of routine box checked. This routine is looped.
What specifically went wrong when you tried that?:
My issue is that that works for all the other numbers but when the 3 appears and you don’t press the space bar (as required by the experiment) after a few seconds the screen goes blank and it doesn’t continue to show the fixation square until I press the space bar again.

Hello,

It sounds like you don’t have a stop condition.
In cases where the number is not 3, and you press the spacebar, you force the end of the experiment.
What stop condition do you have otherwise? Do you stop the experiment after a few seconds? What is the length of your routine?
It isn’t easy to give you a solution without seeing your routine.

You can either have a constant duration for all components in the routine, or you could create a code component that forces the end of the routine, for example:

# Every Frame:
if t >= 3:
    continueRoutine = False

Thanks,
Chen

Awesome, thank you so much!! I completely forgot to add the constant duration for the key component

1 Like