Hello,
In my experiment, I need the participant to stop the routine after estimating a certain duration (time estimation experiment). Before stopping the routine, he has to perform a task during the estimated duration to prevent him from counting. The task consists in seeing squares of different colors and counting the red squares, which prevents him from counting time. The squares are set to appear in a certain order, and psychopy fetches them from an excel file where one line = one stimulus (one stimulus = one square). In the task, the stimulus must scroll one after the other in an autonomous fashion. I added a key_resp so that when the participant presses the “space” key, the task stops. Except that the problem here is that the key scrolls through the stimuli (you have to press the space key to move on to the next stimulus), which isn’t what I want.
I’d like to know how to set up a key that would stop the task and move on to the next routine, without preventing the stimuli from scrolling independently.
I hope that was understandable.
Thanks for your help.
Hello @Leanne
It is the usual behaviour of PsychoPy to go through your condition file row by row when ending a routine. By default, PsychoPy presents your condition file five times, row by row. So your number of trials is 5 x the number of rows in your condition file.
You have a variable timed routine that the participant has to end. As a distraction task, your participant has to count red squares that are presented together with some distractor squares. Is this correct?
What do you mean by this?
and this
If you want to present the squares independently, you need to dissociate the presentation of the squares from going through your condition file row by row.
It would help further support if you described your experiment in a way similar to a method section in an article.
Best wishes Jens
Hello, thanks for your answer.
Yes Psychopy by default is going through the file row by row, and it is what i need. The issue here is that when i add a ‘space’ key in the routine for the participant to end the routine before psychopy goes through the entire file, psychopy isn’t doing it anymore. It’s showing only one stimulus from the file, and i have to use the space key to make it read the second row, the key setting isn’t doing what i want it to do and in don’t know how to do it.
I meant that i want psychopy to have the default behavior you’ve described earlier but it changed when i added the keyboard.

You have a variable timed routine that the participant has to end. As a distraction task, your participant has to count red squares that are presented together with some distractor squares. Is this correct?
Yes it 's correct !
Sorry it’s a bit hard to explain in english, i don’t have any reference article to illustrate this.
Thanks again.
My understanding is:
You have two concentric loops.
The inner loop is for your counting task and should continue until space is pressed.
The outer loop is for your timing task and should only advance when space is pressed.
To do this, your inner loop needs lots of iterations.
You need a code component in End Routine to break the inner loop if space is pressed.
e.g.
if key_resp.keys:
if 'space' in key_resp.keys:
inner_loop.finished = True
Thank you ! It worked
have a good day !