Randomising without repeats across blocks in builder for a Pavlovia experiment

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): Psychopy 2022.2.4
Standard Standalone? (y/n) y
What are you trying to achieve?:
I have written a program in builder to run via Pavlovia, which works fine, other the randomisation that I would like it to have.
The program is a learning task, which presents a stimulus (e.g. a square with a dot in the middle) followed by an outcome (a different face with a neutral, negative, or positive expression). I have three distinct stimuli, each associated with either neutral, negative, or positive expressions. I would like to present each stimulus/expression pairing randomly and repeat this 16 times, but repeating without replacement - for example the order could be N - Neg - Pos - Neg - Pos - N, but NOT N - Neg - Pos - Pos - Neg - N.

What did you try to make it work?:
To achieve this, I have three loops around these learning trials in builder, following this advice: https://www.psychopy.org/builder/blocksCounterbalance.html

The outer most loop, “randomisation_of_files”, loops through conditions file “RandFile_v1” which contains a “condsFile” column. The loop selects one mapping file (e.g. "Mapping1.xlsx; for simplicity, I only have the one possible option for now, but eventually there will be 6). This mapping file points to a file which assigns the type of stimulus (e.g. square or circle) to each expression type (neutral, negative positive).


The middle loop, “blocks_rand”, loops through a conditions file which the outer loop has selected - currently “Mapping1.xlsx”. This file contains two columns. The first column, “Emotion_cat” points to three files, one for neutral, one for negative, and one for positive images (N1.xlsx. Neg1.xlsx, Pos1.xlsx). The second column, “stimulus_file” assigns the stimulus image (e.g. a square, “GenStimA_1.jpg”). This file is supposed to randomise the order of the expression presentation.


The inner most loop, “trials”, cycles through the files which contain the outcome images and text, e.g. the 16 neutral images contained within “N1.xlsx” file.


What specifically went wrong when you tried that?:
The program is working file and I do not get errors, but currently I only get repeated trials. The program appears to randomly choose neutral, negative, or positive images, and then presents all of them in a row. For example, it presents all positive images, followed by all neutral, followed by all negative, despite nReps being 1 at each of my loops.

I have read forum posts trying to achieve something similar, but in all cases I have seen, coding had to be used. However, I am new to coder and I was not sure how to adapt the code to my experiments. I am hoping there is a way to achieve what I need to within builder. Any help/pointers would be much appreciated.


nReps refers to the number of repetitions of the conditions-file. You want pseudo-randomization and that can only be achieved via code.

Best wishes Jens