How to Pause a loop?

Let’s work through the Boolean logic here: what happens if trials.thisN is 0? The conditional expression will evaluate to False, so continueRoutine = False will not be executed, and hence the routine will run.

The logic should be:

if trials.thisN == 0 or trials.thisN % 40 != 0:
    continueRoutine = False

Boolean logic isn’t always intuitive (which is why it had to be formally invented), so it is easy to get things the wrong way round (which is what I did in that post above).

1 Like

Ahh, got it! Thank you so much Michael, I really appreciate your help! I ran it again and it seems to work now.

Hi,
I have a similar problem. I have experimenter with two loops one for the individual trials and one for blocks. I would like to have a break after 5 blocks have been completed. However, the code does not work for the block loop. it does however work perfectly fine in the trial loop.

Hi,
i also seem to have an issue with pausing the loop.
I’m presenting the video throughout the trials loop in which each trials consists of a short sound and a variable ISI. I’d like to be able to pause and unpause both the video and the loop with a key press.
Right now i have the code at the beginning of the routine of the trials within the loop as presented on the screenshot below. The pausing and unpausing of the video works well, but the sound loop does not pause as expected.
Thanks in advance for any advice.

Setup:
OS: OS X 10.14.6
Psychopy builder: v2021.2.3 (newest)