Accessing condition variables in code inside loop

If this template helps then use it. If not then just delete and start from scratch.

What are you trying to achieve?:
I have an experiment with multiple randomly ordered trials. There is a conditions excel file. Said file gives image paths for 3 different conditions. Which condition should be applied is both dependent on participant response (1 is the first condition, 2 means it is randomly decided between the two other conditions).
I would like to show paricipants the image that belongs to their condition.

What did you try to make it work?:
If I put just $Presentation1Image in the image part I get an image, however this does not allow me for it to be dependent on what the participant responded.

I created code at the beginning of the loop and at the end and then put the image presentation into a second routine inside the trials_loop, where I was trying to refer to the participant response and the condition.

What specifically went wrong when you tried that?:
I have failed to find a way how within the builder trials handler here I can refer to the conditions file variables as variables in the code, and how I can then advance from the variable in the code at the end/beginning of the routine to a variable I can call in the image i am loading. It seems to me both of these things ought to be simple, but I keep only finding work-arounds on the forum that do not work for my specific situation.

You might need something like

if condition == 1:
     thisImage = Presentation1Image
elif random() > .5:
     thisImage = Presentation2Image
else:
     thisImage = Presentation3Image

You’d want to add some code to save the image used.

Thanks.
That part I kind of already had. It turns out the primary problem was something else, and had lots to do with the timing of things. I.e. if I do something at the start of a routine, apparently then that is still too late unless I set the presentation wthin the loop to “every frame”. I would have expected that “every repeat” is good enough

Your code component should be above the component.