-
Hi, I have an experiment where a sentence can end either in a word or a picture. To present the word and picture I use different plugins as they require different responses (word: one button press to end trials, picture: type answer until trial duration runs out), so they have different timelines. These types of trials are randomized. I have added task: word/pic to the variable information. How can I add an if-statements that says if task = word then run word timeline, else run picture timeline. I have played with the conditional timelines and I see how that works based on a given response using jsPsych.data.get() to get the last response, but not how to use this at the start of a trial. Kind regards, Suzanne |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi Suzanne, If I'm understanding correctly you've got a timeline variable that specifies word or pic. You can access timeline variables in the var word_timeline = {
timeline: [word_trial],
conditional_function: function(){
if(jsPsych.timelineVariable('word_or_pic', true) == 'word') {
return true;
} else {
return false;
}
}
}
var pic_timeline = {
timeline: [pic_trial],
conditional_function: function(){
if(jsPsych.timelineVariable('word_or_pic', true) == 'pic') {
return true;
} else {
return false;
}
}
}
var word_or_pic = {
timeline: [word_timeline, pic_timeline],
timeline_variables: [
{word_or_pic: 'word'},
{word_or_pic: 'pic'}
]
} |
Beta Was this translation helpful? Give feedback.
Hi Suzanne,
If I'm understanding correctly you've got a timeline variable that specifies word or pic. You can access timeline variables in the
conditional_function
of a timeline. So something like this should work: