psychopy.org | Reference | Downloads | Github

Loading textiles in PsychoJS

URL of experiment: https://run.pavlovia.org/MJB/fapesp_libet_nosound/html/

In this experiment I have 3 different instructions for 3 different blocks.
In the Builder version, I have a code component at the start of the experiment that loads in the 3 text files and assigns the content to variables. The content of the instructions text component is set on repeat in the trial loop.

When loading to Pavlovia, this fails, and I suspect it is because the code below is not JS compliant,

baseline = open('Instructions/obs_base_ins.txt','r')
baselineIntro=baseline.read()
baseline.close()

How can I achieve the same in JS?

@Marc_Buehner, I would advise adding your text to an excel file, and reading the excel file as a conditions file, so the text import is handled for you. There are other ways of manually loading files, such as csv files, demonstrated here.

1 Like