[solved] Controlling the randomisation of loop variables
Let's say I want a loop which goes through 6 items (A, B, C, D, E and F) randomly. However, there is a constraint that the first item in the loop should be A, B or C and the last item in the loop should be D, E or F; then the middle four elements are random (modulo the items that have already been chosen at the terminals).
How could this be done in OpenSesame?
My understanding is that I would have to split it up into three loops: one for the first element; another for the middle four; and a final one for the last element. I would then have to code some logic into the loop sequence items to ensure items aren't picked more than once (e.g., I could use subject number modulo 3 to determine the first and last, thus knowing what's remaining in the middle; or a permutation matrix generated from a static random seed).
Thanks;
C
Comments
Hi,
As far as I see, there is no easy and direct way of doing this with the
loopitem. However, doing it with aninline_scriptis not much harder. I would do following. First, I'd put a smallinline_scriptin the beginning of yoursequence. Furthermore, in theloopitem itself, you don't have to put your variable names (A,B,C,..), but just some sort of counter.In the
inline_script, you can put the actual part that selects the condition or item you need. Something like this, should do:Does this do what you had in mind?
Good luck,
Eduard
Thanks, Eduard
Yes, this looks like it should work
Now I've learned that what is declared in inline scripts persists until the end of the experiment it should, like you say, be very easy to get things to run the way I have in mind.
Great to hear. Then I'll mark this discussion as solved. If you happen to have more question don't hesitate to post them again in here.
Eduard