Experiment does not advance past initialising

URL of the experiment: https://run.pavlovia.org/arkadiym/oddball_test89/html

Description of the problem: I went through several aspects that could have gone wrong in javascript, but I am unable to locate the issue. Wondering if anyone else can see an issues with this. It does work in a builder but not online.

Do you have any imports?

Best wishes,

Wakefield

I took a look at this…no imports in javacode

Same issue, and with multiple experiments. If you’re using soundfiles, Pavlovia does not yet work with that unfortunately. If you’re using custom Python codes, can you post them in this thread? We can take a look at it.

One thing I did which solved one of my problems was delete one of my codes which directed the participant to a survey. Pavlovia didn’t like that.

See also my thread here and have a look at kdoelling’s answer.

Thanks @Elise - no soundfiles or surveys on my end, but I will post the code below.

Some aspect of the code that I think might be problematic, but not sure:

Python, begin experiment:

`import random

ISI_Num = [0.41455211, 0.71802275, 0.32057255, 0.67399222, 0.7005724]
       
# Square Colors
Square_colors= [(0.2980392156862745, 0.4470588235294118, 0.6901960784313725),
 (0.8666666666666667, 0.5176470588235295, 0.3215686274509804),
 (0.3333333333333333, 0.6588235294117647, 0.40784313725490196),
 (0.7686274509803922, 0.3058823529411765, 0.3215686274509804),
 (0.5058823529411764, 0.4470588235294118, 0.7019607843137254),
 (0.5764705882352941, 0.47058823529411764, 0.3764705882352941),
 (0.8549019607843137, 0.5450980392156862, 0.7647058823529411),
 (0.5490196078431373, 0.5490196078431373, 0.5490196078431373),
 (0.8, 0.7254901960784313, 0.4549019607843137),
 (0.39215686274509803, 0.7098039215686275, 0.803921568627451)]

Square_Sizes= [(200.0,100.0),
(207.5,107.5),
(215.0,115.0),
(222.5,122.5),
(230.0,130.0),
(237.5,137.5),
(245.0,145.0),
(252.5,152.5),
(260.0,160.0),
(267.5,167.5),
(275.0,175.0),
(282.5,182.5),
(290.0,190.0),
(297.5,197.5),
(305.0,205.0),
(312.5,212.5),
(320.0,220.0),
(327.5,227.5),
(335.0,235.0),
(342.5,242.5),
(350.0,250.0),
(357.5,257.5),
(365.0,265.0),
(372.5,272.5),
(380.0,280.0),
(387.5,287.5),
(395.0,295.0),
(402.5,302.5),
(410.0,310.0),
(417.5,317.5),
(425.0,325.0),
(432.5,332.5),
(440.0,340.0),
(447.5,347.5),
(455.0,355.0),
(462.5,362.5),
(470.0,370.0),
(477.5,377.5),
(485.0,385.0),
(492.5,392.5),
(500.0,400.0)]

# Lists of Pictures

Pos = ["Pos/53Pos1.jpg",
"Pos/3Pos1.jpg",
"Pos/4Pos1.jpg",
"Pos/8Pos1.jpg",
"Pos/16Pos1.jpg",
"Pos/25Pos1.jpg",
"Pos/30Pos1.jpg",
"Pos/33Pos1.jpg",
"Pos/35Pos1.jpg",
"Pos/45Pos1.jpg",
"Pos/46Pos1.jpg",
"Pos/52Pos1.jpg",
"Pos/54Pos1.jpg",
"Pos/56Pos1.jpg",
"Pos/57Pos1.jpg",
"Pos/60Pos1.jpg",
"Pos/61Pos1.jpg",
"Pos/71Pos1.jpg",
"Pos/73Pos1.jpg",
"Pos/75Pos1.jpg",
"Pos/77Pos1.jpg",
"Pos/78Pos1.jpg",
"Pos/84Pos1.jpg",
"Pos/85Pos1.jpg",
"Pos/86Pos1.jpg",
"Pos/87Pos1.jpg",
"Pos/89Pos1.jpg",
"Pos/91Pos1.jpg",
"Pos/95Pos1.jpg",
"Pos/96Pos1.jpg",
"Pos/100Pos1.jpg",
"Pos/101Pos1.jpg",
"Pos/104Pos1.jpg",
"Pos/107Pos1.jpg",
"Pos/112Pos1.jpg",
"Pos/113Pos1.jpg",
"Pos/129Pos1.jpg",
"Pos/136Pos1.jpg",
"Pos/161Pos1.jpg",
"Pos/162Pos1.jpg"]

Neg = ["Neg/47Neg1.jpg",
"Neg/1Neg1.jpg",
"Neg/2Neg1.jpg",
"Neg/3Neg1.jpg",
"Neg/4Neg1.jpg",
"Neg/5Neg1.jpg",
"Neg/6Neg1.jpg",
"Neg/7Neg1.jpg",
"Neg/8Neg1.jpg",
"Neg/14Neg1.jpg",
"Neg/15Neg1.jpg",
"Neg/16Neg1.jpg",
"Neg/17Neg1.jpg",
"Neg/28Neg1.jpg",
"Neg/42Neg1.jpg",
"Neg/44Neg1.jpg",
"Neg/48Neg1.jpg",
"Neg/49Neg1.jpg",
"Neg/50Neg1.jpg",
"Neg/51Neg1.jpg",
"Neg/61Neg1.jpg",
"Neg/71Neg1.jpg",
"Neg/73Neg1.jpg",
"Neg/74Neg1.jpg",
"Neg/80Neg1.jpg",
"Neg/94Neg1.jpg",
"Neg/106Neg1.jpg",
"Neg/111Neg1.jpg",
"Neg/119Neg1.jpg",
"Neg/123Neg1.jpg",
"Neg/126Neg1.jpg",
"Neg/133Neg1.jpg",
"Neg/135Neg1.jpg",
"Neg/136Neg1.jpg",
"Neg/143Neg1.jpg",
"Neg/144Neg1.jpg",
"Neg/145Neg1.jpg",
"Neg/146Neg1.jpg",
"Neg/148Neg1.jpg",
"Neg/151Neg1.jpg"]

Neut = ["Neut/19Neut1.jpg",
"Neut/3Neut1.jpg",
"Neut/4Neut1.jpg",
"Neut/6Neut1.jpg",
"Neut/7Neut1.jpg",
"Neut/8Neut1.jpg",
"Neut/9Neut1.jpg",
"Neut/10Neut1.jpg",
"Neut/11Neut1.jpg",
"Neut/12Neut1.jpg",
"Neut/13Neut1.jpg",
"Neut/14Neut1.jpg",
"Neut/15Neut1.jpg",
"Neut/16Neut1.jpg",
"Neut/20Neut1.jpg",
"Neut/21Neut1.jpg",
"Neut/25Neut1.jpg",
"Neut/29Neut1.jpg",
"Neut/30Neut1.jpg",
"Neut/35Neut1.jpg",
"Neut/36Neut1.jpg",
"Neut/37Neut1.jpg",
"Neut/39Neut1.jpg",
"Neut/42Neut1.jpg",
"Neut/43Neut1.jpg",
"Neut/44Neut1.jpg",
"Neut/45Neut1.jpg",
"Neut/46Neut1.jpg",
"Neut/48Neut1.jpg",
"Neut/49Neut1.jpg",
"Neut/50Neut1.jpg",
"Neut/51Neut1.jpg",
"Neut/52Neut1.jpg",
"Neut/53Neut1.jpg",
"Neut/55Neut1.jpg",
"Neut/56Neut1.jpg",
"Neut/57Neut1.jpg",
"Neut/58Neut1.jpg",
"Neut/59Neut1.jpg",
"Neut/60Neut1.jpg"]


# Shuffle each list
random.shuffle(Pos)
random.shuffle(Neg)
random.shuffle(Neut)

# Pass lists to dictionaries
Pos_Dict = {'Pic': Pos}
Neut_Dict = {'Pic': Neut}
Neg_Dict = {'Pic': Neg}

# Create a list of dictionaries for Valence Pics
conds = []
conds.append(Pos_Dict)
conds.append(Neut_Dict)
conds.append(Neg_Dict)
`

Java version of the above:



> ```
> ISI_Num = [0.41455211, 0.71802275, 0.32057255, 0.67399222, 0.7005724,
>        0.61799867, 0.37266446, 0.45349066, 0.53348465, 0.86651267,
>        0.92912745, 0.6854391, 0.66260785, 0.48374059, 0.49757714,
>        0.40370622, 0.67323056, 0.66597594, 0.27612559, 0.52969735,
>        0.45831049, 0.47283632, 0.39225576, 0.33973218, 0.79007097]
> 
> 
> // create a function to shuffle a list
> 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;
> }
> 
> 
> //create a list
> x = [1,2,3,4,5,6,7,8] 
> 
> 
> shuffle(ISI_Num);
> Pos = ["Pos/53Pos1.jpg", "Pos/3Pos1.jpg", "Pos/4Pos1.jpg", "Pos/8Pos1.jpg", "Pos/16Pos1.jpg", "Pos/25Pos1.jpg", "Pos/30Pos1.jpg", "Pos/33Pos1.jpg", "Pos/35Pos1.jpg", "Pos/45Pos1.jpg", "Pos/46Pos1.jpg", "Pos/52Pos1.jpg", "Pos/54Pos1.jpg", "Pos/56Pos1.jpg", "Pos/57Pos1.jpg", "Pos/60Pos1.jpg", "Pos/61Pos1.jpg", "Pos/71Pos1.jpg", "Pos/73Pos1.jpg", "Pos/75Pos1.jpg", "Pos/77Pos1.jpg", "Pos/78Pos1.jpg", "Pos/84Pos1.jpg", "Pos/85Pos1.jpg", "Pos/86Pos1.jpg", "Pos/87Pos1.jpg", "Pos/89Pos1.jpg", "Pos/91Pos1.jpg", "Pos/95Pos1.jpg", "Pos/96Pos1.jpg", "Pos/100Pos1.jpg", "Pos/101Pos1.jpg", "Pos/104Pos1.jpg", "Pos/107Pos1.jpg", "Pos/112Pos1.jpg", "Pos/113Pos1.jpg", "Pos/129Pos1.jpg", "Pos/136Pos1.jpg", "Pos/161Pos1.jpg", "Pos/162Pos1.jpg"];
> Neg = ["Neg/47Neg1.jpg", "Neg/1Neg1.jpg", "Neg/2Neg1.jpg", "Neg/3Neg1.jpg", "Neg/4Neg1.jpg", "Neg/5Neg1.jpg", "Neg/6Neg1.jpg", "Neg/7Neg1.jpg", "Neg/8Neg1.jpg", "Neg/14Neg1.jpg", "Neg/15Neg1.jpg", "Neg/16Neg1.jpg", "Neg/17Neg1.jpg", "Neg/28Neg1.jpg", "Neg/42Neg1.jpg", "Neg/44Neg1.jpg", "Neg/48Neg1.jpg", "Neg/49Neg1.jpg", "Neg/50Neg1.jpg", "Neg/51Neg1.jpg", "Neg/61Neg1.jpg", "Neg/71Neg1.jpg", "Neg/73Neg1.jpg", "Neg/74Neg1.jpg", "Neg/80Neg1.jpg", "Neg/94Neg1.jpg", "Neg/106Neg1.jpg", "Neg/111Neg1.jpg", "Neg/119Neg1.jpg", "Neg/123Neg1.jpg", "Neg/126Neg1.jpg", "Neg/133Neg1.jpg", "Neg/135Neg1.jpg", "Neg/136Neg1.jpg", "Neg/143Neg1.jpg", "Neg/144Neg1.jpg", "Neg/145Neg1.jpg", "Neg/146Neg1.jpg", "Neg/148Neg1.jpg", "Neg/151Neg1.jpg"];
> Neut = ["Neut/19Neut1.jpg", "Neut/3Neut1.jpg", "Neut/4Neut1.jpg", "Neut/6Neut1.jpg", "Neut/7Neut1.jpg", "Neut/8Neut1.jpg", "Neut/9Neut1.jpg", "Neut/10Neut1.jpg", "Neut/11Neut1.jpg", "Neut/12Neut1.jpg", "Neut/13Neut1.jpg", "Neut/14Neut1.jpg", "Neut/15Neut1.jpg", "Neut/16Neut1.jpg", "Neut/20Neut1.jpg", "Neut/21Neut1.jpg", "Neut/25Neut1.jpg", "Neut/29Neut1.jpg", "Neut/30Neut1.jpg", "Neut/35Neut1.jpg", "Neut/36Neut1.jpg", "Neut/37Neut1.jpg", "Neut/39Neut1.jpg", "Neut/42Neut1.jpg", "Neut/43Neut1.jpg", "Neut/44Neut1.jpg", "Neut/45Neut1.jpg", "Neut/46Neut1.jpg", "Neut/48Neut1.jpg", "Neut/49Neut1.jpg", "Neut/50Neut1.jpg", "Neut/51Neut1.jpg", "Neut/52Neut1.jpg", "Neut/53Neut1.jpg", "Neut/55Neut1.jpg", "Neut/56Neut1.jpg", "Neut/57Neut1.jpg", "Neut/58Neut1.jpg", "Neut/59Neut1.jpg", "Neut/60Neut1.jpg"];
> Square_colors = [[0.2980392156862745, 0.4470588235294118, 0.6901960784313725], [0.8666666666666667, 0.5176470588235295, 0.3215686274509804], [0.3333333333333333, 0.6588235294117647, 0.40784313725490196], [0.7686274509803922, 0.3058823529411765, 0.3215686274509804], [0.5058823529411764, 0.4470588235294118, 0.7019607843137254], [0.5764705882352941, 0.47058823529411764, 0.3764705882352941], [0.8549019607843137, 0.5450980392156862, 0.7647058823529411], [0.5490196078431373, 0.5490196078431373, 0.5490196078431373], [0.8, 0.7254901960784313, 0.4549019607843137], [0.39215686274509803, 0.7098039215686275, 0.803921568627451]];
> Square_Sizes = [[200.0, 100.0], [207.5, 107.5], [215.0, 115.0], [222.5, 122.5], [230.0, 130.0], [237.5, 137.5], [245.0, 145.0], [252.5, 152.5], [260.0, 160.0], [267.5, 167.5], [275.0, 175.0], [282.5, 182.5], [290.0, 190.0], [297.5, 197.5], [305.0, 205.0], [312.5, 212.5], [320.0, 220.0], [327.5, 227.5], [335.0, 235.0], [342.5, 242.5], [350.0, 250.0], [357.5, 257.5], [365.0, 265.0], [372.5, 272.5], [380.0, 280.0], [387.5, 287.5], [395.0, 295.0], [402.5, 302.5], [410.0, 310.0], [417.5, 317.5], [425.0, 325.0], [432.5, 332.5], [440.0, 340.0], [447.5, 347.5], [455.0, 355.0], [462.5, 362.5], [470.0, 370.0], [477.5, 377.5], [485.0, 385.0], [492.5, 392.5], [500.0, 400.0]];
> 
> 
> shuffle(Square_colors);
> shuffle(Square_Sizes);
> shuffle(Pos);
> shuffle(Neg);
> shuffle(Neut);
> Pos_Dict = {"Pic": Pos};
> Neut_Dict = {"Pic": Neut};
> Neg_Dict = {"Pic": Neg};
> conds = [];
> conds.push(Pos_Dict);
> conds.push(Neut_Dict);
> conds.push(Neg_Dict);
> ```
> 
> ```
> 
> Begin routine, in java:
> 
> ```
> // create a function to shuffle a list
> 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;
> }
> 
> Max_Squares_1 = Math.floor(Math.random()*7)+1;
> Max_Squares_2 = ((10 - Max_Squares_1) - 1);
> Max_Squares_2 = Math.floor(Math.random()*(Max_Squares_2-1))+1;
> Total_Squares = (Max_Squares_1 + Max_Squares_2);
> Squares_3_Num = (10 - Total_Squares);
> shuffle(conds);
> ```
> ```

Are you defining shuffle twice?

Yes- that was intentional in order to circumvent scope of javascript.

However, I found the issue, an am reporting it below in case anyone else runs into this:

Incorrect javascript (due to automatic translation):

var _pj;
function _pj_snippets(container) {
    function in_es6(left, right) {
        if (((right instanceof Array) || ((typeof right) === "string"))) {
            return (right.indexOf(left) > (- 1));
        } else {
            if (((right instanceof Map) || (right instanceof Set) || (right instanceof WeakMap) || (right instanceof WeakSet))) {
                return right.has(left);
            } else {
                return (left in right);
            }
        }
    }
    container["in_es6"] = in_es6;
    return container;
}
_pj = {};
_pj_snippets(_pj);
if ((((((_pj.in_es6("left", Square_Prac_Resp_1.keys) && _pj.in_es6("left", Square_Prac_Resp_2.keys)) && _pj.in_es6("left", Square_Prac_Resp_3.keys)) && _pj.in_es6("right", Pic_Prac_Resp_1.keys)) && _pj.in_es6("right", Pic_Prac_Resp_2.keys)) && _pj.in_es6("right", Pic_Prac_Resp_3.keys))) {
    trials_12.finished = true;
}

Corrected javascript:

if (((Square_Prac_Resp_1.keys !== undefined) && (Square_Prac_Resp_2.keys !== undefined) && (Square_Prac_Resp_3.keys !== undefined) && (Pic_Prac_Resp_1.keys !== undefined) && (Pic_Prac_Resp_2.keys !== undefined) && (Pic_Prac_Resp_3.keys !== undefined) && (Square_Prac_Resp_1.keys === 'left') && (Square_Prac_Resp_2.keys === 'left') && (Square_Prac_Resp_3.keys === 'left') && (Pic_Prac_Resp_1.keys === 'right') && (Pic_Prac_Resp_2.keys === 'right') && (Pic_Prac_Resp_3.keys === 'right'))) {
    trials.finished = true;
}
1 Like