The running sequence of “D1” “D2” is fixed.I want to know how can I run "D2“ first in a half of all trails.

I need some codes or other things?

No need for coding. If “trials_2” loop is randomized you can insert additional routines to have this sequence:

DI1 - Mask2 - DI2 - DI2 - Mask2 - DI1

then place two loops inside “trials_2”, one from DI1 to DI2 and one from DI2 to DI1, set the loop as sequential and the number of repetition as variables (e.g. myOrder1 and myOrder2). Finally, in the condition file for the outer loop (trials_2) add to colimns, “myOrder1” and “myOrder2”, for half the rows write 1 under myOrder1 and 0 under myOrder2, and the opposite for the other half.

Thank u very much.One more question,the setting above actually prescribe each condition’s running sequence artificially.However,to make sure it’s a ture random,each condition’s running sequence(DI1 - DI2 or DI2 - DI1) is randomly decided.Maybe I need additional code or something.Anyway,it’s the best solution I have up to know.Thank u again.

This should be random based on the random order of the outer loop.

But conditions are bounded by fixed value of myOrder1(2).Every condition’s running sequence(DI1-DI2 or DI2-DI1) is determined artificially.

What does your flow diagram currently look like?

Is trials_2 pointing to a spreadsheet with two rows (0 1 and 1 0) which define the nReps of the two inner loops? That should play the outer loop twice, including the two inner loops one at a time in a random order.

When I decide the number of myOrder1(2),that row is determined,which means I only have one determined sequence for a certain experimental treatment.For example,in the first condition,A,B,C->D run in a fixed DI1-DI2 sequence.However,we expect that each experimental treatment(condition) is randomly assigned different sequence.

Thanks a lot.