Howdy, Stranger!

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

Supported by

change of the duration of the loop

hi, i'm new on opensesame. I have to develop an experiment and i have a problem with the duration of the loop. In particular, i know that on default the system is on "repeat each cycle 1.00x" and i know how to change the number of ripetitions, but this is not important for my aim. Instead, i need to make sure that the duration of the loop is 15 seconds. Do you have any idea how to do this?


Thanks

Comments

  • Could i write <<"break if" 15>> or something similar?

  • Hi Maria,

    The loop table is not useful for when you have a time-based loop rather than a repetition based loop. You can still use the loop item in combination with measure the time on each iteration, but I think it makes more sense to use Python coding in an inline_script. For example like this:

    # make 2 canvasses
    cv = Canvas()
    cv2 = Canvas()
    cv.circle(0,0,10,fill=True)
    cv2.rect(0,0,10,10,fill=True)
    # make a response item
    kb=Keyboard()
    # start time
    t0= clock.time()
    # loop over the two images and responses between them
    while clock.time()-t0<15000 # run for 15000 max
        if k==None:   
             cv.show
        k,t = kb.get_key(timeout=1000)
        if k != None: 
            cv2.show()
    

    Does this make it clear how to use a time-based loop?

    Eduard

    Buy Me A Coffee

Sign In or Register to comment.