| Reference | Downloads | Github

Display "response recorded" message after specific key presses


I am creating an experiment (online) where there is a decision (they have to respond yes or not for a word that appears on the screen), and I want to display the message “Response recorded!” when they press either key (l or a). I tried using the feedback coding and added a feedback_text component and a code component:

#Begin experiment

#End of routine
if resp.corr:msg="Response recorded!"

but it only works for correct responses and, most importantly the message only appears AFTER the key_resp component duration is over (they have 3 seconds to respond), because I DO NOT want to force end of routine after the response.

During each trial an audio plays, so I do not want the routine to stop immediately after the response, but only when the audio ends. But I want the participant to know that her/his response was recorded so I want to display a message in the screen as soon as they respond (correct or incorrect, just response recorded).

What you want is a text component with static text content, and just control its visibility so that it appears when a response is made.

This code is Python- you’ll need to translate for online.

At the beginning of the routine:

text_visibility = 0

Each frame:

if len(resp.keys) > 0:
    text_visibility = 1

And put $text_visibility in the opacity field of the text stimulus, set to update on every frame.

Thank you for your response @Michael
It is not working-- maybe I am missing something, the message is displayed during the whole routine (before any key is pressed), opacity does not change. I am still working and testing in the desktop. I tried moving the components in the routine and change durations, but text still displays during the whole routine.

Screen Shot 2020-06-29 at 8.35.27 PM Screen Shot 2020-06-29 at 8.35.21 PM

Oh, I keep forgetting and rediscovering this bug (specific to text stimuli). See below for a discussion and a workaround (ie use another sort of stimulus to hide and then uncover the text stimulus):

This is an interesting solution. It worked with the polygon, thanks so much.