Wakefield's Daily Tips

Interruption tasks

In this example the researcher wants to present the trial routine on every iteration of trials but occasionally interrupt it, presenting the interruption task and then returning to the same trial.

My recommendation to achieve this is a repeats loop with two repeats and no parameters. Whether it has “is trials” ticked or not will depend on whether you want to save pre and post interruption results on different rows.

In the trial routine add the following code:

Begin Routine

skipInterrupt = True

Each Frame

if trials.thisN in [2, 3, 6] and repeats.thisN == 0:  # To interrupt trials 3, 4, and 7
    if t > 3: # To interrupt after 3 seconds
        continueRoutine = False 
        skipInterrupt = False

End Routine

if skipInterrupt:
    repeats.finished = True

Finally add skipInterrupt to the skip if field of the interruption routine settings.