Ok, let’s say your conditions file has four columns, named sentence
, phonology
, semantic
, and tap
. On your trial routine, insert a code component and in its begin experiment
tab, put something like this to ensure that we get a balanced assignment of 33 of each of the cue types:
# make a balanced list of cue choices:
cue_list = ['sentence', 'phonology', 'tap'] * 33
# randomise its order:
shuffle(cueList)
In the begin routine
tab, insert something like this:
# choose a cue type for this trial's sentence:
cue = cue_list.pop()
# store the type in the data file:
thisExp.addData('cue_type', cue)
# above we just have a string representation of the cue type, to
# be able to store it in the data. Now we need to get the contents
# of the actual variable corresponding to that cue type:
cue = eval(cue) # eg convert the string 'tap' to the variable tap
In one of your text stimuli, put $sentence
and in the other, put $cue
It is important that the code component is above your text stimuli, so that the current value of the cue
variable is updated before the text stimulus refers to it. You can manipulate the order of components by right-clicking on their icons.
The code above is a bit tricky, We could just directly choose one of the variables, but then if you saved that in the data, you’d get the entire contents of the cue for that trial, which already exists. For convenience you just want to store the type of cue chosen, so we do the little dance above to switch between a string label and converting it to a real variable name.
With 99 sentences, this would be well-nigh impossible for any feasible number of subjects.