URL of experiment: https://pavlovia.org/nicolabinetti/triadcomparisonweb
I’m struggling to understand the .next() command on PsychoJs.
I’m loading an excell file and grabbing a random row on each trial
On Python it works as follows:
when I initialise, I load my conditions and hand them over to the trialHandler
trialList=data.importConditions(‘TripletList - Copy.xlsx’)
trials = data.TrialHandler(trialList,1, method=‘random’,
dataTypes=None, extraInfo=None, seed=None, originPath=None,
autoLog=True)
On each trial I grab the values associated with my 4 variables (s1-3, emotion) in the new trial (randomly selected)
thisTrial = trials.next()
emotion=thisTrial[‘emotion’]
s1=thisTrial[‘s1’]
s2=thisTrial[‘s2’]
s3=thisTrial[‘s3’]
this is how I’ve set this up in Js. I found mention of a NEXT instruction… but apparently I’m not using it correctly. This crashes because ‘thisTrial’ returns as ‘undefined’
trials = new TrialHandler({
psychoJS: psychoJS,
nReps: 1, method: TrialHandler.Method.RANDOM,
extraInfo: expInfo, originPath: undefined,
trialList: “TripletList - Copy.xlsx”,
seed: undefined, name: ‘trials’});
thisTrial = trials.NEXT
console.log(thisTrial)
emotion=thisTrial[‘emotion’]
s1=thisTrial[‘s1’]
s2=thisTrial[‘s2’]
s3=thisTrial[‘s3’]
Any suggestion how to get this to work in PsychoJs?
Thanks!