Hi everyone!
I have been working on a task for few weeks so far and I got it working locally initially in builder just to see if it would work and now I have been trying to get it running online. After working out most other errors, I cannot get it to go through the second stage of my experiment where on some trials I have two image components display an image and other trials I have one image component display an image. I am currently setting the second image component to be empty and setting autodraw to false but when I run it, it fails immediately because it tries to display the image for the component when it should not.
This is the code that it fails on:
var _pj;
function _pj_snippets(container) {
function in_es6(left, right) {
if (((right instanceof Array) || ((typeof right) === "string"))) {
return (right.indexOf(left) > (- 1));
} else {
if (((right instanceof Map) || (right instanceof Set) || (right instanceof WeakMap) || (right instanceof WeakSet))) {
return right.has(left);
} else {
return (left in right);
}
}
}
container["in_es6"] = in_es6;
return container;
}
_pj = {};
_pj_snippets(_pj);
if (tstage === 2) {
console.log("here two");
totalp = 0;
totaln = 0;
impos = 0;
console.log("total p:", totalp, "total n:", totaln, "impos:", impos);
console.log("stage:", tstage, "TrialNumber:", trial_number_block, "trial_stage1:", trial_stage1, "trialnumall:", trialnum_all);
item2 = stage2_images[stim_order[trial_number_block]];
if (_pj.in_es6(",", item2)) {
console.log("item2",item2)
impos = 0.1;
images = item2.split(",");
console.log(images)
console.log("stim_present",stim_present)
console.log("stim_present2",stim_present2)
stimulus_presentation3.setAutoDraw(true);
stimulus_presentation4.setAutoDraw(true);
stim_present = images[0];
stim_present2 = images[1];
impos = 0;
} else {
twostim = false;
impos = 0;
console.log(impos);
stim_present = item2;
stim_present2 = "";
console.log("stim_present",stim_present)
console.log("stim_present2",stim_present2)
stimulus_presentation3.setAutoDraw(true);
stimulus_presentation4.setAutoDraw(false);
}
trial_number_block += 1;
trialnum_all += 1;
trial_stage2 += 1;
console.log("stage:", tstage, "TrialNumber:", trial_number_block, "trial_stage2:", trial_stage2, "trialnumall:", trialnum_all, "stim_present:", stim_present, "stim_present2:", stim_present2);
if (((trial_number_block >= 7) && (trial_stage2 < 42))) {
trial_number_block = 0;
shuffle(stim_order);
} else {
if ((trial_stage2 >= 42)) {
trial_number_block = 0;
tstage += 1;
numreps = 42;
}
}
}
I get this error:
Unfortunately we encountered the following error:
- when setting the image of ImageStim: stimulus_presentation4
- when getting the value of resource:
- unknown resource
Try to run the experiment again. If the error persists, contact the experiment designer.
I am not sure how else to go about this to fix it. Any help or recommendations would be greatly appreciated!