defining a loop item within inline script
Hi!
I didn't find anything about this problem here, maybe I am missing something but here is the thing:
I have a pretty specific randomization requirement to follow with my stimulus set which is not doable with the options of the loop item, however I can easily create my randomized list of stimuli in inline python.
Is there any way to get a loop item to use my script-made table/list and run through that?
Of course I can write the whole experiment with inline script, and I could use my stimulus_list variable as an iterable if I used inline scripts with canvas, but it'd be so much more convenient if I could define the whole loop table with code.
Now I am using a list of lists format:
[["word","color"],
["red","green"],
["green","green"],
etc...]
but it's not necessary, if I can somehow get it into a loop element.
Thanks in advance
Comments
Hi @mibognar ,
Is there any way to get a loop item to use my script-made table/list and run through that?
Yes, this is certainly possible. The
loopitem is available ininline_scriptitems as aDataMatrixobject called "dm".Actually, OpenSesame generates two
DataMatrixobjects on the basis of theloopitem:loopitem as you see it in the GUIloopitem after it has been transformed by, for example, randomizationYou can find more information here, under "Accessing the loop table in Python inline script":
Hope this helps you a bit further. Just let us know if you have any more questions!
Cheers,
Lotje
Did you like my answer? Feel free to

Hi Lotje!
Thanks, it works perfectly! Éooks like i missed that part in the documentation.
Best,
Miklos