[solved] variables in sketchpad
hi again!
i am wondering how to use variables in a sketchpad. i tried to set a global var in an inline_script (run_phase) and point to it in a sketchpad...no success.
i would like to do following:
create an array and shuffle it like
pic = [
["001.jpg","aaa","bbb","ccc"],
["002.jpg","ddd","eee","fff"]
]
random.shuffle(pic)
and show a random pic in the sketchpad like
draw image 0 0 pic[1][0] scale=1 center=1 show_if="always"
any hints?
thanks,
ben
Comments
Hi Ben,
Inline_script items require Python coding, whereas sketchpad items require OpenSesame coding. You cannot mix the two.
In your case, I think it's best to determine which picture to show in your inline_script item, and to subsequently set this variable for future use in the GUI (i.e., the sketchpad item). Next, you could simply use the square-bracket method in the skechpad item.
So:
In your inline_script:
In the sketchpad editor, use the square-bracket method:
For more information, see:
Does this help?
Best,
Lotje
Did you like my answer? Feel free to

cool! works fine! thanks a lot! cheers, ben