Replies: 1 comment
-
Update: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey there,
I am using jspsych for the first time and I am about to start an experiment on cognition.run next month. Therefore, I need to assign participants to four different conditions using a 2x2 design. There will be two different instructions (one for condition 1 and 2, and the second one for condition 3 and 4) and I tried to include this in my code, but there seems to be a mistake.
The assignment of participants to the four conditions works with the following coding:
var condition_assignment = jsPsych.randomization.sampleWithoutReplacement(['LIST1', 'LIST2', 'LIST3', 'LIST4'], 1)[0];
jsPsych.data.addProperties({
condition: condition_assignment
});
Afterwards, I created the two different instructions:
var instruction1 = {
type: 'instructions',
pages: ['
Here I used the first instruction
'],
show_clickable_nav: 'true',
button_label_previous: 'Zurück',
button_label_next: 'Weiter',
post_trial_gap: 1000
};
var instruction2 = {
type: 'instructions',
pages: ['
And here the second one
'],
show_clickable_nav: 'true',
button_label_previous: 'Zurück',
button_label_next: 'Weiter',
post_trial_gap: 1000
};
To finalize the randomization, I followed a solution that I found here on GitHub, but it does not work in my case:
var list_1 = [{stimulus: 'instruction1'}];
var list_2 = [{stimulus: 'instruction2'}];
var stimuli;
if (condition_assignment == "LIST1") {
stimuli = list_1;
} else if (condition_assignment == "LIST2") {
stimuli = list_1;
} else if (condition_assignment == "LIST3") {
stimuli = list_2;
} else if (condition_assignment == "LIST4") {
stimuli = list_2;
}
var instructions_rdk2 = {
type: 'html-keyboard-response',
stimulus: jsPsych.timelineVariable('stimulus')
};
var trial_procedure = {
timeline: [instructions_rdk2],
timeline_variables: stimuli
}
timeline.push(trial_procedure)
When assigning to List 1, there is just 'instruction1', so the variable name on the screen but not the instruction itself. For the other 3 lists, it does not work at all.
I might have done something stupid, this is my first time coding. So if someone has an idea or if you need further information, I would be very glad for an answer.
Thank you so much!
Larissa
Beta Was this translation helpful? Give feedback.
All reactions