Getting weird results with getKeys

Hello,

I have developed an experiment where participants are asked to watch a series of videos and respond to behaviors by pressing specified keys. At the end of the loop, participants receive feedback telling them how many responses they got correct or incorrect. The experiment works perfect locally. However, I am having some issues when it is uploaded to Pavlovia.

The experiment does not error, but the feedback I am receiving is not correct. I have the follow line of code in each frame:

if (psychoJS.eventManager.getKeys((“h”))) {

I want it to wait for “h” to be pressed, check the time, and then increment correct or incorrect by 1 if it falls in the time range that was checked. However, it appears as though the program is not waiting for a press, much less looking just for the letter I have put in there. It is just adding correct and incorrect, so I get feedback numbers that are very large. For example, if I only have 8 possible correct answers, I will get a message saying that I got 846 instances correct. When I look at the data sheet, the incorrect column will also have a very large (but different) number.

These large numbers are happening regardless of if I press “h” numerous times or if I don’t press anything. This suggests that it isn’t waiting for the key press.

Can anyone help me figure out what is happening?

Thank you!

getKeys checks for a key press but doesn’t wait.

waitKeys shouldn’t be used in Builder.