[solved] Randomize and take only one of three conditions
Hi
I would like to presents words (every word only once) on a screen either on the left side, right side or in the middle.
So I created a loop for all words (variable = words (1,2,3,4,..) and in this loop is another loop with the word_positions: -350 (=left), 0 (=middle), 350 (=right).
But I want that every single word appears only once and either left, right or in the middle (not on all positions, only at one).
So I set the amount of cycles to 0,35 (1x0,35) of the seconds loop. This works. Every word only appears once left, right or in the middle and not in all three conditions like before.
But now, I want, that every condition (left, right, middle) appears balanced (for 30 words, 10 words right, 10 words left and 10 words in the middle). But randomized as before. How I can realise that?
My aim: every Participant sees 30 words. The words appear on a screen on the left, right or in the middle in random order. Every word should appear only once.
Thank you in advance ![]()

Comments
Hi,
I think, a single
loopthat iterates over the words will be enough for your purposes.In this
loop, add each of the words on a line. This makes sure that you will see each word only once (unless you repeat the entire list multiple times). In order to make the position were the word is presented counterbalanced, you need to do someinline_scripting. Add oneinline_scriptbefore the word-loop. Inside thisinline_script, you will create alistwill all possible locations and how often they appear, like so:Next, you have to place another
inline_scriptin thesequence, which the word loop is iterating over (so the one, in which you are also going to present the words).In this
inline_script, you will draw one position from your list of positions and use it to define, where the word will be drawn to.After that you can draw your stimuli, either with a
sketchpad, or you can draw directly from within this sameinline_script:I hope this helped.
Eduard
Thank you a lot Eduard, this looks great
But I have still one problem: when I run this, there occurs this error:
"Error while executing inline script
phase: run
item: __script2
line: 2
exception message: 'list' object is not callable
exception type: TypeError"
So in the seconds script (# takes the first value in that list without replacement
position = positions(0)) this occurs at line 2 =" position = position(0)".
I've tried to set the list "positions" global. But this dont solve the problem. I dont get it
Hi,
My bet, I forgot something in the code.
Instead of
position = positions(0)it should have beenposition = positions.pop(0)Sorry for that.
eduard
Ok, it works
Thanks 
Still one question:
If I use the canvas instead of the sketchpad, it shows me this error:
"item: __script2
line: 4 exception message: name 'canvas' is not defined
exception type: NameErroras()"
But canvas is a function...
But if I use the sketchpad instead of the canvas-inline code, it tells me, there is no variable "position".
Sorry for the questions again, I'm really a newbie.
Thank you
Which version of OpenSesame do you use?
Assuming that you use OpenSesame 3.0.x
For the
sketchpaduse you have to makepositiona variable of the experiment. This works simply by storing it asvar.position = positions.pop(0). Then later in the sketchpad, you set the position you want to draw as [position].If you use Opensesame 2.9.x, things are a bit different. Let me know if this is the case, and I will explain what you could do.
Eduard
Ok, I used "exp.set("position", position)" and it works.
Thank you a lot Eduard. Outstanding support.
Ah ok. Then 2.9 it was.
You're welcome.