Passing an array to timeline_variables? #2938
-
Hello All! I am currently trying to resolve an issue where jsPsych is not recognizing the stimulus objects passed into the jsPsychVideoButtonResponse plugin. The stimulus parameter (screenshot below) has the jsPsych.timelineVariable calling 'stimulus', which is the name of the stimulus objects listed in an array that is passed to timeline_variables. Has anyone else encountered an issue passing an array to timeline_variables? I cannot pass individual file names directly to this variable because they are shuffled and subsetted into that list. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Hi @patrick10326, I think the problem is that So in your case it might look something like this: // define the video button response trial object, and insert timeline variables wherever needed
var video_trial = {
type: jsPsychVideoButtonResponse,
stimulus: jsPsych.timelineVariable('stimulus'),
choices: ['1','2','3','4'],
prompt: '<p>Which event sticks out the most?</p>',
response_allowed_while_playing: false,
response_ends_trial: true
};
// set up the timeline variables procedure, which includes the trial(s) to repeat and the timeline variables array
var block_1 = {
timeline: [video_trial],
timeline_variables: stimulus_list_1,
randomize_order: true
};
// add the procedure to your experiment timeline
experiment_timeline.push(block_1); BTW, another way to write this is to define the video trial directly inside the // set up the timeline variables procedure, which includes the trial(s) to repeat and the timeline variables array
var block_1 = {
timeline: [{
type: jsPsychVideoButtonResponse,
stimulus: jsPsych.timelineVariable('stimulus'),
choices: ['1','2','3','4'],
prompt: '<p>Which event sticks out the most?</p>',
response_allowed_while_playing: false,
response_ends_trial: true
}],
timeline_variables: stimulus_list_1,
randomize_order: true
};
// add the procedure to your experiment timeline
experiment_timeline.push(block_1); Can you let us know if that solves the problem for you? |
Beta Was this translation helpful? Give feedback.
-
@becky-gilbert I found the solution! I needed to place each stimulus file inside brackets in addition to having the entire array inside brackets as well. Thank you so much for all of this support! I'm grateful for your kindness! |
Beta Was this translation helpful? Give feedback.
@becky-gilbert I found the solution! I needed to place each stimulus file inside brackets in addition to having the entire array inside brackets as well. Thank you so much for all of this support! I'm grateful for your kindness!