Hello,
I’m having a similar issue. I have 4 condition files that define my stimuli structures using 0 or 1 values. My stimuli is divided into 4 sections. Each section is assigned 2 colors, it is one color if the value on that trial according to the condition file is a 0, and the other color if there’s a 1.
I have a list of my colors (ColorChoices), which is reshuffled for each condition. I have variable names $Slice1, $Slice2, $Slice3, $Slice4 in my image files. In my Begin Routine tab I have the code below.
Then in my next routine I have the code (copied to the very bottom) in the Begin Routine tab that tells the part of the stimulus what color to be. If the condition file shows 0, the first part of the stimulus is the first item in the color list, if it’s 1 then it’s the second item in the list, etc. This works well in the builder. But when I put it online the error says “We encountered the following error: when defining a color, unknown named color”. So I added the the colors and defined them like you’ve suggested here. However, I still get the same error message. I am not sure what I am doing wrong here. Any advice?
yellow = [1,1,-1]
darkgrey = [.3255,.3255,.3255]
magenta = [1,-1,1]
sienna = [.2549,-.3569,-.6471]
blue = [-1,-1,1]
white = [1,1,1]
green = [-1,.0039,-1]
red = [1,-1,-1]
ColorChoices = [yellow,darkgrey,magenta,sienna,blue,white,green,red]
shuffle(ColorChoices)
javascript:
yellow = new util.Color([1, 1, 0]);
darkgrey = new util.Color([0.3255, 0.3255, 0.3255]);
magenta = new util.Color([1, (- 1), 1]);
sienna = new util.Color([0.2549, (- 0.3569), (- 0.6471)]);
blue = new util.Color[(- 1), (- 1), 1]);
white = new util.Color[1, 1, 1]);
green = new util.Color[(- 1), 0.0039, (- 1)]);
red = new util.Color[1, (- 1), (- 1)]);
ColorChoices = [yellow, darkgrey, magenta, sienna, blue, white, green, red];
util.shuffle(ColorChoices);
if Slice1 == 0:
Slice1Color = ColorChoices[0]
S1.append(Slice1Color)
if Slice1 == 1:
Slice1Color = ColorChoices[1]
S1.append(Slice1Color)
if Slice2 == 0:
Slice2Color = ColorChoices[2]
S2.append(Slice2Color)
if Slice2 == 1:
Slice2Color = ColorChoices[3]
S2.append(Slice2Color)
if Slice3 == 0:
Slice3Color = ColorChoices[4]
S3.append(Slice3Color)
if Slice3 == 1:
Slice3Color = ColorChoices[5]
S3.append(Slice3Color)
if Slice4 == 0:
Slice4Color = ColorChoices[6]
S4.append(Slice4Color)
if Slice4 == 1:
Slice4Color = ColorChoices[7]
S4.append(Slice4Color)