Controlling how many times a probe (E) appears in a row in the dot probe task

I’ve created a dot probe task where two images appear, one on the right side and one on the left side, and following the images, the letter E or the letter F appears on either side of the screen.
Is there a way to limit how many times the same letter appears in a row? For example, I want to limit the amount of times that ‘E’ appears in a row to just 3.
Additionally, is there a way to limit how many times the probe appears on the left/right side?
Thank you.

1 Like

Hi @Mai_ta,

assuming that you have a conditions file that specifies where which probe should appear (e.g., columns pos and probe), you could set the loop to full random and number of repeats very high. This way you can then skip trials that don’t match your criteria. Then you could check some conditions at the start of each trial using some code:

Begin experiment

last_pos = "none"
last_probe = "none"
same_pos = 0
same_probe = 0

Begin routine

if NameOfYourLoop.thisN == NumberOfTrialsYouNeed: # needs to be adjusted to your needs
    NameOfYourLoop.finished = True # needs to be adjusted to your needs

if last_pos == pos:
    same_pos += 1
    same_pos = 0

if last_probe == probe:
    same_probe += 1
    same_probe = 0

last_pos = pos
last_probe = probe

if same_pos > 2 or same_probe > 2:
    continueRoutine = False
1 Like

Thank you so much!
It’s not entirely working yet but I think I need to make a few changes first.

I’ve just confirmed that continueRoutine = False does not work in 2022.2.x offline. It results in a blank screen for the normal duration of the routine.

continueRoutine code | try it

The expected behaviour is correct online. It also works offline if you set the version as 2022.1.4