Hi everybody!
I need some help
My Routine has a movie in background lasting 10 minutes. Participants can check the clock while watching it. The clock should refresh every 2 minutes. Within these 2 minutes the clock can be checked for a maximum of 3 times.
The code I wrote make me check the clock only for 3 times, for the whole duration of the movie. Thus, after the first refresh of the timer, if I used all the 3 available checks, the clock doesn’t appear again. I don’t get any error, but after 2 minutes (or after 3 presses), pressing check_resp key the clock doesn’t show up. It’s like the rule (to set opacity 1 to txt and box – see the code) is not updated when time refreshes.
Moreover, time refreshes only after 2 min and 6 min have elapsed, following this path:
What’s wrong with code? How can I solve it, ensuring time refresh every 2 minutes and allowing 3 presses for the ‘check’ after every refhesh?
Thank you very much
Here I report my code written in the Builder in a code component:
Begine Routine tab
Checktime = 0
keyCheckPressed = False
keyCheckPresses = 0
maxPresses = 3
CheckDelay = 2
refresh = 120
k = 0
i = 0
m = 1
r = 1
Each Frame tab
if len(check_resp.keys) > keyCheckPresses and len(check_resp.keys) <= maxPresses :
Checktime = t + CheckDelay
keyCheckPressed = True
keyCheckPresses += 1
check_txt.setOpacity(1)
check_box.setOpacity(1)
thisExp.addData('RT_check_'+str(r)+'_'+str(m), check_resp.rt)
m = m + 1
r = r + 1
if t > Checktime and keyCheckPressed:
check_txt.setOpacity(0)
check_box.setOpacity(0)
keyCheckPressed = False
if t > k*refresh:
i = 0
k += 1
m = 1
maxPresses += 3