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.
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.
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.
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).
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.
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 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:
for stimulus in stimuli:
if stimulus.contains(mouse) and stimulus.name == corrAns:
thisExp.addData(āclicked_stimulusā, stimulus.name)
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?