Randomise, but force 1st item per talker to be a filler
in OpenSesame
Hello,
OpenSesame is a such a cool program! I'm currently trying to set up an experiment in which the participants are confronted with three different talkers. Each talker utters a variety of sentences, among which some fillers. I'd like for the order of presentation to be essentially random but with the constraint that the first sentence heard per talker is a filler.
Here's a slimmed down stimulus list.
| SentenceID | Talker | SentenceType |
|---|---|---|
| S1 | A | filler |
| S2 | A | filler |
| S3 | B | filler |
| S4 | B | filler |
| S5 | C | filler |
| S6 | C | filler |
| S7 | A | target |
| S8 | A | target |
| S9 | B | target |
| S10 | B | target |
| S11 | C | target |
| S12 | C | target |
Permissible orders include:
- S1, S7, S6, S8, S3 etc.
- S4, S3, S9, S1, S11 etc.
- S1, S3, S6, etc.
There's no need for the first three items to be fillers by different talkers, just for each talker's first item to be a filler.
Non-permissible orders include:
- S7 etc. (Talker A is introduced with a target rather than with a filler.)
- S1, S8, S9 (Talker B is introduced with a target rather than with a filler.)
Any suggestions? Thanks for your time and effort!
Jan

Comments
Hello,
I haven't fully implemented the following solution in OpenSesame yet, but this Python code generates lists that satisfy the constraint (see OP):
A couple of runs produced lists such as these:
Quick follow-up:At the end of the inline script, I've now added
Then I used an inline script before the trial presentation with the following content:
my_sentence and my_talker can then be used in the trial's sketchpad.
This seems to do the trick. Hopefully this is useful to other users. Thanks again for developing OpenSesame!
Hi Jan,
nice that you sorted things out yourself. I haven't looked at your code in detail, but just a few small remarks.
1) It shouldn't be necessary to declare your variables as globals. All the
inline_scriptsshare a common workspace2) In a comment you say:
# the "pop" method used later works from the back to the front,so just reverse the list here. Actually, you can specify which item should be popped from a list. The default value is-1I believe, but if you pass0it will pop from the beginning.3)
exp.set("my_sentence", current_sentence)can be replaces withvar.my_sentence = current_sentenceHope this is a little useful to you.
Good luck,
Eduard
Very much so, thank you!