Hi, I have created an experiment in the builder with a code component. In short, a sound is played, and participants then need to select an image and click on it with the mouse. To get RT, Mouse.time does not work because it registers many clicks, and if I select “End routine on Press”, it registers any click, not restricting it to the image. I think my best option here is to add a code component to get reaction time. I don’t actually know how to do this. The current code I am trying gets me odd numbers in RT (always 0.000… something).
Below is my code component for registering which image has been clicked on + my failed attempt for getting RT.
win.setColor('white') clock = core.Clock() for stimulus1 in [ uh, oh, ah, au, u, o, a]: if mouse.isPressedIn(stimulus1): timeUsed=clock.getTime() #get the the time used by the subject to respond since a stimulus is displayed. continueRoutine = False thisExp.addData('clicked', stimulus1.name) thisExp.addData('RT', timeUsed) stimulus1.opacity = 0.2 win.flip() stimulus1.opacity = 1 if continueRoutine: # don't flip if this routine is over or we'll get a blank screen event.clearEvents() clock.reset()