Continue to next trial if there is no mouse response in 3 seconds (PASAT)

OS : Win10
PsychoPy version : 2022.2.5

What are you trying to achieve?: I’m making a PASAT. Participants are presented with one number stimulus at a time for 1.5secs. They must add the current number with the one previously viewed and click on the correct answer (numbers 1-20 presented on screen in images). The problem is, I want them to move on to next trial if there is no mouse response after 3 seconds (but also provide correct/incorrect feedback if a response was made). If a response is made, everything runs fine, but if there is no response, it crashes.

What did you try to make it work?: I tried making all stimuli and response components in the routine last for only 3 seconds. Also tried adding a code component at top of feedback routine with the following code in “each frame” tab:

if mouse.clicked_name[-1] == corrClick:
    fb_text = 'Correct!'
    fb_col = 'green'
else:
    mouse.clicked_name[-1] != corrClick
    fb_text = 'Incorrect'
    fb_col = 'red'
if t > 3.0:
   continueRoutine = False

What specifically went wrong when you tried that?: If there is no response, I get this error message:

if mouse.clicked_name[-1] == corrClick:
IndexError: list index out of range

I’m new to coding so any help would be very much appreciated! I know the last bit is what’s causing the problem, I just don’t know how to limit each trial to a 3 second time-limit.

I found a solution! Really basic, but not obvious to coding newbies like me :slight_smile:
For anyone interested…

if len(mouse.clicked_name) ==0:
    continueRoutine = False
elif mouse.clicked_name[-1] == corrClick:
    fb_text = 'Correct!'
    fb_col = 'green'
else:
    mouse.clicked_name[-1] != corrClick
    fb_text = 'Incorrect'
    fb_col = 'red'
1 Like

Dear Fionn, is it possible for you to share the code for PASAT that you made last year? I would greatly appreciate that

Hi Eugene,

No problem. The link is here: Pavlovia

Let me know if you need anything else.

Fionn

Dear Fionn, could it be that the test is hidden within your settings? That’s the message I am getting after clicking the link:
No information is available for this experiment. Either it does not exist or you do not have access to it.