[solved] Processing response data from inline script
Hi!
I was wondering if there is a way to process a given (keyboard) response in inline_script. The documentation provides the following code example:
from openexp.keyboard import keyboard
my_keyboard = keyboard(exp, keylist=['z', 'x'], timeout=3000)
start_time = self.time()
key, end_time = my_keyboard.get_key()
self.experiment.set('response', key)
self.experiment.set('response_time', end_time - start_time)
However, will only the response and response_time variables be registered this way, or will OpenSesame automatically parse this information further and for instance compare it to the [correct_response] variable to derive the value of [correct]? In other words, do I need to set the values of [acc],[correct], etc. myself when registering responses from script.
In short, I think my question is, what code do I need to put in my script to exactly mimic the functionality of the keyboard_response item concerning the processing of response data?
Thanks for any help!


Comments
Hi Daniel,
The first: It simply sets the variables and does no further parsing.
Yep, you need to do all the bookkeeping manually, so to say. This is kind of a hassle, particularly if you want to maintain feedback variables, but for most purposes you can simply copy-paste the script shown here:
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Thanks, just what I needed!
I also figured this out by looking into the generic_response item, but good to know there is a doc page about this as well.