Hello hellopsych
AFAIK, you can’t or you shouldn’t have two keyboard-components in one routine.
The error tells you what is going wrong: you are referring to a keyboard object called resp and then trying to access an attribute of it called .a. But keyboard objects don’t have an attribute with that name, so an error occurs. Instead, the key that was pressed is stored in an attribute called .keys (even though it contains just one keypress in this case). So as above, you need to use code like this:
Now I’m not sure what your_keyboard_component_name should be: in your screenshot shown above,…
You could use one keyboard-component, check whether two keypresses have taken place, end the routine, and finally check for the proper order of the answers and the number of responses given.
See here for a similar problem
Hello Woon
ok, the problem is that you compare resp.keys to the strings corrAns1 and corrAns2. resp.keys is however s, right, down, up, left or right. I used just ‘1’ and ‘2’ as an example. You need to change the if-else construction to
if resp.keys == [str(corrAns1), str(corrAns2)] or resp.keys == [str(corrAns2), str(corrAns1)]:
resp.corr = 1
else:
resp.corr = 0
Best wishes Jens
Best wishes Jens
1 Like