-
The solutions provided in discussion #843 work perfectly! However, after the last workshop I adjusted my code slightly and there is one minor thing to solve before the code is doing what I want it to do. I created a .js file containing all the items:
And call that in the code of the actual experiment:
This all works fine. But, here is the issue. As you could see, for trial 2, the target will be the second picture rather than the first (pseudo-randomized). I tried to determine the position of the pictures in the .js file, but then realized that the pictures are presented in the way they are specified after 'choices'. In other words, as of now, the target picture is always the first picture – which is obviously not what I want. I'm wondering how I could work around this while still keeping a similar structure (i.e., having the external .js file with all the stimuli)? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
One way to do this would be to turn the choices: function(){
// make an array with the foils
var foils = [
jsPsych.timelineVariable('Foil1', true),
jsPsych.timelineVariable('Foil2', true),
jsPsych.timelineVariable('Foil3', true)
];
// shuffle the order of the foils
var foils_in_random_order = jsPsych.randomization.shuffle(foils);
// add target in proper location
foils_in_random_order.splice(jsPsych.timelineVariable('button', true), 0, jsPsych.timelineVariable('Target', true));
// return back the full array
return foils_in_random_order;
} |
Beta Was this translation helpful? Give feedback.
-
@jodeleeuw I have one more follow-up question about this. In one of the feedback conditions (the no feedback condition) participants will always hear the auditory stimulus twice – regardless of their response. I thought I could just set the probability to 1.00 and return is always true. This all works. However, this time all foils stay on the screen as well. The problem now is that we randomize the foils using the code provided above, but if we run the feedback variable, the foils will be randomized again (so the display is not exactly the same). Is there a way to get the same randomization for 'choices' as the target trial (so target and feedback trial are exactly the same, but no response is needed for feedback trial)?
Thank you! |
Beta Was this translation helpful? Give feedback.
One way to do this would be to turn the
choices
parameter into a function that can compute where the target should be placed.