ReferenceError: w is not defined

URL of experiment: stroop_exercise [PsychoPy]

Description of the problem: i have a Python to JS translation problem causing an error in Pavlovia
ReferenceError: w is not defined

is there some way i could fix the JS code?
Thanks

Put w=0 and h=0 in Begin Experiment

1 Like

Thanks!
in the JS side? when i put in the python side JS calls synax error

Sorry

w=0
h=0

on the Python side

thanks i fixed it
now it shows

  • ReferenceError: times is not defined
    should i do the same for every parameter?

ignor my question
times is a different issue

In general it is needed for any variable this first appears in a loop or conditional clause (i.e. indented) on the Python side. I tend to use =0 for numbers, =’ ’ for text and =[] for lists if I don’t have a default value in mind but this probably doesn’t matter.

1 Like

is it possible that variable component(in this case times variable) doesn’t translate to JS well?

Correct. The variable component was created as a simpler version of a code component. However, it doesn’t have auto translate.

You need Begin Experiment times=[0,0,0] and Each Frame times=[t/60**2,t/60,t]

Thank you a million times! i would have been so lost without your help!
ill rewrite this variable as a code component