I keep getting the error “Reference error: Can’t find variable: duration” when I try running my Psychopy experiment on Pavlovia, but it works fine offline. Unfortunately, I’m unfamiliar with JS and currently running into some problems regarding the improper translation from Python to JS.
firstly, I guess the problem is that “shuffle” is not a js function. To create a function to shuffle your array, you can have a look at this.
For example, you could copy-paste this code
function shuffle(array) {
var m = array.length, t, i;
// While there remain elements to shuffle…
while (m) {
// Pick a remaining element…
i = Math.floor(Math.random() * m--);
// And swap it with the current element.
t = array[m];
array[m] = array[i];
array[i] = t;
}
return array;
}
in front of your js code. Then, the experiment “knows” what shuffle is.
Second, I don’t know if [1,2] * 5 works as you expect in js. So you may also have to find a function to repeat an array. Maybe something like this