how to calculate total duration time of sketchpad?
Hello!
I am planning an experiment about solving an anagram.
Every time participant sees a word, he/she presses any key and write the word into the text input and then anagram comes again. I want them to be able to see anagram only for 180000 ms in total. I could calculate the time between the time_anagram and time_text_input and I could get the cumulative total. But because this calculation is based on time_text_input, when the time is up anagram doesn't disappear. It only disappears after the text_input, if the time is up.
So, I need a variable which counts the duration time of the sketchpad including anagram, independent from text_input. When cumulative total of time_anagram reaches to 180000 ms, the loop should break.
Is there any suggestion to solve this problem?
Thanks in advance!
Comments
Hi,
This requires some scripting. Basically, what you need to do is to compute the residual time after every item has been executed. The time that is left, you should set then as
duration
/timeout
field for the next item. That way you can make sure that the sequence does not last longer than 180 seconds. Depending on your experimental structure, you can build some other conditioning around that.Does that make sense?
Eduard
Thanks for your reply Eduard!
I am not sure if I got it correctly: Is this way independent from text_input phase?
That actually makes sense, but here is the thing: suppose that participant saw the anagram (sketchpad) for 178 seconds and press the key and saw the text input and wrote the word. Then he/she saw the anagram again and it doesn't stop until he/she presses the key again. Because this script is based on the residual time between the anagram and the text input. So he/she can see the anagram for much more seconds than 180, whenever he/she presses the key again. I need a variable based on duration time of the sketchpad, not based on a subtraction script. Because this way doesn't actually standardize the duration time of the anagram for all of the participants. I need to find a variable to break the loop when time is up, even it was on the anagram phase. Is it possible?
Hi,
you are right, I made a mistake. I think what you want is not possible to do with sketchpads and text_input_forms only. Maye co-routines can help you? If I am not mistaken you can set an overall duration for a co-routine, I am just not sure whether you can (and if so, how easy it is) to wrap a co-routine inside a loop.
Regardless, it should be possible to accomplish this with some python coding though. So, use an inline_script and start a while loop. This loop lasts for 180 seconds. Further, every time an event is detected, it changes the stimulation. Once done, it continues to sample for a key press, while throughout keeping track of the time in the background. This code here is not supposed to work, but could you get started:
Again, I didn't test this code and didn't even try to make it perfect. I hope you will understand the logic of how to approach this problem with python coding.
Good luck,
Eduard