URL of experiment: WTK_Newstories [PsychoPy]
Description of the problem:
This error (TypeError: Number.IsInteger is not a function) comes up I can’t work out the cause of it. It begins at the first point after instructions, trying to draw basic text to a screen. It does not matter if the text comes from an input file or if I just type it in the box. It works fine in PsychoPy, using the automatic translation to JS. I have been trying to troubleshoot for a few hours now, and I am still stumped. The developer view in the browser does not offer a clue as to where the error is happening, but it does suggest it is trying some conversion to numeric. Any help would be most appreciated.
- context: “when converting an object to its numerical form”
- error: TypeError: Number.parseFloat is not a function at convertToNumber
Might the error occur as you enter a loop? If so, what is the value of nReps?
Yes, it only happens when the trial is happening with a loop. It takes an input file with 7 variables. nReps is 1. The Conditions file has 120 conditions across 7 columns, so in Psychopy is just runs through those as 120 trials. Perhaps there is another way to make it work with JS?
I’ve just looked at the developer view and the error appears to be in this line
this.buttons = Number.isInteger(buttons) ? buttons : 'which' in event && event.which;
Do you have button components or buttons defined in code?
Button components. Allowed keys are “right” and “left”, set as constant. Everything else is left as default. I will have a quick try with different button responses… hmm no dice. I have been adjusting the code a bit this morning. Currently, the error in developer view comes up at this point, but that changes if make the text not a variable:
Ah! One of the variables in the loop condition file was called “Number”. I changed that and it was fixed. Thanks so much for your time. The clue was in the ‘loop’ dependency
Ah yes. Number is already on my crib sheet as a variable name to avoid.