Duration variable not working in Pavlovia

URL of experiment: Pavlovia

Description of the problem:

I have defined the variable ‘myTrialDuration’ in a conditions file in an outer loop. I want to use this variable to set the duration of a condition in a routine which is in an inner loop. I haven’t used a $ symbol in the duration box of the condition. The experiment works perfectly in PsychoPy (v2020.2.10) but when I upload it to Pavlovia it doesn’t seem to work at all. I don’t get an error message, but the ‘trial’ routine runs once but then doesn’t seem to follow the inner loop and repeat itself so just stays on a blank screen.

I have seen other experiments working with a variable defined in an outer loop but being used in a condition in a routine in an inner loop, so I know this is possible. I just can’t seem to figure it out.

Any help is much appreciated.


Hi There,

Please can you confirm which component type is causing the issue? (since all of them have duration this will help us pin it down!)

As an additional solution you can try adding a code component and in the each frame tab type this:

if t> myTrialDuration:
    continueRoutine = False



Hi Becca,

That code component makes it work now so thanks a lot for that! Hopefully that’s the end of my headache.

Pleased you found a solution!