You are correct to de-select the “force end routine” setting, as that isn’t flexible enough for what you need. You will need to handle the response in code, so insert a code component in your routine, from the “custom components” panel. In its “begin routine” tab, put something like this:
# keep track of what/how many letters have been clicked:
clicked_letters = []
Then put something like this in the “each frame” tab so that clicks are monitored continuously throughout the trial:
if mouse.isPressedIn(your_okay_box_name) and len(clicked_letters) == 4:
continueRoutine = False
else:
# using your actual stimulus names, check each one for a click:
for letter_stim in [letter01, letter02, ..., letter26]:
# only respond if a letter has not already been clicked:
if mouse.isPressedIn(letter_stim) and letter_stim.colour == 'black':
letter_stim.colour = 'green'
clicked_letters.append(letter_stim.text)
if len(clicked_letters) == 4:
# make the okay box look enabled
your_okay_box_name.opacity = 1
Then something like this in the “end routine” tab to save the responses into four separate columns in your data file:
for i, letter in enumerate(clicked_letters):
thisExp.addData('response_' + str(i), letter)
Give your text stimuli an initial colour (like black
) and the okay box an initial opacity value of, say 0.5
, and set each to “update every routine”. This allows them to be updated in code but then get re-set at the start of each trial.