Howdy, Stranger!

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

Supported by

One Loop Nested in another Loop breaking Issue

I have an experiment with nested loops, I am trying to break the inner loop only, which will then run back to the next item of the outer loop. However, when the inner loop is broken with a keypress, the outer loop also breaks. This means that the outer loop only runs the first item in the table, and then goes onto the end of the experiment. I used break_if in the inner loop set to a correct keypress, but the outer loop is set to break_if never. I am looking for a way to structure the items so that when the inner loop breaks, it brings up the next item in the outer loop.

Any help you all can provide is much appreciated.

Comments

  • Hi,

    How did you implement this? Can you share the experiment (preferably as simplified as possible)? What you describe shouldn't happen ideally.

    Thanks,
    Eduard

  • Hi Eduard,

    The outer loop of the experiment contains a series of different pictures, which are referenced on the test phase sketchpad item. The program is designed to run through all of these photos in a random order (break_if: never). The inner loop contains a series of duration at which the testphase item is presented at. These must be sequential, in a progressively longer order. When the participant is able to identify the picture presented, a keypress breaks the inner loop (break_if: [response] = w). When the inner loop is broken, the program should move onto the next item in the outer loop, starting at the first duration of the inner loop for a new photo. However, for some reason, when the inner loop breaks, instead of calling back to the outer loop, the program runs as if the outer loop does not exist, moving to the THE_END sketchpad item. I have tried playing around with breaking loops, and it appears no matter what structure exists around a loop, when it is broken the program moves onto the closest sketchpad item below it, regardless of any other loops.

    I have worked around this issue by creating separate loops for each photo, which removes the need for the outer loop. However, this makes the program load slowly, so if you have any suggestions on how to make the nested loops work as intended, that would be wonderful!

    Thanks for your help,

    Harrison

  • Hi Harrison,

    Well, as far as I can see, the THE_END sketchpad is the next item in the outer loop, once the inner loop is finished. So given your description and your screenshot everything seems to make perfect sense. You also don't have an outer loop sequence. So until you have set up the outer loop properly, I don't think it is going to work.

    Eduard

Sign In or Register to comment.