Inline script in coroutine runs twice?
Hi all,
Has anyone else experienced the coroutine item running the 'Run' script twice in every loop iteration?
I have recreated this in a blank project only containing a coroutine with a single inline script. The print statement in the prep phase is getting executed once and the run phase print statement twice.
I was looking through the documentation but could not find anybody else describing this behaviour, so I suspect I have a silly mistake somewhere.
I want to send labstreaminglayer marker while presenting a stimulus. Getting two almost identically timed marker instead of one marker isn't terrible but I would still like to find out what is happening to cause this or if I am not using the coroutine item correctly.
Comments
Hi @Zebrakopf ,
The Run phase of a
coroutinesitem is executed on every iteration while thecoroutinesitem is active. This means that the Run phase (but not the prepare phase) can be executed many, many times, thus allowing you to implement (say) continuous polling of mouse position.Does this clear things up?
— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi @sebastiaan
That explains it. I misunderstood / didn't grasp that coroutines would loop through their items as often as they could.
I'll set a flag on the first run of the script to skip over any further executions of it.
Thank you!