Multiple conditions within on_finish #1878
Unanswered
blueraindrops
asked this question in
Q&A
Replies: 1 comment
-
Looks to me like you might need to pass the relevant variables for comparison into the timeline node too. You do that using something like...
Hope this helps, Cai |
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.
-
Hi everyone, in my code, I have a feedback message after each trial where two choices (A and B) are displayed randomly left or right. You can press either the 'z' (left) or the 'm' (right) key to choose either option. In the feedback message, I want to display what was chosen by comparing the positions of the choices and the response key using
on_finish
.For example, if A was displayed left during the trial, and B was displayed right, this is what stimulus would say:
And vice versa if A and B switched positions. And then using on_finish:
I then use
jsPsych.data.get().last(1).values()[0].response
to display the feedback message. However, this is not working because I don't thinkjsPsych.pluginAPI.compareKeys
allows comparisons to a variable, only a defined string, even if the variable contains a string.I've also tried using multiple conditions within on_finish (for example,
if(jsPsych.pluginAPI.compareKeys(data.response, 'z') && a_position == 'left'
) but this doesn't seem to work either. Is there any way I can use on_finish to satisfy multiple conditions when displaying a feedback message? Thank you in advance!Beta Was this translation helpful? Give feedback.
All reactions