Howdy, Stranger!

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

Supported by

[solved] Run if... 50% of the time

edited July 2015 in OpenSesame

I want to play an error sound 50% of the time my participant answers incorrectly. Right now I have it playing when they answer incorrectly but do not know how to make it only 50% of the time. Is it possible to do this?

Comments

  • edited 8:47AM

    Hi,

    Sure. What you could do is first create a variable that indicates whether or not a sound should be played on an error. You could do this with a simple inline_script at the start of your trial:

    import random
    if random.random() < .5:
        exp.set('sound_on_error', 1)
    else:
        exp.set('sound_on_error', 0)
    

    Next, you can use a run-if statement for you sampler that evaluates whether a response was incorrect and the sound_on_error variable is 1. Like so:

    [correct] = 0 and [sound_on_error] = 1
    

    Does that make sense?

    Cheers,
    Sebastiaan

  • edited 8:47AM

    That's great. Thank you!

Sign In or Register to comment.