Selective feedback: feedback only after negative responses not after correct ones

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): v2021.1.4
Hi everyone,
I’m new to PsychoPy and don’t have any programming experience so my problem might be very easy to solve but I just can’t figure it out and start feeling desperate. I’m thankful for every input and help I could get!

What are you trying to achieve?:
I’m doing a color-shape shifting task. The participants are presented with four different stimuli. Depending on a cue they have to decide if the presented stimulus is red vs. green or triangle vs. rectangle. If their response is incorrect I want them to get a (preferably short buzz sound, but I decided to try it first with a visual word feedback because I’m more familiar with the text component) feedback before the next stimulus. If their response is correct the next stimulus should start without any feedback. This selective feedback is the problem I couldn’t solve.

What did you try to make it work?:
I had no problem with getting a feedback for both (negative and positive) response types by introducing a code component (“FeedbackCode1”) with an if/else statement. Then I tried to simply reduce the duration of the positive feedback to 0.0 seconds but i couldn’t find a suitable option for this in the feedback text component (“FeedbackText1W”). I don’t know if this is even possible. Just for further explanations the name of the keyboard component is “AntwortNuFaUe”. Afterwards I tried to define two different variables in the code component like this:
if AntwortNuFaUe.corr:
Ausgabe1 = “korrekt”
else:
Ausgabe2 = “falsch”
I created two different text components for “Ausgabe1” and “Ausgabe2” and reduced the duration of the text component with “Ausgabe1” to 0.0 seconds but the experiment crashed with the first response.
Next I tried this:
if not AntwortNuFaUe.corr:
Ausgabe1 = “falsch”
This option again terribly failed:
If the first response was correct the experiment crashed:
NameError: name ‘Ausgabe1’ is not defined

Experiment ended.

If the first response was false, the experiment continued and I got the negative feedback for every response (incorrect and correct ones).
There are some screenshots of my last attempt for visualization.

Please help. I’m lost


In principle, what you should have is the following in Begin Routine of your incorrect feedback.

if AntwortNuFaUe.corr:
     continueRoutine = False
1 Like

Thank you very very much for your response! It almost works but I encountered another problem. If the first response is incorrect everything works exactly like I want (only negative feedback appears and next stimulus is presented immediately if response is correct). But if the first response (to the first stimulus) is correct the experiment ends abruptly without the presentation of the other stimuli. I have no clue why it’s working perfectly if the first response is incorrect but not if it is correct.
This appears:
FeedbackText1.setText(Ausgabe1)
NameError: name ‘Ausgabe1’ is not defined

Experiment ended.

My updated code component looks like this:

Put Ausgabe1=“False “ in Begin Experiment instead of Begin Routine

1 Like

Thanks again! it works perfect now. You really helped me out a lot!