Feedback is always Incorrect

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

OS: Win10
PsychoPy version: 3.2.4
What are you trying to achieve?:
I am designing a cued switching task for children, where they have to sort some toys based on their color or shape. The outline of the experiment is as follows:
There will be four stimuli: Red Bear, Blue Bear, Red Car, and Blue Car.
If the cue is for color, participants have to select either blue or red color, whereas if the cue is for shape, they have to select either bear or car. So, there are four response options: A=Blue, S=Red, K=Bear, L=Car.
The problem I am facing is that I have to provide feedback after each trial, but the feedback appears to be INCORRECT, no matter what the response is. Also in the data file, resp.corr is always zero.

What did you try to make it work?:
I tried to provide feedback by putting the code as given in:

What specifically went wrong when you tried that?:
The displayed feedback is always INCORRECT and in the data file resp.corr is always zero.

Please help me find out the problem and solve it.

What do you have as the correct answers?

If your answers are in upper case they won’t match the key presses

Thank you for your response. I checked the answers, they were indeed in capital letters. I changed them into small letters as I have entered in the experiment design. Even after changing them to small letters, resp.corr is still zero.
In one of the topics on this forum similar problem was mentioned. I tried to add that code as well as given in that topic but it didn’t work.

Please could you post your current code and the keyboard component?

This is the keyboard settings.
This is the code I wrote using this link: Feedback depending on correctness of answer inside a trial
code_4 properties2

  • Your code runs at the beginning of the routine. No response has been made at that point, as the trial hasn’t started, so your message will always be set to “incorrect”.
  • Delete the first six lines of your code. Even if this code was running in the “each frame” tab, it would just be duplicating the function of the keyboard component itself, so it is not needed.
  • I’m guessing that the last four lines of your code could be retained but should be shifted to the “end routine” tab, if it is designed to set the text feedback on the next routine in the flow panel.
1 Like

I deleted the first six lines of the code and shifted the remaining code to the “end routine” tab. Still the problem persists.

You should also tell the keyboard component to store just one response, rather than all of them (I’m not at my computer at the moment so am not sure how PsychoPy could judge correctness if more than one response is allowed).

It finally worked. Thank you for your help.

The issue is regarding the same experiment. Now I am trying to run the same experiment using a touchscreen laptop. The outline of the experiment is the same. The target screen will have a target picture (Red Bear, Blue Bear, Red Car, Blue Car) at the center and four response options (Red color patch, Blue color patch, Bear drawing, Car drawing) below the target. Based on the given cue, the participant (in my case children) will have to respond by touching the appropriate response picture on the screen.

With the help of the discourse earlier: Using the mouse for selecting images I tried to write a code as follows:

and the mouse component as follows:

After this, in my data file I am not getting which picture has been clicked. Since, there are correct and incorrect responses, I wanted to have a column as before which stated whether the answer was correct or not by giving ‘1’ or ‘0’ in the column. This also is not shown in the data file.
I also wanted to provide feedback to the participant by highlighting the selected picture in either red or green color, based on whether the response was correct.
Please help me solving this issue.

Thank You

Use the .contains method and put the code in End Routine

Thank you for your response. I had a confusion with .contains() method.
The following code was suggested in this discourse: Writing contains(mouse) to output

this list should could just be created once per trial, in the ‘begin routine’ tab:

stimuli = [topLeftImg, topRightImg, bottomRightImg, bottomLeftImg]

and this run on every frame:

for stimulus in stimuli:
if stimulus.contains(mouse) and == corrAns:
continueRoutine = False
break # end the loop on first click

Here, what will “mouse” denote? Sorry for asking silly questions, but I am not very familiar with coding so I keep getting confused with variable names to be put in the code. Also, I have four response options. So, do I have to write for loop for each response option?

Thank You

I create a mouse component in my first routine called mouse. I can then use it in code in all future components.