URL of experiment: testMT [PsychoPy]
I’m trying to move a mouse-tracking experiment online, which works locally. I’ve been having multiple error messages (thanks already to those who solved my previous issues) but now the latest error message is pretty obscure and I think it’s more convenient if I show you the whole code.
At the moment when I pilot the experiment, I get an error message after the dialog box:
Uncaught SyntaxError: Unexpected identifier
First, a capture of the flow:
The first code sets up the cursor at the center of the screen for each trial (I found that on the forum, not sure if it works for me).
#Begin routine const position = mouse.getPos(); mouse.x.push(position); mouse.y.push(position); mouse.time.push(mouse.mouseClock.getTime());
Then the next bit randomizes the position of the two text components (for 10 trials) so that the sides are 50/50 across trials.
#Begin experiment target_positions = [0.4, -0.4].map((val) => val * 5); util.shuffle(target_positions); #Begin routine target_x = target_positions.pop(); competitor_x = target_x.map(function(x) x * -1); psychoJS.experiment.addData("target_x", target_x); psychoJS.experiment.addData("competitor_x", competitor_x);
And in the text components I’ve set the positions in Builder to [target_x, 0] for targets and [competitor_x, 0] for competitors.
There was a time in a previous version where the experiment started, the first audio file was playing, but no text component. That’s when I changed the way I multiply competitor positions using “map”, and now I have the “unexpected identifier” error. So the problem could be there. But it’s also very possible that there are other problems elsewhere, so any suggestion is very welcome.