psychopy.org | Reference | Downloads | Github

Continue t from one routine to the next?

General question:
Is it possible to let the trial clock t continue from one routine to the next?
Or at least pass its value on so that it can seamlessly continue?
I have a stim that moves as a function of time and I want the movement to continue smoothly from one routine to the next

Hi Marc,

You can create your own clock in code, which Builder won’t know about, so it won’t get reset unless you do it yourself. e.g. in a code component’s “begin routine” tab, do something like this to create a timer that will only be created at the start of the first loop iteration, and so will keep timing across trials:

if your_loop_name.thisN == 0:
    marcs_timer = core.Clock()

Then at any point, you can get the time from this pan-trial clock via:

marcs_timer.getTime()

You don’t want to be changing the behaviour of the t variable itself, as Builder uses that extensively to control things.

1 Like