Using builder to insert pause every 50 presentations

OS: macOS Monterey 12.4
PsychoPy version: 2021.2.3
Standard Standalone? (y/n): y

I have a set of 500 images that I want participants to rate on valence and arousal. After every 50 images, I want to insert a pause where a participant can take a short break, then continue when they are ready by hitting ‘space’. I want to make 10 blocks of 50 images that were randomized to each block from the original set of 500, with the opportunity for a short break in between each block. However, I cannot seem to make the code suggested here work within builder: Inserting pauses in PsychoPy image experiment after every 20 trials

I tried inserting it ‘before routine’ as well as ‘Each Frame’ as some others have noted, but to no avail.

The code block I have inserted is:

if StimTrials.thisN > 0 and StimTrials.thisN % 50 == 0:
    continueRoutine = False

However, the pause screen still appears after every trial. My current builder set up is pictured below. StimTrials nReps = 1 to go through all 500 images.

Any direction would be much appreciated! Thanks!

Hi @mirandag,

the code you are using at the moment shows the break every trial except for every 50th trial. What you need is

if StimTrials.thisN > 0 and StimTrials.thisN % 50 == 0:
    continueRoutine = True
    continueRoutine = False
1 Like

This code should work, but since continueRoutine is True by default, it could be simplified to:

if StimTrials.thisN == 0 or StimTrials.thisN % 50 != 0:
    continueRoutine = False