psychopy.org | Reference | Downloads | Github

Stop a Routine from starting?

I know that the extended stroop demo shows how to give feedback however this is forced feedback of one type or another, however I only want to give feedback in some situations.
I’d thought that I could use a code component and use some logic on the ‘Begin routine’ and simply set continueRoutine = False if i didn’t want the routine to execute however the generated Builder code sets
continueRoutine=True
AFTER the ‘Begin routine’ code runs so this doesn;t work.

Is there another way to use branch logic to stop a routine (one of many that are themselves within a loop) from running?

One way would be for the generated code to set
continueRoutine = True
BEFORE the user ‘Begin routine’ code is run

Hi John,

That behaviour should have been fixed a while back (precisely because of the problem you highlight). Are you using the latest version?

that’s great, thanks. We fixed on 1.83.04 for the academic year but will upgrade at Easter.

The fix was here: https://github.com/psychopy/psychopy/issues/1143

That code will still work in the Each frame tab, but that means that at least one frame of your routine will still be shown, which may cause an unacceptable flicker, depending on your stimuli.

Otherwise, you can continue with the “old fashioned” work-around: put a loop around your routine with a variable name in the nReps field. In the preceding routine, have a code component that sets that variable to either 1 or 0 depending on whether you want that routine to run or not. That loop shouldn’t be connected to a conditions file: its only function is to run or not run the trial.