-
Hello all, Thanks so much for participating in this forum! I'm new to jsPsych and feel like I'm missing something simple here. I have an rdk trial followed by a forced direction choice trial, where the subject either presses the right or left arrow to indicate the coherent direction of the dots. The correct keyboard response is stored using the timeline variable
I am trying to label the responses as correct or incorrect, but right_or_wrong always evaluates to false because the value of correct_answer is "function () { return timeline.timelineVariable(varname); }" when I look at it in the console. direction_pressed seems to work correctly. Is there something I'm missing in evaluating correct_answer? Thanks so much for the help! (I apologize for the confusing variable names!) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @wsr017, When you use correct_answer = jsPsych.timelineVariable('correct_key', true); The docs describe why here: https://www.jspsych.org/overview/timeline/#timeline-variables. This is a common mistake that we're thinking about how to make more intuitive! (see #788) |
Beta Was this translation helpful? Give feedback.
Hi @wsr017,
When you use
jsPsych.timelineVariable()
inside a function you have to set the second parameter totrue
.The docs describe why here: https://www.jspsych.org/overview/timeline/#timeline-variables. This is a common mistake that we're thinking about how to make more intuitive! (see #788)