URL of experiment:
Description of the problem:
Participants are first presented with a photograph on one initial routine and then depending on the participant’s response made on this first routine (1,2,3,4,5,6 or x), they are presented with one of seven loops where the same photograph is presented again alongside some rating scales. I have included a snippet from the flow (this only shows the first photo routine then one of the seven loops):
I currently have the conditional branching included in an End Routine code component in initial photo routine (“SetLineup” routine). This works fine. Participants are branched to the appropriate loop depending on their key press.
if (key_resp.keys == '1'):
DoTradConfID1=1
DoTradConfID2=0
DoTradConfID3=0
DoTradConfID4=0
DoTradConfID5=0
DoTradConfID6=0
DoTradConfReject=0
elif (key_resp.keys == '2'):
DoTradConfID1=0
DoTradConfID2=1
DoTradConfID3=0
DoTradConfID4=0
DoTradConfID5=0
DoTradConfID6=0
DoTradConfReject=0
elif (key_resp.keys == '3'):
DoTradConfID1=0
DoTradConfID2=0
DoTradConfID3=1
DoTradConfID4=0
DoTradConfID5=0
DoTradConfID6=0
DoTradConfReject=0
elif (key_resp.keys == '4'):
DoTradConfID1=0
DoTradConfID2=0
DoTradConfID3=0
DoTradConfID4=1
DoTradConfID5=0
DoTradConfID6=0
DoTradConfReject=0
elif (key_resp.keys == '5'):
DoTradConfID1=0
DoTradConfID2=0
DoTradConfID3=0
DoTradConfID4=0
DoTradConfID5=1
DoTradConfID6=0
DoTradConfReject=0
elif (key_resp.keys == '6'):
DoTradConfID1=0
DoTradConfID2=0
DoTradConfID3=0
DoTradConfID4=0
DoTradConfID5=0
DoTradConfID6=1
DoTradConfReject=0
elif (key_resp.keys == 'x'):
DoTradConfID1=0
DoTradConfID2=0
DoTradConfID3=0
DoTradConfID4=0
DoTradConfID5=0
DoTradConfID6=0
DoTradConfReject=1
elif (key_resp.keys == 'X'):
DoTradConfID1=0
DoTradConfID2=0
DoTradConfID3=0
DoTradConfID4=0
DoTradConfID5=0
DoTradConfID6=0
DoTradConfReject=1
else:
DoTradConfID1=0
DoTradConfID2=0
DoTradConfID3=0
DoTradConfID4=0
DoTradConfID5=0
DoTradConfID6=0
DoTradConfReject=1
This code works fine when I have a pre-selected png photo inserted into the image component on the set lineup and then again in each loop. The problem with this is that I have to create many experimental files because I have different photographs I need to use. I then use Qualtrics to randomize participants to an experiment file. Ideally, I would like one image to be randomly selected from a list of photographs. I successfully programmed this in a separate tester experimental file, but I am unsure of how I should implement this in the current study that involves conditional branching and different loops. How do I code this study so that a randomly selected photo is presented on one initial routine then again in different loops?
Below is information on how I programmed the randomizer. Again this works on it’s own, but I do not know how to incorporate it into the main project (e.g. where to put the loops, if I am missing any additional code, how to code so that the randomly selected photo is presented again on a subsequent loop). I tried incorporating this randomizer into the main study and have tinkered around but I cannot get the code to work. I the photographs do not load and I am presented with multiple trials rather than just one trial, for example.
Thanks so much!