log shuffled list
Hello!
I am looking for a way to log the shuffled sequence of a list. I am using an inline script for presenting a series of pictures randomly in one display.
x_a1 = exp.get_file('x_a.png')
x_b1 = exp.get_file('x_b.png')
x_c1 = exp.get_file('x_c.png')
x_d1 = exp.get_file('x_d.png')
l = [x_a1, x_b1, x_c1, x_d1]
toBeShuffled = l
shuffle(toBeShuffled)
print (toBeShuffled)
left_pic = toBeShuffled[0]
right_pic = toBeShuffled[1]
center_pic = toBeShuffled[2]
center2_pic = toBeShuffled[3]
print(left_pic)
print(center_pic)
print(center2_pic)
print(right_pic)
So I want to know what picture is "assigned" each time in variable left_pic, right_pic, center_pic, center2_pic. Should I use a scripted logger? Or should I add something to my inline script in order to have such a choice on the logger? Thanks in advance for any ideas!
Best regards,
Vicky
Comments
Hi Vicky,
if you prepend your variables with a
var, they will be added to the logfile (of course, only if you have aloggeritem placed after that.e.g.
Goo dluck,
Eduard
Hi and thanks for the idea!
I tried it but the var. function does not work in my script. Maybe there is something with my version, it gives me an error message now,:
exception message: name 'var' is not defined
exception type: NameError
So I really don't know if that would work!
This is the full script
Which version of Opensesame do you have? If it's an older one
.0, you can try to replace the
varwithexp.Eduard
It's working just fine!
Thank you
-V.