Feedback not giving the right feedback

OS (e.g. Win10):
PsychoPy version (e.g. 1.84.x): 2021.1.4
Standard Standalone? (y/n) If not then what?:
What are you trying to achieve?: I am building a lexical decision task. Participants have to decide if the word they see on the screen is an animal or not by pressing the left or right key in a limited time. In the practice trials, I need feedback only when the participants have the good answer (press the correct key), anything else (wrong answer or no answer) has to have no feedback.

What did you try to make it work?: I have tried this code and I tried writing it in different orders (i.e correct key first, then no key pressed …):


I have msg='' in the Begin Experiment section.

What specifically went wrong when you tried that?: When the participants don’t answer in the time given, the feedback is the same as the previous trial (i.e 1st trial the participant has the good answer and has a positive feedback, 2nd trial the participant doesn’t press any key and still has a positive feedback even if it is not the correct answer). When they don’t press the correct key, no feedback is given and the next trial starts.
I do not have any error message.

Thank you for your help!!

Hi!

Check this out, if you have not done so already: Tutorial 3: Adding trial-by-trial feedback in PsychoPy - YouTube.

Hello,

Thank you for your response!
However, I have seen this tutorial and it is not the type of feedback that I want to put in my task.

Try setting the text component duration as a variable set to change every repeat (e.g $myDuration) and in the code set myDuration = 0 when you do not want anything to appear and myDuration = 1 when you want to display the feedback message.

Hi,
Thank you for your suggestion! This is what I did:


But I got this error:

I don’t know how to fix this error code?

I am not shure, where in the code is this line located.
In the code component you can delete the msg = “” part and change conitnueRoutine = False to myDuration = 0 to see if somehow it fixes the problem

I think I solved the problem! Actually, the syntax error was the ‘$’ before the ‘myDuration’ in the text component. I erased it and it works! This is what my text component properties look like:

Thank you very much for your help!