This is to do with non-slip timing. Essentially, if you set continueRoutine = False
during the frame loop, it takes note of the fact that the routine ended before the planned time so that the timer can be reset to 0 rather than having the expected duration subtracted (which we do for routines with a fixed duration as it prevents timing from slipping over several repeats). Because continueRoutine = False
was set here before the routine, the frame loop never executes so it never learns that the routine was force ended.
I’ll put in a fix for the next version of PsychoPy so that what you did will work, in the meantime there’s two things you can do to avoid the problem:
- In your Begin Routine code, add
routineForceEnded = True
aftercontinueRoutine = False
- this means your experiment will know that the routine was skipped before its intended end time so won’t subtract the duration from the timer - Move the code from Begin Routine to Each Frame, but put it inside of this if statement:
if frameN == -1:
. This means thatcontinueRoutine
will be set to False on the first frame, rather than before the first frame.