Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[solved] Processing response data from inline script

edited December 2012 in OpenSesame

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:

<br /> from openexp.keyboard import keyboard<br /> my_keyboard = keyboard(exp, keylist=['z', 'x'], timeout=3000)<br /> start_time = self.time()<br /> key, end_time = my_keyboard.get_key()<br /> self.experiment.set('response', key)<br /> self.experiment.set('response_time', end_time - start_time)<br />

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

  • edited 12:52PM

    Hi Daniel,

    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]?

    The first: It simply sets the variables and does no further parsing.

    In other words, do I need to set the values of [acc],[correct], etc. myself when registering responses from script.

    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

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • edited 12:52PM

    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.

Sign In or Register to comment.