Error:
Alert 4210:JavaScript Syntax Error in ‘Begin JS Experiment’ tab. See ‘Line 1: Unexpected token’ in the ‘Begin JS Experiment’ tab.
For further info see https://psychopy.org/alerts/4210.html
5119.4216 ERROR Line 91: Unexpected token in PVT-legacy-browsers.js
Description of the problem: The experiment does not run online, it remains indefinitely in the page that says “initialising experiment”. It works normally offline so it must be some problem with the conversion to JS which I was expecting since this one has a bit more of code.
I know I should not have used the “trials.thisN” as advised in previous posts but if I don’t and use “trials.thisTrialN”, it does not do what I need it to do.
Could you please point its faults so I can correct them? Thank you!
Also, do you know if the mouse is more precise than the keyboard?
They are not, no import statements work in javascript right now. You’ll have to remove all of the import statements in all of the “Begin experiment” code components.
It depends what you’re trying to do with them, mostly. For shuffle, you have to create your own shuffle function. You can find a simple one that you can copy into a code component here: Reference error: shuffle is not defined
For any other sort of randomness, you can just use Math.random, which is built in to javascript.
For time, I’m not sure what you’re trying to do with it, but there are various util.Clock functions that should work.
I was getting the stuck with no error message to start with too – again because I was importing random. I’m putting together a crib sheet. Please comment on it if you have anything you’d like me to add.
Hi,
My experiment is not running online too. On Psychopy it runs properly, but on Pavlovia is gets stucked on “Initiating the experiment”. What could I do to fix this?
Thank you