Howdy, Stranger!

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

Supported by

Keyboard Response is not updated and [correct] remains 0 all the time

Hello all,

I am new to opensesame, and have tried to make a basic block that shall play two audio files, and get input from the user if the two tunes played were same or different. I take in a keyboard response as 1 for same and 2 for different.
In my loop i have added, for each combination of the audio files, a corresponding "correct_response" value, as 1 or 2.

For feedback to the user if the choice for correct ot incorrect , i have used a feedback item tool and used "run-if" [correct] =0 for incorrect and [correct]=1 for correct.

Yet, the result shown is always incorrect. I tried to run the variable inspector to see where the issue might be, and find that [correct] variable is set to 0 while before the second audio is played, and remains the same for all the trials irrespective of the keyboard response given.

Please let me know my next course of action to solve this.

Thank you!


  • Hi,

    It seems the variable [correct] is not updated automatically. So basically, the comparison response == correct-response is not done.

    If you change your run-if statements to [response]=[correct_response] and [response]!=[correct_response], it should work.

    Good luck,


  • Thank You Eduard! Worked Perfect

  • edited August 2016

    Also, If i want a screen display when the time for keyboard_response overflows (beyond 12 seconds in my case) , what condition do i give in the run-if statement?

    [response] = [none]
    [correct] = [none] do not seem to work.

    If there is no key pressed also, the reply says it is incorrect, hence i wanted a screen that tells no response was detected.

    Thanks in advance!

  • Hi,

    Did you try using [response]= None, for when no response was given?

    Additionally, you can change the condition of a false response to:

    [response]!=[correct_response] and [response]!=None, to make sure that it is only shown if a wrong response was given and not when no response was given.

    Does this work?


  • I seem to have a similar problem. I am trying to give feedback depending on whether participants choose the up or down key. When I use a feedback item, [response] has the latest response, but with a inline script or sketchpad [response] contains the previous key press. Attached I have the script. Did I do something that caused the lag?

  • Hi Froukehe,

    Feedback items are prepared in the run phase, Sketchpads in the prepare phase and depending on where you put your code in an inline_script it can be either. The response variable is defined on run time, that means that whenever you present the feedback in the prepare phase it will use the response from the previous trial. Whenever you present feedback in the run phase, it will use the current response (provided that the response has already been given).

    Does that make sense?


Sign In or Register to comment.