TypeError: Cannot read property '0' of undefined (another one)

URL of experiment: https://run.pavlovia.org/lbdlpsych/tiny/html/?__pilotToken=1f0e3dad99908345f7439f8ffabdffc4&__oauthToken=cc5b32de325ff8e27fefed09e28d43220ebcabaf4757f2cd217fe2339ddab652

Description of the problem:
I am trying to get this project running on Pavlovia and cannot figure out what this error is referring to. I’m new to using PsychoPy/coding in general, so any help would be appreciated! This is what the console says when I attempt to pilot the task:

It seems to be a problem with the first image I’m trying to show, but I can’t figure out what is wrong with it. Per the cribsheet, I checked to make sue nReps is a number without $. I also manually set the unit to be heights rather than from exp settings to see if that was the problem. I saw another person had this error because their image names started with numbers, but that can’t be the problem here. Any other ideas? Thanks!

Does your image have a mask? The error seems to refer to mask and color

The mask field is set to “None” right now. I defined the study’s colors as variables (also per the cribsheet) at the beginning of the experiment.


green = [-.4,.5,-.1]
red = [.8,-.8,-.8]
yellow = [1,.5,-.9]
white = [1,1,1]

I just went back and checked to see what it said in the JS side, as I had previously set it to be:

green = new util.Color([-0.4, 0.5, -0.1]);
red = new util.Color([0.8, -0.8, -0.8]);
yellow = new util.Color([1, 0.5, -0.9]);
white = new util.Color([1, 1, 1]);

but now it has gone back to the autoJS version, which is:

green = [(- 0.4), 0.5, (- 0.1)];
red = [0.8, (- 0.8), (- 0.8)];
yellow = [1, 0.5, (- 0.9)];
white = [1, 1, 1];

I imagine this is the problem - how do I make it keep my version of the javascript?

It seems to be fine in the js file, however.

The issue is that my colours as variables shortcut should only be used in code components. If you follow through your ImageStim code it really says color: new util.Color(new util.Color([1, 1, 1]); I hope you can understand what that’s going to give an error.

For the image component I’d recommend specifying [1,1,1] as the colour rather than white.

Yes that makes a lot of sense - thanks! It seems to be working properly for text stim (i.e. the code reads color: new util.Color[(1,1,1)] ) but the most crucial place I need color is in three rectangle shapes I created. I want them to be red, green and yellow. They all display color: new util.Color(1.0) in the js, which I’m assuming is also incorrect. For PolygonStim, should I write it out (e.g. [-.4, .5, -.1]) rather than using the variables, too?