Hi all,
I’ve been trying to put one of my experiments online and have been running into quite a few issues. It’s a relatively simple experiment where two pictures are presented at the same time and then the participant is asked to make a rating on the similarity of the pictures. This is embedded in a loop to display different pictures each time.
I have been able to debug some of the issues, but two major problems remain:
-
First of all the OK button on the start up screen to enter participant info is greyed out. I know that other people have been running into the same issues and have posted into that thread as well. I have skipped this issue by manually editing out the chunk that disables the button (although I don’t understand what it is caused by) and have been able to move on to the experiment in this way.
-
After displaying the instructions, instead of displaying the stimuli, it just skips to the end of the experiment and displays the “thank you” message. This is the error message it displays:
script.js:1146 Uncaught ReferenceError: trials_2 is not defined
at psychoJS.Scheduler.trials_2LoopEnd [as currentTask] (script.js:1146)
at psychoJS.Scheduler.run (scheduler.js:106)
at psychoJS.Scheduler.run (scheduler.js:109)
at update (scheduler.js:145)
It doesn’t seem to be able to find the conditions file that is in the loop and defined by the scheduler “trials_2”. However, I have made sure to redefine and double check that the scheduler is defined. Here is the code below:
function trials_2LoopBegin(thisScheduler) {
// set up handler to look after randomisation of conditions etc
try {
var trials_2 = new psychoJS.data.TrialHandler(
{
nReps:1,
method:‘random’,
extraInfo:expInfo,
originPath:undefined,
trialList:psychoJS.data.importConditions(‘Color_Behavioral.xlsx’),
seed:undefined,
name:‘trials_2’}
);
thisExp.addLoop(trials_2); // add the loop to the experiment
thisTrial_2 = trials_2.trialList[trials_2.trialSequence[0]]; // so we can initialise stimuli with some values
// abbreviate parameter names if possible (e.g. rgb=thisTrial_2.rgb)
abbrevNames(thisTrial_2);
// Schedule each of the trials in the list to occur
for (var i = 0; i < trials_2.trialSequence.length; ++i) {
thisTrial_2 = trials_2.trialList[trials_2.trialSequence[i]];
thisScheduler.add(abbrevNames(thisTrial_2));
thisScheduler.add(FixTimingRoutineBegin);
thisScheduler.add(FixTimingRoutineEachFrame);
thisScheduler.add(FixTimingRoutineEnd);
thisScheduler.add(StimuliRoutineBegin);
thisScheduler.add(StimuliRoutineEachFrame);
thisScheduler.add(StimuliRoutineEnd);
thisScheduler.add(JitterRoutineBegin);
thisScheduler.add(JitterRoutineEachFrame);
thisScheduler.add(JitterRoutineEnd);
thisScheduler.add(recordLoopIteration(trials_2));
}
} catch (exception) {
console.log(exception);
}
return psychoJS.NEXT;
}
function trials_2LoopEnd(thisScheduler) {
var trials_2 = thisScheduler;
// get names of stimulus parameters
if (psychoJS.isEmpty(trials_2.trialList)) { // XXX equiv of : in ([], [None], None)
params = [];
}
else {
params = Object.keys(trials_2.trialList[0]);
}
// save data for this loop
thisExp.loopEnded(trials_2);
return psychoJS.NEXT;
}
I’m not very fluent in JS at all, so any help with fixing these bugs would be highly appreciated!
Thanks!
Leyla