Recording time of cursor in stimulus + restarting a trial if afk

I think @obeescee is not interested in the RT (despite what the code suggests) but in

Then you would have to record the time at which the mouse enters the stimulus area and the time at which the mouse leaves it, as I suggest above. But you make a good point about the need for some condition, which ends the routine.