Howdy, Stranger!

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

Supported by

[solved] Self paced breaks as an inline script?

edited October 2012 in OpenSesame


First off, I would like to say I’m really happy with Opensesame. I have been using it for a couple of months and I really like it! So, thank you. I’m also working on learning python code to further improve on what I can do in Opensesame (I’m still very much a beginner, though). Now my question:
I’m designing a variation on a ‘delayed match to sample task’ and I need a lot of trials:
My design looks something like this at the moment:

>Practice loop
    Practice sequence
        Block loop (1 x 24 trials)
            Trial Sequence
>End of Practice
>Experimental loop
    Exp sequence
        Exp loop (50 x 24 trials)
            Trial Sequence

Of course, 50 times 24 trials is a lot of trials, taking a lot of time. I would like participants to have a self paced break after 72 trials, also providing feedback (average RT and ACC). Can I add an Inline script somewhere to achieve this? (If I add this inline script in the Trial sequence it will also be in the practice loop.)
I could probably make the ‘Exp loop’ (3 x 24 trials) and then repeat the ‘Experimental loop’ 17 times, but I want the 1200 trials to be completely random.
Your help with the best way to achieve this and the formulation of possible inline scripts is much appreciated!

Thank you very much in advance!


  • edited 9:04PM

    Hi Michel,

    Glad you like OpenSesame!

    Indeed, 1200 trials is a bit much. The easiest way to show feedback after 72 trials without subdividing your trials into multiple blocks is probably as follows:

    At the end of the trial_sequence, add a feedback item and (in the trial_sequence) set its Run if condition to:

    [show_feedback] = 1

    Just before the new feedback item, add an inline_script with the following code:

    block_length = 72
    if (self.get('count_trial_sequence')+1) % block_length == 0:
        exp.set('show_feedback', 1)
        exp.set('show_feedback', 0)

    This script determines based on the count_trial_sequence variable, which contains the number of times that the trial_sequence has been called, whether the show_feedback variable should be set to 0 or to 1.

    Another discussion that might come in handy is this one:

    More info about variables and conditional statements:

    Good luck and don't hesitate to ask questions!


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

  • edited 9:04PM

    Hi Sebastiaan,

    Thank you very much! It works like a charm. If I have any other questions in the future I'll be sure to ask!



  • edited 9:04PM


    For future reference, in 0.27 (currently as pre-release) you can implement this using only a Run if statement. The functionality that has been added is that you can now use Python statements directly in a Run if statement, by prepending an '=' sign:

    Run if:

    =[my Python statement]

    So in your case this would be something like:

    Run if:

    =(self.get('count_trial_sequence')+1)%72 == 0

    There's no real advantage of this method over the one using an inline_script, btw. It's just shorter.

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

  • Hi,

    unfortunately I'm a very beginner at Open Sesame and I have a similar problem to MichelQ above:
    When I set the Run if: statement of the feedback to
    =(self.get('count_trial_sequence')+1)%32 == 0 (I would like to have a break after 32 Items), opensesame counts the items of the trial sequence plus the items of the practice sequence, because the two are attached. But I just want opensesame to count the items of the trial sequence without the items of the practice sequence. How does this work? Could you help me?


  • Hi Karin,

    If you're using OpenSesame 3.1 or later, you can make use of the fact that each loop maintains a variable that indicates the row that is currently active. This variable is called live_row_[loop name].

    So say that you want exit block_loop after 3 trials, and resume where you left of the next time that block_loop is called, then you can do this as follows:

    • Break if: [live_row_block_loop] % 3 = 0
    • Evaluate on first cycle: no
    • Resume after break: yes

    So this allows you to cut up your blocks when they have very long tables.

    Does that clear things up?


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

  • Hi,

    I have the same problem but my program says that the variable live_row_[loop name] doesn´t exist. I want my loop to stop every 6 items, so I can change subjects quickly - I'm going to be in an a exhibition, so I can't take much time and the ideia is that each subject can see 6 pictures, there's a break and the next subject can come and continue!

    Rita Almeida

  • Hi Rita,

    The live_row variable was introduced in OpenSesame 3.1, so I would first make sure that you're not simply using an older version of OpenSesame. If that's not the issue, could you then post the full error message here, including the item stack etc.?


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

Sign In or Register to comment.