# Randomising stimuli

Hello everyone! I hope you don’t mind my asking for advice, I’m in desperate need of assistance.

I currently working on a project. Thanks to the joys of Covid, I have to rapidly rework this and must utilise Psychopy for an online experiment. Unfortunately, I have no previous experience with Psychopy or python. So any advice would be welcome

I have 20 trials. Each trial constitutes the following:

1. A scenario
2. An image, with two people presented on screen (Person 1 and Person 2).
3. An audio for a speech that is associated with person 1 and person 2.

So that the paradigm is: scenario - person 1 on screen = speech 1. Then person 2 = speech 2.

For the purpose of my study I want to randomise the position of the person stimuli I. E., left v. Right. So that the stimuli will be presented as either: person 1 (left) / person 2 (right) OR person 1 (right) / person 2 (left).

The problem I have is the following. The two speeches for each person, are paired with a scenario. So that:
Scenario 1 = speech/person 1/ speech/person 2
Scenario 2 = speech/person 3/ speech/person 4.
An so on, up to 20.

I need to keep the integrity of this while randomising the position (left v right) on screen of the person stim. So scenario 1, must alway be partied with person/speech 1 and 2. But the position of these must be random on screen. The overall order of trials must also be randomised. I. E. Trials 1 - 20.

I am using Psychopy 3.

Any help with this would be greatly appreciated and I hope I’ve been somewhat clear.

Thank you

You can achieve this using a loop, check out the documentation on Loops:
Essentially, you need to have the faces, speeches and scenarios in corresponding rows of an excel table, with this serving as the Conditions file for a Loop set to random. This will make variables with the names you gave to each column (e.g. `face`, `scenario`, `speech`) which can then be set as the value for components in your routines using a `\$` in the parameter input to show that it should be interpreted as code (e.g. `\$face`, `\$scenario`, `\$speech`)