Description of the problem:
if the participant gets the object correct in the routine ‘trial’ then the object appears with green around it in the ‘feedback’ routine. if not, then red.
I tried to do this by creating a polygon in the same size and place and then setting the line width and colour to be conditional in code. So far so good (and works fine in psychopy).
the problem is that online only the polygon is visible in the feedback routine.
i’ve tried a bunch of stuff relating to setAutoDraw based on @wakecarter 's recent discussions but nothing seems to be drawing the images (list of 20 from conditions file) - all of the setAutoDraw stuff i’m seeing seems to be relating to polygons.
the polygon in the feedback is a new polygon only for that routine aimed to be the exact same size and location as my images but that the outlines will poke out because they are much thicker.
In the begin experiment:
correct = false;
white = new util.Color([1, 1, 1]);
black = new util.Color([-1, -1, -1]);
LawnGreen = new util.Color([-0.0274509803921569, 0.976470588235294, -1]);
green = new util.Color([-1, 0, -1]);
red = new util.Color([1, -1, -1]);
and in the every frame
if ((correct === true)) {
polygon_6.setLineColor(LawnGreen);
} else {
if ((correct === false)) {
polygon_6.setLineColor(red);
}
}
so just to clarify (1) i want the image to be displayed on top of the polygon so that the outline of the polygon will show.
note: I tried just giving the images an outline but couldn’t get that going either.
I tried defining the image in a begin experiment code tab, and got pretty close (it would flicker for what appeared to be one frame).
I haven’t tried to define the polygon in a begin experiment code component because I figured it was already displaying and I wanted it to be at the back?
no the image does not appear when I change the polygon location (odd since the images work fine before I created polygon_6, I assumed it was just in the background)
define which object? the image and/or the polygon?
this leaves me the following questions:
(1) is it a problem that the image and polygon have been created using builder, do I need to delete them?
(2) when trying to define an image using code how do you set the time and duration the way the builder usually does?
I think that Builder components are effectively defined in Begin Experiment.
You can still use setAutoDraw false and true to rearrange the order of display. Try just setting AutoDraw to true for the image you’ve redrawn the polygon
ok so i’ve left the builder to define the objects (polygon_6 and obs2) and I tried the following code both in both the every frame and in the begin routine:
if ((correct === true)) {
polygon_6.setLineColor(LawnGreen);
} else {
if ((correct === false)) {
polygon_6.setLineColor(red);
}
}
obs2.setAutoDraw(true);
console.log(obs.setAutoDraw());
I agree the strategy you are suggesting makes sense, but the specifics of what I need to do aren’t getting across.
I’m just learning to do this too. My next suggestion would be to set obs2.setAutoDraw(false); immediately followed by obs2.setAutoDraw(true); I.e. turn it off and on again. It might be that the true command gets ignored if the status is already true