Loops without a conditions spreadsheet
Typically a loop will look something like this:
The Conditions field contains the name of a spreadsheet (or a variable name). In this example, the spreadsheet task_conditions.xlsx contains 11 rows (one row of parameter/variable names plus ten conditions) and three columns (one for each variable). Num. repeats is set to 2 and the Loop type is set to random so the participant will see 20 trials with each of the ten conditions appearing once in the first ten trials and once in the second.
If I clear the Conditions field then the participant will only see two trials, i.e. the value in Num. repeats.
I could use this to simply repeat a routine (or set of routines) or I could use lists to select values for the paramters I need using either trials.thisN as the index (e.g. Answer[trials.thisN]) or .pop (e.g. Answer = answerList.pop()).
The parameters could also be a list of dictionaries, in which case the above example might be allConditions[trials.thisN][‘Answer’]. However, whichever method you use, ensure that you save any necessary information to your data file, e.g.
thisExp.addData('main_condition',allConditions[trials.thisN]['main_condition'])