Taking my code from: Saving time of first mouse movement - #3 by wakecarter
Begin Experiment
myClock = core.Clock() # new util.Clock() in JS
Begin Routine
mouserec = mouse.getPos()
moved = False
tooSlow = False
Each Frame
if moved == False:
mouseloc = mouse.getPos()
if mouseloc[0] != mouserec[0] or mouseloc[1] != mouserec[1]:
moved = True
thisExp.addData('Moved',round(t*1000))
myClock.reset()
elif mouse.isPressedIn(target): # target is the name of the object to click on
rt = round(myClock.getTime()*1000) # t is seconds since the start of the routine
thisExp.addData('RT',rt)
continueRoutine = False
if rt > 3000:
tooSlow = True