The feedback of every trial is always “Wrong!”

OS: win10
PsychoPy version: 2021.1.4

Hi everyone,

I am conducting a basic two-back task with feedback messges. Now I am facing a problem that the feedback of every trial is always “Wrong!”.

I have no idea what went wrong so I changed the message from “Wrong!” to ”1!” and “2!” to see what would happen.

I found that no matter it was a correct answer or not, the feedback of the first trial would be “1!” and from the second trial to the final one, the feedback would be always “2!” no matter it was a correct answer or not.

This is my original code in my feedback code component.

#Begin Experiment
msg = ''
#Begin Routine
if corrAns == "space": #if the image is a target
    feedback_duration = 0.5 #show the feedback message for 500 msec
    if key_resp_practice.corr: #if you pressed space show a green positive feedback
        msg = "Correct!"
        text_feedback.color = [-1.000,1.000,-1.000]
    else: #if not, show a red negative feedback
        msg = "Wrong!"
        text_feedback.color = [1.000,-1.000,-1.000]
else: #if the image is not a target
    if key_resp_practice.corr: #if you correctly did not respond don't show anything
       feedback_duration = 0
    else: #if you responded, show a red negative feedback for 500 msec
        feedback_duration = 0.5
        msg = "Wrong!"
        text_feedback.color = [1.000,-1.000,-1.000]

This is the new code ( only change the ” Wrong! ” to ” 1! ” and “ 2! ” ).

#Begin Routine
if corrAns == "space": #if the image is a target
    feedback_duration = 0.5 #show the feedback message for 500 msec
    if key_resp_practice.corr: #if you pressed d show a green positive feedback
        msg = "Corret!"
        text_feedback.color = [-1.000,1.000,-1.000]
    else: #if not, show a red negative feedback
        msg = "1!"
        text_feedback.color = [1.000,-1.000,-1.000]
else: #if the image is not a target
    if key_resp_practice.corr: #if you correctly did not respond don't show anything
       feedback_duration = 0
    else: #if you responded, show a red negative feedback for 500 msec
        feedback_duration = 0.5
        msg = "2!"
        text_feedback.color = [1.000,-1.000,-1.000]

This is my text properties looks like.
1

And this is my keyboard properties looks like.
2
3

This is the corrAns column in my excel file.
image

I have no idea how to fix it, so any advice would be appreciated.
Thank you very much!

Hello,

try this

if corrAns == "space":
    feedback_duration = 0.5
    if key_resp.keys is not None and "space" in key_resp.keys:
        msg = "correct"
        fcolor = "green"
    else:
        msg = "wrong"
        fcolor = "red"
elif condition == "nogo":    
    if key_resp.keys is None:
        feedback_duration = 0
    else:
        feedback_duration = 0.5
        msg = "wrong"
        fcolor = "red"

Best wishes Jens

1 Like

Hi @JensBoelte thank you for replying!
I have tried your code but the first feedback was still “Wrong!”.
Moreover, it didn’t went to the next trial.
The error message was " elif condition == “nogo”:
NameError: name ‘condition’ is not defined "

Did I miss something?
Thanks again!

Hello,

sorry my fault. I added a column condition with the values go (space), nogo (empty cell) to the excel-sheet and I forgot to post the excel-sheet. I’ll come back to this topic later. I have a lesson to give.

Best wishes Jens

1 Like

Hello JX.Long

here my update

if corrAns == "space":
    feedback_duration = 0.5
    if key_resp.keys is None:
        msg = "wrong"
        fcolor = "red"
    elif "space" in key_resp.keys:
        msg = "correct"
        fcolor = "green"
elif corrAns is None:
    if key_resp.keys is None:
        feedback_duration = 0
    elif "space" in key_resp.keys:
        feedback_duration = 0.5
        msg = "wrong"
        fcolor = "red"

without condition as a column in the excel-file. I hope it works as you intend it to do.

Best wishes Jens

1 Like

Hi @JensBoelte thank you again.
I used the code you provided but it turned out to be no feedback messages.
Maybe something wrong in my 2-back code?
This is my 2-back code in code component.

#Begin Routine
one_back = []
if trials.thisN == 0: 
   two_back = practice_letters # initial value needed for trial 2
elif trials.thisN == 1:
   one_back = practice_letters # need this to swap with two-back on later trials
elif trials.thisN > 2: # need to update the n-back values
   two_back = one_back
   one_back = practice_letters
if practice_letters == two_back:
   corrAns = "space"
else:
   corrAns = ""

Thanks again for answering my questions.

Hello JX.Long

well, I don’t know. I tried my code without any 2-back. I didn’t know about the 2-back code. Anyway, first try running my code to see whether it fits your intentions. If this is the case, we take a look at the 2-back code.

Best wishes Jens

Hello @JensBoelte,
I tried the code but it turned out to be no feedback messages showing up. Do I have to do anything else in the text or the keyboard components?

Thank you!

Ok,

here my experiment
feedback2.psyexp (13.9 KB)
and stimulus-file
Feedback2.xlsx (8.7 KB)

I get a feedback (wrong) when I press the space-bar in case of a vowel or do not press the space-bar in case of a consonant. When pressing the space-bar upon a consonant, I get a feedback (correct). No feedback in case of a vowel and no space-bar.

Best wishes Jens

1 Like

Hi Jens,
Thanks a lot! I’ll do my best to check my setting with yours.
Thank you!

Hi Jens,
There’s a weird thing happened that I copied all of your settings but my text component was not presenting the time duration.
I don’t know if this was relating to the error.
The left window is your builder view, the right one is mine.

Do you know what might cause this?

Thank you!

Hello,

I set the expected duration to 2 seconds.

Best wishes Jens

1 Like

hi Jens,
Yes, I sat the duration too. But still not showed anything.

Hello,

you set the Start to condition 0.0. I use time.

grafik

Best wishes Jens

1 Like

hi Jens,
Thanks! It was my mistake for not being careful. However, even though I use the time, the feedback messages still not showed up.
The experiment can run, but no feedback showing up.

Hello

do you see the feedback when you run my experiment?

Best wishes Jens

Hi Jens,
Yes! Your experiment went perfectly well. So I don’t know what happened to mine.

Hello,

ok, what about taking taking mine and extending it. You intend to run a N-Back task?

Best wishes Jens

Hi Jens,
Yes, I intended to conduct a 2-back task. I added your code into my code component of the 2 back section.
Like this.

#Begin Experiment

msg = "feedback"
fcolor = ""
feedback_dutation = 0

Hello,

I often initialize a variable with a value, so fcolor = "blue" instead of fcolor = "". This allows you to check from the very beginning that sometimes goes wrong. Notice that there is a typo in feedback_duration.

Best wishes Jens