OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 1.90.1
Standard Standalone? (y/n) If not then what?: y
What are you trying to achieve?: A break every 48 trials using the modulo operator.
What did you try to make it work?: I added the following code component. I’ve tried adding it to the “Begin Routine” and “Every Frame” tab of both the “trial” routine and the “breakText” routine:
if trials.thisTrialN % 48 == 0:
continueRoutine = False
What specifically went wrong when you tried that?: It never breaks out of the loop. When I added the following line of code, I discovered that it is skipping the 48th trial, but is never breaking out of the loop and showing the breakText:
else:
print(trials.thisTrialN)
The flow of my experiment is below. It’s fairly basic, it presents stimuli to participants and just asks them to give an answer using the left or the right key. There are 192 trials in a block, however, so I’m trying to get it to show the breakText “Take a break! Press space to continue” every 48 trials. As stated above though, when I insert the code component it is never breaking out of the loop.
Experiment.py (27.0 KB)
I’ve attached the entire code for my experiment above.
Any help at all would be massively appreciated.
Thanks.