Present images sequentially before a randomized trial

Hi there!

I have an experiment where two participants need to make decisions sequentially. At the beginning of each trial they see an arrow pointing up or down, depending on who has to make the decision during that trial (Participant 1 = arrow up; Participant 2 = arrow down). Then, during the trial, one of them makes a decision by clicking on randomly presented pictures.
What I need to do is to present the arrows sequentially (up, down, up, down, etc) before each trial, so that during the first trial Participant 1 makes a decision, in the second trial Participant 2, third trial Participant 1, fourth trial Participant 2, and so on (i.e. turn-taking). This is the overall structure I have so far in the Builder:

Within the arrows stimuli I’ve defined the variable $arrow_dir, which is one of the column labels from the excel file where I have defined the two pictures (images/arrow_up.png and images/arrow_down.png)

Whenever I run the script it either shows both arrows one after the other, or one but in a totally randomized order across trials. Any idea of how to do this?

Thanks,

Martin

Hi,

You need to tell us more about the contents of your conditions file and the settings of your loop.

e.g. if you have the loop set to “random”, then your arrow direction column will be randomised along with all of your other variables. If it is sequential, then the order of the arrows variable would be constant but you would need to have its values alternating from row to row.

If you want to have the best of both worlds (a randomised conditions file order but alternating arrow conditions), that is easily doable with a snippet of custom code, which we can suggest once we know more of your intended design.

Hi Michael,

As always, thanks a lot for your help.
I have created two loops, one for the arrows stimuli, and another one for the pictures during the trial (see picture of Builder above). I’ve also created two separate excel files: one with the arrow stimuli, and the other with the pictures that I present during the trial.
Everything works well during the trial (pictures are randomized and the data from the clicks is correctly recorded). My problem is with the arrows that come before the trial. I want on each trial to have one of the two arrows, and to be sequentially presented (up, down, up, down). Maybe the problem has to do with my excel file arrow_stim.xlsx (23.8 KB). I have a single column with both pictures. Maybe if I have two columns, one with arrow_up and the other with arrow_left, would solve the problem?

Edit: Oh, and regarding the loops, the first one (for the arrows) is set to sequential, while the second one, for the trials is set to random

OK, the issue here is that I think you only want one loop, which controls the trials. At the moment you have it set up so that there is a loop that runs inside each trial. Sometimes there is a need for that, but in this case, I think you only want one arrow to be shown on each trial, so the arrows_stim routine should be controlled only within the trials loop.

So:

  • delete the trials_2 loop and throw away arrow_stim.xlsx
  • change the arrows stimulus to have a hard-coded reference to images/arrow_up.png, and set that field to be “constant” rather than “set every repeat”. (i.e. instead of changing the image on every trial, we’ll just rotate it).
  • in the orientation field, put something like trials.thisN % 2 * 180

% is the modulo operator, so trials.thisN % 2 means “get the remainder of dividing the trial number by 2”. This will be 0 for an even trial number, and 1 for an odd trial number. Multiplying that by 180 means the orientation of your arrow stimulus will be 0 on even numbered trials (including the first, or zeroth trial), and 180 degrees on odd numbered trials.

Set the orientation field to “set every repeat”.

This works beautifully. Thanks a lot Michael!