Return to the previous routine

Hello,
I’m trying to find a way to return to the previous routine in my experiment.

To give some context, this is how it should work (times are placeholders for debugging purposes):

We have the start and end routines that display some text at the beginning and end of the experiment.
After the start routine, we have the images routine where an image is displayed for about 5 seconds. Then, in the rating routine, we show a similar/identical image and three buttons to choose from:

  1. Identical (If the participant thinks the images are identical).
  2. Non-Identical (If the participant doesn’t think the images are identical).
  3. Redisplay Image.
    At the end of the rating routine, we loop back to the images routine (about 75~100 times).

The first two buttons immediately finish the rating routine and start a new loop with a new pair of images.

My question is regarding the third button. I want to give the participant the option to redisplay the first image for another 5 seconds, or in other words, to return to the mages routine and start it over again as many times as he likes. The important thing is that the 'redisplay` of the first image won’t impair the loop.

I created an abstract project that might help:
previousRoutine.psyexp (21.0 KB)
Please note that you need to provide images in order for it to work.

Any help would be appreciated.
Thanks!

Hi,

What I would have tried is to create another inner loop (let’s call it new_trials) that would include the images and the rating routines only and set as nReps a large number e.g. 1000. Then in the rating routine I would add a code component that would say if the first or the second button is pressed then new_trials.finished=true

Yiannis

1 Like

It worked like a charm. Thank you very much!
Here’s the code I implemented at the end of the routine:

if mouse.isPressedIn(redisplay_image):
    redisplay_image_loop.finished = False
else: redisplay_image_loop.finished = True
1 Like