Howdy, Stranger!

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

Supported by

[solved] Recording multiple responses in one trial

edited August 2011 in OpenSesame
On GitHub, Trombonechamp points out that multiple responses in one trial will overwrite each other. This makes it problematic to record, for example, the duration that has elapsed between two key presses.

Proposed solution
Add a prefix or suffix to all response variables, so that responses from multiple items won't overwrite each other. For example, a keyboard_response item named "resp", would record responses as [response_resp]. This is in addition to the old [response] variable, which is kept for backward compatibility.

Current workaround
To solve this issue for now, an inline_script item is required that renames the variables after they have been collected. For example:
self.experiment.set("response_a", self.get("response")) self.experiment.set("response_time_a", self.get("response_time")) self.experiment.set("correct_a", self.get("correct"))

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


  • edited 5:52PM

    Added as a feature request on GitHub #28.

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

  • edited 5:52PM

    Hi Sebastiaan,
    How do you collect multiple responses using the Parallel Plugin? The above code does not seem to work using this method.
    Anthony McGuffie

  • edited 5:52PM

    Hi Anthony,

    The problem described in this post is that there used to be only a single response variable, which made it impossible to distinguish responses collected in multiple response items. For example when you had two keyboard_response items in a trial sequence. But the solution proposed above has been implemented already way back. (The post is from 2011.) See also:

    But this is unrelated to the parallel plug-in. Could you describe in more detail what you're trying to do, and what problems you run into?


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

  • edited 5:52PM

    Hi Sebastiaan,

    I am trying to create an Implicit Memory task that I have previously used in E-Prime.

    It is a dual task where participants are shown a word for 0-2000ms and at the same time (0-1000ms) there is a 3 digit number (num1) displayed above. At 1000ms-2000ms a second 3 digit number is displayed (num2) and (num1) disappears.

    The user responds with an 'x' if the word is living and also an 'm' if num1 and/or num2 is an odd number.

    This means there is a possible number of 3 individual responses within the 2000ms stimulus presentation. I have created 2 sketchpads (stim1) and (stim2) each duration being 1000ms and used the Parallel Plugin to record the responses.

    The problem I have is when using the Parallel Plugin, where to insert the inline code following the keyboard_response to collect all 3 responses. Has this method been tried in the past?

    I have supplied a link for you to get an idea of what i am trying to achieve.


    Anthony McGuffie

  • edited November 2014

    Hi Anthony,

    Right, I see. So if I understand correctly, you want to show three sketchpads (num1, num2, and blank) and collect three responses at the same time. Is that correct?

    You can do this by adding two sequences to your parallel item. The first sequence contains three keyboard_response item, thus collecting three responses. The second sequence contains three sketchpads for the stimulus presentation. Like so:


    So I don't think you will need any scripting at all for this. For a simple example, see this gist:


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

  • Hi Sebastiaan,
    I have been working on open sesame for making a time series experiment for Necker cube perceptual switches. So how can I collect more than 250 key press responses on every perceptual switch which showing the same Necker cube target for around 5-6 minutes as a free viewing task. considering the fact that target should remain consistently in the screen without creating any visible changes.


  • Hi Shradha,

    There are two ways:

    1) A little crude, but you can make a simple loop with a sketchpad (for the cube with a duration of 0), a keyboard_response (duration keypress) and a logger. The trick is to set the number of repetitions of the loop to a very high value, so that it basically runs forever (sort of). Additionally, you check in the loop how much time has passed since you entered it, and break it as soon as 5-6 minutes have passed.

    2) Move everything into an inline_script. Something like that:

    cv = canvas()
    kb = keyboard()
    path = exp.pool[u'image_in_pool.png']
    block_dur = 300000 # 5 minutes
    t0 =
    while clock.time-t0<block_dur:
        var.response,var.response_time = kb_get_key()

    Quite simple, you see?

    Good lcuk,


Sign In or Register to comment.