I already came across a similar problem described by people in this thread: How to Pause a loop?. But none of the solutions seem to make it work.
PsychoPy version: 2024.1.5. What are you trying to achieve?: I have a trial list of 550 items that are presented in random order. Every 20 items, I want to insert a break.
What did you try to make it work?:
I have a “start” routine, where I have a code component with “trial_count = 0” in the “begin experiment” tab.
Then, the loop starts. Within the loop, I have two components, the “trial” component and the “break_routine” component.
In the “trial” component, there is a code specifying “trial_count += 1” in the “each frame” tab.
In the “break_routine” component, there is a code specifying: “if trial_count % 20 != 0:
continue_routine = False” in the “Begin routine” tab.
What specifically went wrong when you tried that?:
The “break” message is shown after every trial. I moved the code component to the top of the objects in the “break_routine” component, copy-pasted the code text back-and-forth between different tabs, but nothing seems to change the break message being shown after every trial.
Thanks for your fast response! Good news is: It kind of works now (both when I use the code or when I use the Routine Settings, as you suggest).
Bad news: It doesn’t show the break message every 20th trials, but at some intervals that I can’t figure how it gets to (ranging from 6 to 51) - both when I use the “Routine Settings” and the code component.