Unable to Properly Run Experiment Online (Variables Undefined in JS)

Hi there!

URL of experiment: https://run.pavlovia.org/YBirchPsy/bart_risktype1_rumination/html
https://gitlab.pavlovia.org/YBirchPsy/bart_risktype1_rumination

Description of the problem: I’m having the classic problem of being unable to run an online version of my task. Once I get past the participant information dialog, I get an error message informing me that the variable balloonSize is undefined or can’t be referenced. These are defined at the beginning of the experiment in the Python code (this was built in the Builder) and I used the auto -> JS where I could, but I can’t seem to get it to work. I’d like to note that I recycled a lot of the code from the demo version of the BART on Pavlovia (I used it as a framework to learn how everything works), so I’m not sure why this version does not work. Any help in furthering my understanding and fixing the problem would be very much appreciated!

Hi There,

I just had a fork of your task and it looks like the code components are all set as ‘Py’ and when I change code type to ‘Both’ there is no JS ‘under the hood’. This means that your online task isn’t getting any of the variables your local task is getting (because non of the code components exist in JS). However, reading your description, it sounds as though you have translated the code components - is it possible that the sync hasn’t fully registered? after you translated the code components to JS did you get a message that the sync was successful?

Thanks,
Becca

Hi Becca,

Many thanks for your reply, and for notifying me that the sync hadn’t actually gone through! I’ve since synced it so all the files should be there in their latest form (along with the JS translations). Unfortunately the experiment seems to have gone backwards rather than forwards, and I’m now stuck at the experiment initialisation screen. According to the developer view, this is down to a missing } somewhere, but I unfortunately do not know how to rectify this from the Builder view. This is also a completely different problem to what I was initially experiencing, so I’m a bit stumped!

Thanks,
Yan

Hello again!

Just to update, I think I’ve made a bit of progress, but I’m now being struck with an error stating * TypeError: Cannot read property ‘_psychoJS’ of undefined.

Not entirely sure what this is referring to, but I’ve also tried to run in Firefox and it tells me the variable win is undefined, despite me defining as per the crib sheet.

Yan

Another update after some tinkering.

So I ran into some issues with JS not wanting to recognise the sound command, but have bypassed that by removing the sound component of the experiment. I now run into the problem that during my trials, the balloon fills constantly as if the space bar is being tapped repeatedly. Additionally, the text I want to update on every frame to display the value of the balloon just displays NaN. I’m not sure how to reference variables using the Text component in a way which JS will play nice with.

Yan

All fixed now! Completely rebuilt it from the ground up, but I’ve run into another problem under a different topic.