Breaking a loop based on amount of time passed
Hi,
I think I have a simple problem, but I'm having a difficult time finding the solution. What I would like to do is loop simply 2 items: a sketchpad item with just a fixation +, followed by feedback with a text display when the ENTER key is pressed and duration of 5 seconds; for a total duration of 10 minutes for the task. This is how I've set it up so far:
inline_script that reads var.break_the_loop=False (before the loop item)
new_loop that runs the cycle many many times sequentially (my table has two columns, Text and Correct; [Text] is either + with [Correct] as ENTER, or FeedbackText with [Correct] left blank)
new_sequence (every "run_if" field has [break_the_loop]=False)
inline_script_2 that reads t0=clock.time()
sketchpad item with [Text]
keyboard_response with allowed responses as ENTER
feedback item with [Text] and duration 5000
inline_script_3 that reads if clock.time()-t0>60000 break_the_loop=True
I'm using 60000 here so I can test it without having to wait all 10 minutes.
The error I'm receiving is as follows:
Inline script, line 1
if clock.time()-t0>60000
^
SyntaxError: invalid syntax
Is there a simple solution to this that I'm just not seeing?
Thank you so much,
Lauren
Comments
Hi lauren,
If you want to break, you need to break
Try this code:
If it doesn't work, I would (personally) revert to
inline_script
ing everything. Your design should be quite easy implementable without Opensesame Items.Eduard