Hi everyone,
I have an experiment where I randomize 2 condition files (instruction A and instruction B) using code component in the begin routine:
function random_character() {
var chars = “AB”;
return chars.substr( Math.floor(Math.random() * 2), 1);
}
condition = random_character();
In my trials I put something like:
$‘Instruction’ + condition + ‘.xlsx’
I also need to randomize a file with stimuli (Stimuli C and Stimuli D):
function random_character() {
var chars = “CD”;
return chars.substr( Math.floor(Math.random() * 2), 1);
}
conditionV = random_character();
In my trials I put something like:
$‘Stimuli’ + conditionV + ‘.xlsx’
I need to get four possible variations out of it:
Instruction A, Stimuli C
Instruction A, Stimuli D
Instruction B, Stimuli C
Instruction B, Stimuli D
However, Psychopy for some reason generates something like Stimuli A, is unable to find that file (because it does not exist) and manifests an error.
Any idea how to have two code elements which randomize two separate conditions?