psychopy.org | Reference | Downloads | Github

Inserting MSG if reaction time is quick

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): Win 10
PsychoPy version (e.g. 1.84.x): 3.1.2
Standard Standalone? (y/n) If not then what?: Yes
What are you trying to achieve?: I want the experiment to show a message saying “Too quick!” if the participant responds in less than X seconds ( let’s say , 3 secs)

What did you try to make it work?: I have an “instructions” routine with a “text” stimuli that calls a $word (xlsx file) with the questions, a key_resp component for the participant to press “F” or “M” .

I already achieved a “Too slow” message that starts on condition " clock.getTime() >= 6 ".
When I try to do the same for a “Too quick” , I need 2 conditions : “not key_resp” and " time =< 3 " but thing is my key_resp forces “End routine” so, if participant responds, then before it shows the message it already goes to the next line in the $word file

Also tried coding a component introducing a " core.wait(2) function after showing a message but does not do anything" .

What specifically went wrong when you tried that?:

I didn’t get an error. It just does not show the msg.

In my understanding, I guess that the problem is I’m trying to show a message at the end of each trial of a loop but when it ends because participant presses a key, it loops onto a new trial where all conditions reset. So my “text_tooquick” stimuli whenever it has the all the conditions ok, at the next frame those are reset and it does not start.

Your trial can consist of multiple routines. Allow your key press to end one routine and present the feedback on the second. Search this forum for posts about giving reaction time feedback for hints on how to specify the feedback text but you probably have most of the skills already in place.

Never use core.wait() in Builder. Builder scripts are structured around updating the display and checking for responses on every screen refresh, and that function pauses everything, which can have all sorts of unfortunate consequences.

Just to make thing clear…
You are suggesting to have multiple routines instead of a loop? In that case, how can I specify a key press to present feedback on the following routine?

I tried now allowing a key_resp to end routine and coding sth like this at the Begin Routine (stating msg=’’ at begin experiment) but didn’t work:

thesekeys = event.getKeys(keyList=None, modifiers=False, timeStamped=True)

while timer.getTime() < 3:
    if len(thesekeys)>0:
        msg = "MUY RAPIDO!"
        continueRoutine = False

while timer.getTime() >=3:
    if len (thesekeys)>0:
        if timer.getTime() > 6:
            msg = "MUY LENTO!"
            continueRoutine = False
        continueRoutine = False

It just crashes when starting the routine (freezes)

Also, I tried to do sth like :

while timer.getTime() < 3:
    if key_resp.keys :
        msg = "MUY RAPIDO!"
        continueRoutine = False

while timer.getTime() >=3:
    if lkey_resp.keys:
        if timer.getTime() > 6:
            msg = "MUY LENTO!"
            continueRoutine = False
        continueRoutine = False

And had same result, it crashes or just ends without an error. I’m guessing this second one is because key_resp is started at 0secs. I thought “if key_resp.keys” meant “if there’s a key pressing in key_resp.keys”

I looked for feedback discussions but still can’t find a tip on how to do this msg “too quick”. I tried other ways with and without forcing routine.

So, as to my first question in this reply: is the solution to abandon the “loop of trials” and set all the reps one at a time as a separate routine? (that would mean aproximately 45 routines, as my loop file contains 45 sentences to show)

No. Your loop can surround more than one routine. i.e. insert one routine for collecting responses, and a subsequent routine for presenting feedback, both within the same loop.

Definitely not. You need one loop that runs 45 times, presenting the two consecutive routines within it on each iteration.