I have a task where the participant is shown different stimuli in a loop of 80 trials. 8 of those trials should be followed by a question about the stimulus (“Was the object in the image an animal or a vehicle?”). The 8 trials that are to be followed by a question are to be picked randomly - I can set that up using functionality from Python’s random module.
What I’m wondering is what the best way is to insert a “conditional routine” the way I’m describing here. In pseudocode, what I want is
if current_trial_should_be_followed_by_question: do the 'question' routine
In the Builder, I can of course insert a ‘question routine’ in the trial loop and add a code snippet that, at the beginning of each routine iteration, checks if the ‘run question routine’ variable is set to
False. If the variable is set to
False, the snippet would assign
continueRoutine = False, otherwise it would proceed with code for asking the question and fetching the participant response. But I don’t know if this leads to issues with e. g. timing. If I assign
continueRoutine = False at “Begin Routine”, would a frame have to pass before the routine is ended? In that case I’m guessing there’s a better solution, but I haven’t been able to think of one.
I’d greatly appreciate any help with this.