| Reference | Downloads | Github

Reset routineTimer

At the beginning of each routine, the builder automatically does routineTimer.add(2), where 2 is set by me as the length of the trial. Because my trials can end early, this causes the timer to continuously add up which messes up my routine lengths. In the Coder, this would be a simple change of the aforementioned line to routineTimer.reset(2), but unfortunately because I need to work with Pavlovia, I am stuck with the Builder. Is there an easy fix to this?


I’m surprised if this is an issue that it hasn’t been reported before, as it would seem to be quite fundamental…

You aren’t precluded from using code in the Builder. Insert a code component and do whatever you need to do. In this case, just reset the timer as required in the “Begin routine” tab. That custom code would be inserted after Builder adds time to the timer, so your code will countermand that.

You can have both Python and Javascript snippets within a code component, with the appropriate code being used depending on the environment in which the experiment is being run (and in the latest version, there is even an auto-translate feature which attempts to produce Javascript from the Python you enter.