Set polygon to display for a duration based on a variable?

OS (e.g. Win10): Windows 10
PsychoPy version (e.g. 1.84.x): 2021.1.4
Standard Standalone? (y/n) If not then what?: Yes

What are you trying to achieve?: I want to display a yellow line at the top of the screen that is only displayed as long as another component is (in some conditions the other component is an image, in others a video). The duration of the other image/video component is set by a variable in a spreadsheet and this changes on every trial, so the yellow line needs to match this duration on every trial.

What did you try to make it work?: I tried adding a line polygon, but this can’t be changed to ‘set every repeat’ so the duration variable doesn’t work and I get ‘Invalid syntax’ as an error when trying to run the experiment in Builder. This study will also be run online so if anyone has a code solution for the polygon component, this will also need to work in JS/Pavlovia.

Any ideas much appreciated!

1 Like

I changed the polygon to an image component and had the same issue at first. I found out the issue was for some reason it didn’t like the $ in the duration box. Once I removed this it worked fine, see here: Setting Text Duration to Variable Within a Loop
Unsure if the same would’ve worked with the polygon component.