Hi! I have a very simple experiment, where the subject either sees blue and/or orange squares flashing at random locations on the screen, shown at a random interval for 200 ms, and has to report the number of blue and orange squares seen. The number of blue and orange squares are determined randomly, where each color square can appear 0 to 4 times. I do this by setting the opacity of each square to be either 0 or 1 randomly.
Description of the problem: However, when I run this through Pavlovia, the opacities don’t seem to be updated every trial, but only their random locations. I ran a pilot trial and downloaded the data file and it seems that the opacities are updating every trial (as shown below in blue_ans and orange_ans: see code below), but these number of blue/orange squares aren’t reflected in the actual screen online.
I created my shapes through the polygon component in builder:
Below is the custom code component where I define the opacities (e.g. b_1 in the screenshot above) and the random positions. Note: I’ve already defined my randint and shuffle function in JS at the start of my experiment.
//begin experiment tab //initial trial starts at 0 id_trial = 0;
//begin routine // random start of squares rand_start = randint(0, 4000) / 1000; // randomize positions of squares shuffle(x_pos); shuffle(y_pos); // random opacity for squares //had to do randint(0,2) so that it picks a random integer between 0 and 1. b_1 = randint(0, 2); b_2 = randint(0, 2); b_3 = randint(0, 2); b_4 = randint(0, 2); o_1 = randint(0, 2); o_2 = randint(0, 2); o_3 = randint(0, 2); o_4 = randint(0, 2); // store num of b and o squares seen num_blue = b_1 + b_2 + b_3 + b_4; num_orange = o_1 + o_2 + o_3 + o_4; thisExp.addData("blue_ans", num_blue); thisExp.addData("orange_ans", num_orange);
//end routine tab //increment the trial by 1 id_trial = (id_trial + 1);
Any help is greatly appreciated!!