Ending loop after 10 minutes in Pavlovia

URL of experiment: https://gitlab.pavlovia.org/swshepardson/delay_trivia

Description of the problem:
Using this code I was able to make this loop stop after 10 minutes when using PsychoPy, but now it does not work in Pavlovia.
Timer Routine before beginning of Loop, code snippet in Begin Routine

timer = core.Clock()
timer.reset(newT=0.0)

In the last routine in the loop, code snippet in Each Frame

t=timer.getTime()
if t > 30:
  delay_loop.finished=True
  continueRoutine=False

I tried changing the first code to:

globalClock = new util.Clock()
globalClock.reset(newT=0.0)

and the second to:

t=globalClock.getTime()
if t > 30:
  delay_loop.finished=True
  continueRoutine=False

But this still didn’t work. Any suggestions?

First off, please insert your code here with backticks around it so that indentation is maintained (and make sure the indentation is pasted in correctly) otherwise your code won’t make sense.

I think there are a couple of issues here:

  • you’ve used variables t and globalClock that psychopy scripts are already creating and those could be causing clashes with our existing values. globalClock probably doesn’t need defining by you (but if you do create that give it a new name) and t should be changed to something like overall_t
  • the second issue is probably where your code objects are being defined. They need to come at the very start of the script in order to be made global. If you’ve specfied something like globalClock = new util.Clock() I think that will end up with local scope and then the one you use won’t be the same as the one you created
  • lastly, to debug you might need to find out what times are actually coming out of this clock object you’re creating which you can do in the browser using the debugging functions

hope that helps