In my experiment, I show a traffic light (red circle, then amber circle, then green circle). Participants need to make a mouse click when they see the green circle.
I’m using a code snippet in my experiment to record which circle was shown (red/amber/green) when the participant made their mouse click.
My issue is that it always records that the mouse click was made during the amber circle presentation, even when that’s not the case!
How do I fix this? Thank you in advance!
This is the code that I’m using (every frame):
while checkWhen == 1:
if go == 1 & amberL.status==FINISHED & greenL.status==STARTED: #green shown.
wentGreen = True #clicked when green circle shown.
print('green')
checkWhen = 0
continue
elif go == 1 & amberL.status==STARTED & greenL.status==NOT_STARTED: #green not shown yet but amber shown.
wentAmber = True #clicked when amber shown.
print('amber')
checkWhen = 0
continue
elif go == 1 & redL.status==STARTED & amberL.status==NOT_STARTED: #if amber not started and red shown.
wentRed = True #clicked when red shown.
print('red')
checkWhen = 0
The go variable just stores if the click has been made in a different code snippet and is updated every frame using
`if mouse.getPressed()[0]==1:
go = 1``