OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 3
Standard Standalone? (y/n) y
What are you trying to achieve?: In my experiment, participants are supposed to learn new words. After a training phase I want to check how well they’ve learned the new words. For this I want to present the new word in the middle of the screen and let them choose one of two definitions shown on the bottom right or left on the screen (randomized where the correct and the distractor definition are presented). I wanted to give feedback on whether their response was correct.
What did you try to make it work?: I used a code component in the beginning of the feedback routine.
In the routine were the response is given I put
msg = " "
in the begin routine code component so that it will refresh each trial.
What specifically went wrong when you tried that?: Feedback is shown after the choice is made, however in my excel data file key_resp_corr is always 0, even if the answer was correct. No error message occured. It might be a problem that the correct answer is a whole sentence and not a word. In the key_resp component I put the parameter $definition in the field for correctAns. This parameter is also used to display the definition. I cannot say right or left would be the correct answer as the correct definition’s location is randomized.
I hope this is understandable and gives enough information. I really hope someone can help me.
I already had a question concerning this set up regarding the randomization of the distractor definition, here: Participant choosing one of two choices fitting to a target - Builder - PsychoPy
I think this could be a slight misunderstanding on how the variable corr is created. So hopefully this helps.
Ok to start figuring it out, try adding a code component (found under custom) to your routine.
In the ‘end routine’ tab, type:
print('definition is: ', definition)
print('response was: ', key_resp)
print('response correct?: ', key_resp==definition)
Essentially to create the key_resp.corr variable, psychopy is asking does the key pressed correspond to what is written in the definition column (i.e.
If you need definition position to randomly be on left or right, you will need your conditions file to be something like this:
Then in your routine you have 4 components:
- centre word, where the textField is $word
- definition1, where the textField is $definition_left
- definition2, where the textField is $definition_right
- key response, where the correct answer field is $corrAns
Give this a go and hopefully this should work as you expected for you to then adapt to your experiment.
Thank you, Becca!
I didn’t use the print code though but instead sticked to msg to show feedback. The key_resp.corr works perfectly now, thank you very much!
fantastic - pleased you have a solution!
It’s me again. Sadly the feedback works when testing it in the desktop version, however it does not work on pavlovia…
I updated my condition file the way you suggested it and filled in $corrAns in the key_resp component.
That’s the code I’m using in the routine after the one where the response is given:
When piloting it in Pavlovia it says that resp is not defined. I tried to use the code you suggested with the print command but it didn’t help.
I’m sorry for bothering you but I do not know how to solve this problem
Please could you share the URL to your project so that I can take a look ?
[to do this select View code> settings (cog on left panel) > general > permissions> set to public > share the URL with me here]
The experiment is called t2_t4_imagery_a
Thank you for your time!
I think it is that you need to change the ‘code type’ of your ‘code_feedback’ component to be ‘Auto->JS’ (switching that on seemed to work for me!).
Hope this helps,