How to set multiple answers correct

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

OS (e.g. Win10): 11
PsychoPy version (e.g. 1.84.x): 2021.2.3
Standard Standalone? (y/n) If not then what?: hm, I’m not sure what standard standalone means.
What are you trying to achieve?:

so, I want to set several answers correct in my experiment. In the experiement, partcipants are asked to respond with pressing the number keys (1,2,3,4) on keyboards. But you know there are two sets of number keys on keyboards: on the right side and on the center. So, some people would use the one on the right side, but others use the center one. Thefore, I should be able to make two keys (e.g., ‘num_2’,‘2’) as correct answers.

What did you try to make it work?:

I read through all the threads related to my questions. I saw a person suggesting making additional columns in the loop file so that the program can know that there are multiple answers. However, he did not describe how to set them as correct answers.

I tried putting $ans1, $ans2 to Correct response in the keyboard property thingy…?
(ans1, ans2 are column names for possible answers)

What specifically went wrong when you tried that?:
Include pasted full error message if possible. “That didn’t work” is not enough information.


This post seems relevant to your problem. Briefly:

  • You only need 1 $ans column and it should be the string number (e.g., '1', '2').
  • After reading the keyboard response, add a code component to “clean up” the key response, similar to the solution in the linked post. In essence, if the key response is kept in a variable called key, then only retain the last char of the array. As a result, ff key = '2', then key[-1] = 2, and if key = 'num_2', then key[-1] = '2'.