[open] Timed loops
Hi
My training group is supposed to do an exercise loop for fourteen minutes, and finish the loop they're on when the times runs out after which the excercise ends. I'm wondering if there is a built in feature to set a loop to run for a set amount of time or if I have to do it with inline scripts, I didn't find anything in the documentation concerning it.
regards
Benjamin
Comments
Hi Benjamin,
The easiest way to accomplish this is by using the 'Break if' statement, which is under 'Show advanced options' in the loop item. For example, the following 'Break if' statement aborts the loop 10 seconds after
start time(which you need to set, see below):This is a Python-style conditional statement, as described here:
Of course, to make this work, you also need to set the variable
start_time. You can do this with a simple inline_script, which you can insert (typically) just before the block_loop:Hope this helps!
Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
'Break if' statement could abort the loop 10 seconds after start time, as in your example. In this case, the timing to abort the loop is before going into the next loop. In my case, I want to abort the loop after a certain period of time, even if it is running the current loop. Is it possible to do so? How can I do to force-quit the sequences after a certain period of time?
Thanks in advance.
Hi Koba,
This is not really possible. What you can do to accomplish this to some extent is use Run if statements for all items in the sequence, so that these items are skipped when the time period has expired. Something like:
=self.time() - self.get('start_time') <= 10000.However, this would not halt execution while an item is running (for example while a keyboard_response item is waiting for a response). To accomplish this, you would really need to write an inline script that continuously checks whether the time period has expired, and halts when this happens. Does that make sense?
Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Thanks, this was exactly what I was looking for.
Thank you for your quick response.
I can see your point. Indeed this doesn't sit well with me, but it looks difficult for me to write an incline script that continuously checks the time...
And, Thank you very much for Runtime for Android. Looking forward to activating the synth and sampler sampler item.
Kind regards,
Koba