Correct answers for remember/know recognition memory task in conditions files?

I am creating program for remember/know/new recognition memory task with number keys on the top of keyboards. Using nubmer key 7, 8, 9 for remember/know/new responses.
In correct answers for remember/know task in conditions files, I wrote in the column of corrAns_recog 7, 8 which means that if you press 7 (remember) or 8 (know) should be correct.
However, in PsychoPy output files, in recog_key_resp.corr whether I pressed 7 or 8, it all marked as incorrect with 0. In PsychoPy Builder, as in my experiment, if we have two correct answers 7 or 8, how should we write in correct answers column in conditions files for recognition memory? If write 7, 8 as correct answers, but if I press 7 or 8, it all marked as incorrect in the output files?

You could have 9 as the correct response which would separate 7 and 8 (0) from 9 (1).

To have multiple correct answers you need to use a code component in End Routine, e.g.

score = 0
if recog_key_resp.keys == 7 or recog_key_resp.keys == 8 or recog_key_resp.keys == 'num_7' or recog_key_resp.keys == 'num_8':
     score = 1
thisExp.addData('Score',score)

It’s possible that you might need to put quotes around the numbers. You can also use this to enable the keypad so long as you put them as allowed keys…

Thanks.
If so, we should not put correct answers for remember/know task in the conditions files if we have two correct answers. And should not store correct answers in the PsychoPy Builder for the task.
And this should only be achieved by adding code.

You could use code and columns in the spreadsheet, but I’d recommend putting two answers in two columns.

how to put correct answers put remember/know/new task with 7, 8, 9 keys?
if so how to story correct answers in PsychoPy Builder?

Hi wakecarter,
I tried your solution.
But, in the PsycoPy output file in the score column all marked as 0 whether the response is correct or not.
Currently, it is hard to record correct/incorrectness for remember/know response, due two they has tow correct answers?

Did you try with quotes?

What does your code currently look like?

Is the correct answer either 7/8 or 9?

Yes, I tried both with and without quotes.
But score all appears as 0 in output files.
For my experiment, I set number keys 7 for remember response, 8 for know response, and 9 for new response. I used the number keys on the top of keyboard.
The key thing for me is that to mark 7 and 8 as correct answers for old words, and 9 as correct answers for new. I tried the code like in your above example. However, it does not work.

If you have a column in your spreadsheet called Answer with values old and new then you could use this code:

score = 0
print('recog_key_resp.keys',recog_key_resp.keys)
if Answer == 'old' and (recog_key_resp.keys == '7' or recog_key_resp.keys == '8' or recog_key_resp.keys == 'num_7' or recog_key_resp.keys == 'num_8'):
     score = 1
elif Answer == 'new' and (recog_key_resp.keys == '9' or recog_key_resp.keys == 'num_9'):
     score = 1
thisExp.addData('Score',score)

Make sure that recog_key_resp.keys is only set to record the first response.

Thank you wakecarter.
Above code is very helpful.
The problem solved.