Howdy, Stranger!

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

Supported by

How to have no repetitions in trial sequence by using the loop?

edited January 10 in OpenSesame


I want to create a go/no-go dual task in which the no-go condition comes only in 30% of trials. With the loop, I created a factorial design to my needs. But now my problem is, that I don't want to no-go trials (30% of trials) if the previous was already a no-go.

Is there any possiblity to access the loop to check for this?

Thanks in advance.


  • Hi Inga,

    I am not sure whether advanced loop operations could also do the trick, but I would opt for an inline_script that takes care of the creation of the trial_sequence. For example following script:

    import random
    # zero represents 70% go, 1 represents 30% nogo
    all_trials = [0]*70 + [1]*30
    while True:
        # variable that decides whether the while loop will be terminated or not
        break_loop = 1
        for idx in range(1,len(all_trials)-1):
            # if the sum of two consecutive trials is 0, that means 2 nogos after each other
            if all_trials[idx]+all_trials[idx-1] == 0:
                break_loop = 0
         if break_loop:

    Does that help?


Sign In or Register to comment.