Trial Randomization + Inter-block Break -

OS: Windows11
PsychoPy version: 2026.1.3
Standard Standalone Installation? y
Do you want it to also run online? n

Hi, I’m building a backward masking task in PsychoPy Builder and need help setting up trials and blocks.

My task is running successfully with a single sequential trial. However, I think I need to use a block loop in order to randomized trial stimuli and to add an inter-block break.

Structure of task

  • 18 blocks, 8 trials per block (144 trials)
  • Trials within each block should be presented randomly
  • Response screen after each trial
  • 16 second inter-block blank screen after the 8th trial response screen
  • Next block begins automatically
  • Blocks should run sequentially (there’s a fixed order to the blocks)

If possible, I do not want to split the excel file into 18 separate files.

I’ve looked into several Youtube videos and it seems like I may need to use a Code Component to select specific rows from a single conditions file (e.g., rows 0–7 for Block 1, rows 8–15 for Block 2, etc.). I’ve only used Builder’s interface, so I’m hoping someone can offer a beginner-friendly explanation / resources with where the code components need to be inserted and what code is required.

Any advice is appreciated, thank you!!

Do you definitely want the 18 blocks to run sequentially? If so then you could use concentric loops where outer_loops has nReps = 18 and the inner trials loop has selected rows $useRows. Then add a code component in a routine that is in the outer_loop but before the trials loop starts with the following code in Begin Routine

useRows = str(outer_loop.thisN * 8) + ":" + str(outer_loop.thisN * 8 + 8)