Move Forward & Backward through a Slideshow

Hi Scott,

You are right: nest a second loop inside your main trial loop, only surrounding the routine(s) you want to keep repeating. Don’t connect this inner loop to a conditions file. Instead just give it some unfeasibly large nReps value (like 100), so that the trial can be repeated up to that many times.

Insert a code component from the “custom” component panel. In the “End routine” tab of that component, put something like the code below. The idea is to terminate the inner loop if you simply want to progress to the next trial (i.e. the next iteration of the main, outer loop). Otherwise, the inner loop will iterate again, running the routine once more:

if your_keyboard_component_name.keys == 'right':
    your_inner_loop_name.finished = True

i.e. in this case, if the right arrow key was pushed, then the routine will not repeat, and instead the next trial will proceed. You don’t need any code to handle the other keypress option: the inner loop will just keep running automatically until you tell it to stop (or it reaches the nReps value).