Insert message after first loop repetition but skip in second

If this template helps then use it. If not then just delete and start from scratch.

OS: Win 11
PsychoPy version: v2022.1.4
What are you trying to achieve?: I have two loops (trials and trials2) that match two blocks of experimental stimuli. Currently, I have an external loop called List1or2 that randomizes them with code. It all works well. However, I would like to insert a message so that participants can take a pause between the two blocks if they so desire that plays only after the first repeat.

For the randomization, I used the approach in this post:

What did you try to make it work?:
I put the message after the two loops, and I would like to make it so that the message only displays after the first repetition and it does not in the second.

What specifically went wrong when you tried that?:
Right now, as it is part of the sequence, it plays once it finishes the first repeat and after the second repeat as well.

Here’s the structure, ‘Break’ is the message I want to play:


I believe you should be able to use the loopname.thisN variable for this. So if you only want to present a particular routine on a specific loop repetition you can add a code component to that routine and in the Begin Routine tab add:

if loopname.thisN != 0:#if you want to present on first iteration
    continueRoutine = False# end this routine

hope this helps,

1 Like

Thanks a lot, Becca! It worked perfectly, and it was so simple to implement! :blush: