I am trying to find a way to code multiple correct response choices for a single trial of a reaction task and I realized that this is something that cannot be done in Builder. I have my code currently set up to call from a column (i.e., corrAns) in an excel file to get the correct response. However, only a single answer can register as a correct response. For example, when the letter “A” appears on the screen, the subject is supposed to press “q.” If the row in the “corrAns” column for the particular column has “q”, then the trial results in a correct response. I would like to program the script where the “q” key as well as the surrounding keys (i.e., capslock, tab, `, 1, 2, w, s, a) would also register as correct. I assume that the following code is what I need to alter:
if probe_resp.keys in ['', , None]: # No response was made probe_resp.keys=None # was no response the correct answer?! if str(corrAns).lower() == 'none': probe_resp.corr = 1 # correct non-response else: probe_resp.corr = 0 # failed to respond (incorrectly)
Basically, I want any of those nine key presses to register as “1” in the “probe_resp.corr” column. I have tried inputting the keys as a list (i.e., “[‘q’,‘capslock’,‘tab’,‘grave’,‘1’,‘2’,‘w’,‘s’,‘a’]”) in each row of the “corrAns” column, but that results in a response of “0” in the “probe_resp.corr” column. Please advise with any input you may have.