URL of experiment:
Description of the problem: I am trying to collect mouse click responses online for text options in MCQs. Since I noted that text is not clickable online, I used this suggested approach of creating a transparent shape for each text answer. However, I am randomizing the position of the text on-screen using a JS code insert found here:
function shuffle(a) {
var j, x, i;
for (i = a.length - 1; i > 0; i–) {
j = Math.floor(Math.random() * (i + 1));
x = a[i];
a[i] = a[j];
a[j] = x;
}
return a;
}positions = [[0, 0.06], [0, 0], [0, (- 0.06)], [0, (- 0.12)], [0, (- 0.18)]];
shuffle(positions);
and then positions.pos() in the Location box for each text item. This works well for the text stimuli, both online and locally. But when I try to match this randomization to the transparent shapes (so e.g. if Answer1 appears in Position3 then Shape1 should also appear in Position3) by setting Location for each shape with positions.pos() too, I get an error on Pavlovia 'Cannot read property 0 of ‘undefined’ . When I manually set the location as constant for each shape the experiment runs/looks fine online, but there is a mismatch between the logged answer and the actual text. Also I tried creating two sets of ‘positions’ variable that contain the same data, and use the first for the text and the second for the shapes, but I got the same error. Is there any way to match the randomization of these two sets of items? Thank you!