Forcing End of Routine One Second After Mouse Click

Hello!

I have a routine where participants press on a word on the screen with the mouse.
Currently, I have it set so that the mouse click forces the end of the routine.
Instead, I want the routine to end one second after the mouse click.

Let me know if there’s any more information I should include to help answer the question!
Thanks in advance.

Hi @leorelizur, you can do this using a code component. In this example, the text component is called text and the mouse component is called mouse. In the code components relevant tabs:

# Begin routine
clicked = False  # flag for starting timer

# Each frame
if mouse.isPressedIn(text) and not clicked:
    clicked = True
    endTime = t

if clicked and t > endTime + 1:
    continueRoutine = False