How to initialise trialist with an array of values instead of conditions file

I don’t want to use conditions file to insert the stimuli values for each trials. The reason behind this is the stimuli value are randomized at every trial.
Currently the only way I find is to mention an excel file in resources and mention it in “trialList” attribute of TrialHandler.js .
Is there a way I can do this without using conditions file and instead use array that is populated with values every time the experiment runs?
The has functions like _prepareTrialList but I am not sure how to use them from my javascript file.

Hi Sudeshna,

Do you create your experiment via the builder or by programming directly in JavaScript?

Best, Thomas

programming directly. Unfortunately I don’t have the psyexp file with me and only the python file and hence I am having to convert it directly.

That’s a challenging route Sudeshna! We designed PsychoJS to work with code generated by the PsychoPy builder, so we don’t have proper documentation on how to build a PsychoJS experiment from scratch. It might be a good idea to rebuild the experiment via Builder (or ask the researchers you got the JS from for the psyexp file).

I’ve got a demo on looping over an Array, but it’s made via Builder. You could take a look at the generated JS to see how it works there: