Replies: 2 comments 3 replies
-
Hi @limkhaiin , The parameters in var trial = {
timeline_variables: trial_parameters,
randomize_order: true,
timeline: [{
type: 'audio-button-response',
stimulus: jsPsych.timelineVariable('audio'),
choices: jsPsych.timelineVariable('images'),
button_html: '<img style="width:100px;" onmouseout="this.src=\'img/%choice%.png\'" src="img/%choice%.png" />',
margin_horizontal: "20px",
data: {
correct_response: jsPsych.timelineVariable('correct_response')
},
on_finish: function(data){
data.correct = jsPsych.pluginAPI.compareKeys(data.response,data.correct_response)}
}]
} |
Beta Was this translation helpful? Give feedback.
-
Hi @limkhaiin, Josh's answer should fix the problem, but I also wanted to note that the on_finish: function(data){
data.correct = data.response === data.correct_response;
} Lots of other people have been using the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
hello,
I tried to use this function to compare the response and correct response, but it always returns 'false' even though both numeric response are the same. I am using 'audio-button-response' and the data return 1 or 0. Here is my code:
In my trial_parameters, there are 'audio', 'images', 'correct_response' keys.
Thanks,
Beta Was this translation helpful? Give feedback.
All reactions