Hi,
Thanks for your reply. This is the code I currently have in my Begin Experiment tab of the first Routine
import random
Videos = ["Ethics_1sec_0-5_ped.mp4","Ethics_1sec_1-5_ped.mp4",
"Ethics_1sec_5-0_ped.mp4","Ethics_1sec_5-1_ped.mp4",
"Ethics_2sec_0-5_ped.mp4","Ethics_2sec_1-5_ped.mp4",
"Ethics_2sec_5-0_ped.mp4","Ethics_2sec_5-1_ped.mp4",
"Ethics_3sec_0-5_ped.mp4","Ethics_3sec_1-5_ped.mp4",
"Ethics_3sec_5-0_ped.mp4","Ethics_3sec_5-1_ped.mp4",
"NoPed_Catch1.mp4","NoPed_Catch2.mp4","NoPed_Catch3.mp4",
"NoPed_Catch4.mp4"]
random.shuffle(Videos)
pairlist = [("D","D","z"), ("T","T","z"), ("G","G","z"), ("I","I","z"),
("E","E","z"), ("J","J","z"), ("F","F","z"), ("P","P","z"),
("Y","K","slash"), ("B","T","slash"), ("U","N","slash"), ("Z","K","slash"),
("K","V","slash"), ("N","F","slash"), ("V","L","slash"), ("O","S","slash")]
random.shuffle(pairlist)
firststim = []
secondstim = []
corrAns = []
for i in pairlist:
firststim.append(i[0])
secondstim.append(i[1])
corrAns.append(i[2])
The Code Type is set to ‘Auto->JS’. I need the videos and pairlists to be randomly selected for each trial. There are 16 trials in total (each video and pairlist randomly appears once in the experiment).
Could you please guide me with changing it appropriately because it works fine offline but doesn’t load online?
From the Console, it throws line 102 as an error:
Uncaught SyntaxError: Unexpected token ‘*’
I have the following on line 102 of my .js file: import * as random from 'random';
The * seems to have been added when converting from Python to JavaScript.