How to record multiple responses for a stimulus via "image-keyboard-response." #1302
-
Hi, experts. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
Hi @K104Kaz, yes I think you'll want to modify the plugin file to do this:
var keyboardListener = jsPsych.pluginAPI.getKeyboardResponse({
callback_function: after_response,
valid_responses: trial.choices,
rt_method: 'performance',
persist: true, // <- changed from false to true
allow_held_key: false
});
// store response
var response = {
rt: [], // <- changed from null to empty arrays, so that you can store multiple values
key: []
};
response.rt.push(info.rt); // <- these two lines instead of "if (response.key == null) {response = info;}"
response.key.push(info.key);
var trial_data = {
"rt": JSON.stringify(response.rt), // <- add JSON.stringify
"stimulus": trial.stimulus,
"key_press": JSON.stringify(response.key) // <- add JSON.stringify
}; I hope this helps! Feel free to ask questions here and post your code if you get stuck. |
Beta Was this translation helpful? Give feedback.
-
I wonder if I can do the same (record multiple keyboard responses) for 1 stimuli via "audio-keyboard-responses."? I was trying to modified the audio-keyboard-responses plugin codes in a similar fashion. But I was not able to fully keep track and understand a few things. Specifically, I don't quite understand the following: In the
Can you elaborate a bit what Would it be possible if you can walk me through the steps to modified the necessary part of the script to achieve my goal? Thanks! BTW, I am using the 7.2 version |
Beta Was this translation helpful? Give feedback.
-
Hi! I would like to make a similar alteration in my iat-html plugin. There is a function called 'force correct key response' when response.correct = false, so you have to press the right button in order to continue. In my case, I also want to record the second response time for pressing that button, so there are max. 2 values stored in the array. Any help would be appreciated! |
Beta Was this translation helpful? Give feedback.
-
Much like @xinyiguan , I am trying to modify "audio-keyboard-responses" to accommodate multiple keypresses and their respective rt's. This time, in v8.1.0. I was wondering what I would have to do differently, due to the difference in the way the responses object is structured, as well as the after_response function. Thanks! |
Beta Was this translation helpful? Give feedback.
Hi @K104Kaz, yes I think you'll want to modify the plugin file to do this:
jsPsych.pluginAPI.getKeyboardResponse
function, changepersist
fromfalse
totrue
(false
means that the keyboard listener should be cancelled after the first response).responses
object so that it stores arrays of rts and keys, instead of just one value for each: