Issues with Conditional Branching for Approach-Avoidance Task

OS (e.g. Win10): Windows 10
PsychoPy version (e.g. 1.84.x): v2023.2.3
Standard Standalone? (y/n) If not then what?:
What are you trying to achieve?: I’m making an approach avoidance task where participants need to choose between two shapes (triangle and circle) and then receive an outcome based on the shape they selected. The shapes have different odds of reward and punishment.

What did you try to make it work?: I made a loop for the block (incongruentAAT_loop) with the choice between the two shapes. I then made two separate loops (incongruentAAT_triangle_loop and incongruentAAT_circle_loop) that have separate .xlsx condition files set up with the correct reward/punishment ratio for that shape. Each condition file has 20 conditions with 4 paramaters (outcome, pointsDelivery, shockDelivery, outcomeFeedback). outcomeFeedback is a path to an image showing the outcome for the trial, and is called on in the AAT_triangle and AAT_circle routines. See below for the loop structure in Builder and one of the .xlsx files:


image

There is code at the end of the incongruentAAT_choice routine that sets the number or reps for the triangle or circle loops depending on which shape is selected via a key press:

if aat_choice_resp.keys == '1':
    triangleReps = 1
    circleReps = 0
    
elif aat_choice_resp.keys == '2':
    triangleReps = 0
    circleReps = 1

What specifically went wrong when you tried that?: I get sent into the right triangle/circle loop after making my selection, but then am presented with all 20 possible outcomeFeedback conditions (2 seconds each) rather than just one. I need it to send me back to the start of the incongruentAAT_choice routine after one outcomeFeedback picture is presented in the AAT_triangle/AAT_circle and am not sure where I need to modify things further to accomplish this (new PsychoPy user).