Pilot study not running, cannot find JS bug/bad code

URL of experiment: https://pavlovia.org/VinVen/workingmemory

Description of the problem: Dear all, I wrote a working memory task using Psychopy3 Builder, in which I added a little bit of code through Code Component. The experiment reads a few .csv files but no external stimulus files. The experiment runs fine in Psychopy. After having Psychopy convert my .psyexp file to .js files in “html” folder, I updated the .js file by replacing “append” with “push”, the “random.shuffle” call with a JS randomization code and initialized variables globally that were somehow not automatically identified as such after auto-conversion from .py to .js (an issue that may be related to using the Code Component?). However, the Pilot gets stuck in “initialization” screen and fails to run. With my very limited JS powers I cannot find the offending code.

Hoping for your help, kind regards,
Vincent.

Hi, you should really avoid editing the .js file manually unless you really are confident in your Javascript skills. It is better to just provide a javascript equivalent to your custom Python code component snippets. In the code component, set the “code type” button to “Both” to enable you to type in JS equivalents to your Python, or “Auto -> JS” to let Builder have a go at translating your custom Python code itself.

Dear Michael,

thanks for your feedback. Although I agree, previous posts suggested me to replace python’s random call with that of JS. Previous attempts at solving everything within the python code using the Auto -> JS option didn’t work, possibly due to some
effect of the Code Component on variable identification or setting of scope. I’ll have a go at the “Both” coding approach in the Code Component.

Kind regards,

Vincent.