Feedback border colour don't work correctly online

Hi. I am very new to psychopy, so I think that my problem is very easy to solve. I have a task where participant has to choose either one answer (e.g., take) or the other (e.g., leave) via mouse selection, what I would like to occur is a green or red polygon behind the image (as feedback) after his/her choice (if take, a green rectangle appear; if leave or do nothing, a red rectangle appear).
Locally I have no problems to run the experiment, but when I run it online only the red square appears (never green). I think the problem is the if statement that don’t work correctly with Javascript (I used the Auto->Js). I load the code that I am referring to.

border_colour is referring to the colour of the polygon

Thanks for your help!
Lorenzo

Have a look at my crib sheet for how to work with colours online in code components.

1 Like

Thank you @wakecarter for your reply, I have found very usefuel your crib sheet. I have update my code regarding your suggestion. However my problem still persist, only the red square appears and never the green one.


Why is your second component set to Both.

clicked_name might be looking for a string rather than a list. However, try printing the value to the developer console to see if that helps. I assume this code component is in the routine after the click itself.

Personally I tend to use mouse.isPressedIn(object) rather than clicked name.

Thank you @wakecarter ! After changing clickedname with mouse.isPressedIn (object), as you suggested, the experiment works fine!

1 Like