I am creating an experiment where I need a textbox component to appear but only for a subset of trials (2 out of 68 trials), is there any way to make this work? I haven’t tried anything myself yet as I’m not very competent in coding.
Thanks
I am creating an experiment where I need a textbox component to appear but only for a subset of trials (2 out of 68 trials), is there any way to make this work? I haven’t tried anything myself yet as I’m not very competent in coding.
Thanks
Hello, welcome to the forum!
Here is my way of solving it.
When the experiment starts, create a list containing two random ints between 0 to 67:
# Begin Experiment
import random
showTextBox = False
choosenTrials = random.sample(range(68), 2)
Then, whenever a new trial starts, check if the current number of repetitions is one of the chosen trials:
# Start Routine
if trials.thisN in chosenTrials:
showTextBox = True
else:
showTextBox = False
Finally, create a condition to enable/disable the textbox:
Thanks a lot, appreciate it.