Description of the problem:
My conditional colour change works exactly as I want it to locally (see code screen shot below). When the error is under a certain value the feedback (net_shape_feedback) turns green.
When I commit the changes online the colour change does not happen?
Is my code incorrect for javascript (see screen shot and typed code) or do I need to draw a new polygon in the code component rather than relying on the polygon I created in builder?
net_posx = 0;
net_posy = 0; //for defining the builder component position at the start then code takes over
white = new util.Color([1, 1, 1]);
green = new util.Color([-1, 0, -1]);
net_shape_feedback = new visual.Polygon({"win": psychoJS.window, "name": "target", "fillColor": white, "lineColor": white, "edges": 36, "pos": [0, 0.1], "size": (10,100)});
What I am unsure about is whether creating an entirely new polygon with different name to the builder component (but with the same size and position) is a good idea- could that work? At the moment I have the builder component (net_shape_feedback) and a polygon of the same name in the code so I think I am confusing javascript with it.
That almost works now. The colour change according to the if statement is still having no effect.
Can javascript execute if statements according to variables created during the experiment- ‘rmdiff’ in my case. Is there a particular way to do it considering that python executes line by line where javascript does not.
Using the variable feedback_color in my code made it work. Thanks for all of your help!
For anyone who is interested:
In begin experiment I added feedback_color = green (making sure to use new color util as above/in crib sheet to define green).
I set my builder component fill color to feedback_color (variable name) and selected set every frame.
Then in each frame of my code component I used the if statement as above that was produced using autotranslate