psychopy.org | Reference | Downloads | Github

Can't exit loop

URL of project: https://pavlovia.org/AnthonyGabay/foraging_online

Description of the problem:

I am trying to end two loops at the end of the experiment by using the loop.finished = true; syntax. I have a counter which, when it reaches 8, should break out of the loops with the following code:

if(env_counter == 8)
{
    uber_order.finished = true;
    order.finished = true;
}

However, the loop continues. The counter appears to be working, because other routines are being initiated properly based on its number. I originally had this code in End Routine, but moved it to Each Frame in case that was the problem. Then, based on other answers to similar questions I tried ticking isTrials for both loops, but then it exits the loop after one iteration - I’m not sure why but either way this solution doesn’t seem to work for my case.

Any help would be greatly appreciated. The code in question comes in the ‘end’ routine at the end of the experiment. This should be the last hurdle before getting this task online!

Thanks,
Anthony

1 Like

I have exactly the same problem. Have you solved it, Anthony?

My experiment works perfectly on my desktop but the following loop seems not working online. The loop continues whatsoever.

if number_correct == 3:
NoPass.finished = True
else:
NoPass.finished = False

https://run.pavlovia.org/HanaJee/consonants2_image/html/?__pilotToken=98f13708210194c475687be6106a3b84&__oauthToken=06e1c8d665ce56255cd1caf56499c9445899f24cdc6806ba305ea6d6e3dc9a87

I wanted to leave the link here, but am experiencing another issue: the experiment status is PILOTING but the pilot token is missing from the URL

https://run.pavlovia.org/HanaJee/consonants2_image/html/

Any help would be great. Thanks!

Hi @Hana_Jee,

I actually can’t remember how I solved this to be honest. However, the code in your question is written in python - it needs to be in JS for the online version. So yours would be:

if (number_correct == 3)
{
NoPass.finished = true;
} else
{
NoPass.finished = false
}