| Reference | Downloads | Github

Import stimuli with javascripts

URL of experiment:

Description of the problem:

Could anyone help me with importing stimuli with javascripts? I can’t use the builder loop function due to the complexity of the following stimuli selection. I have found a very useful stream in the forum, who successfully imported stimuli (Variables empty in online script (looping over dictionaries) - #3 by aisa2).

I have wrote my javascript based on this helpful post, shown below:

csv_neutral = new TrialHandler({
    psychoJS: psychoJS,
    nReps: 1, method: TrialHandler.Method.SEQUENTIAL,
    extraInfo: expInfo, originPath: undefined,
    trialList: 'neutral.csv',
    seed: undefined, name: 'csv_neutral'
neutralList = csv_neutral.trialList;

thisExp.addData("neutrallist_1", neutralList);

However, pavlovia gave me this error:

I really want to add this data to see what it looks like. After that my ulminate goal is to melt this ordered dictionary into a string (or dictionary) and shuffle it.

Any insight on the error? Or any suggestions about importing stimuli and get it into a string (or dictionary)? Thanks in advance!

Have a search for my crib sheet to see how to define thisExp in code_JS (either using PolyFill or explicitly)

Thank you so much for pointed out this. I found out I put my code_JS in the wrong order.