psychopy.org | Reference | Downloads | Github

Breaking an inner loop with temporal criteria breaks also outer loop

URL of experiment: https://gitlab.pavlovia.org/Giulia/ltm_categorization

Description of the problem:
Hi, my experiment has nested loops. I have an inner loop that breaks after 30 seconds. Using the code trials.finished = true also breaks my outer loop and its repetitions. I Have seen that this problem has been solved when the loop breaks after nRep. I wasn’t able to implement it for my issue.

This is my code where “counting” is my inner loop

In the routine before the inner loop
Begin Routine
totalTime = 0;
timeLimit = 10;
incrementalClock = new util.Clock();

in the inner loop

Begin routine
incrementalClock.reset()

EachFrame
if (((totalTime + incrementalClock.getTime())) >= timeLimit)
{
counting.finished=true;
continueRoutine =false;
}

EndRoutine
totalTime+=incrementalClock.getTime()

thank you for any suggestion!
Giulia