Hello
I programmed a self-paced reading experiment which runs fine offline but does not run online. The error message is that the response key_resp.keys is not recognized.
I use some code to split the sentences in words
I assume the error is due to the fact that the key_resp.keys is not yet known.How do I make the key known to the program or prevent the error?
Best wishes Jens
In codeLesen Each Frame you should indent all of the if statements below the first one so they only run if at least one key has been pressed.
2 Likes
Hello
Thanks for the advice. It solved the problem. I changed the code to
if key_resp.keys:
wordNum = len(key_resp.keys)
if len(key_resp.keys) == Idx & Idx < nWords:
word = words[Idx]
Idx += 1
#this need to be here
#otherwise no first word
if Idx == 0:
word = words[Idx]
Idx += 1
if wordNum == nWords:
continueRoutine=False
I also had to move the code component to the bottom.
Best wishes Jens
You could put word = words[0] in Begin Routine instead of your middle clause.
1 Like