Trial loop without repeating conditions

Hi Everyone,

I’m using the builder to create a posner task where a face appears either on the right, left or middle and then a target appears on the right or left. Participants will have to click either the right or left mouse button to indicate where the target popped up

PsychoPy version (e.g. 1.84.x): 2021.2.3
What are you trying to achieve?:
There are 120 possible conditions and we are trying to have each participant see each condition twice (i.e total of 240). After 40 conditions participants are given the option of a break and then need to click to continue. I created the trials to link to the conditions file with 120 conditions and then created trials_6 so that it loops through 6 times (40 conditions x 6 = 240). After running through it multiple times the conditions shown to the participant are not always 120 unique. After 40 conditions it resets and picks another random 40 thus causing some conditions to be shown either never, once, twice or three times. I would like it to randomize through the 120 with each participant seeing all conditions twice.

What did you try to make it work?:
I tried using this:

if not trials.thisN in [39, 79, 119, 159, 199]: # on most trials:
continueRoutine = False # don’t even start this routine

What specifically went wrong when you tried that?:
It just shows a couple conditions maybe 2 or 3 before going to the text/pause.

Any help would be much appreciated! I can also offer clarification


trials.xlsx (11.1 KB)

Why do you have concentric loops for this?

If trials_6 pointed at your spreadsheet with nReps set to 2 then you could put

if trials_6.thisN%40 != 39 or trials_6.thisN == 239:
     continueRoutine = False

in a Begin Routine tab of a code component in your break routine.