Trial ends once

OS (e.g. Win11):
PsychoPy version (v2023.1.2):

What are you trying to achieve?:
I want the polygon to stop moving at a specified position.

The position of the polygon is (t*velocity,0).
The conditions for “velocity” are specified in the excel sheet.
Enter the following code in “each frame” of the code component.
if ((polygon.pos[0] <= 3)) {
continueRoutine = true;
} else {
continueRoutine = false;
When the polygon starts at 0 seconds, the Loop repeats 5 times and moves normally. However, when it does 2 seconds, the trial ends once forcibly. Normally, psychopy would conduct a total of 15 trials with 3 velocity conditions and 5 loops. However, it ends after just one trial.
I don’t understand what I do. Do I need to add some code?

thank you.


polygon doesn’t have a pos if it hasn’t started yet. How about

if t * velocity > 3:
     continueRoutine = False

hi Thank you for your reply.
Thanks to you, I was able to solve the problem.