Slot machine in OpenSesame
Hi,
Let me start by thanking the developers for a great piece of software!
I would like to use OpenSesame to run an interactive slot machine experiment using at least semi-realistic stimuli, but am unsure of the best way to present three spinning reels. It would be great if there was any convenient way of achieving this using a looped sketchpad, similar to this video of how it can be done in Powerpoint.
Perhaps using overlapping, ordered draw rect
functions (or equivalent image) and adding movement parameters, preferably with a specified delayed onset and acceleration/deacceleration for each object? That would enable me to match the final position to a defined variable from the design matrix.
draw rect color=blue fill=1 h=768 penwidth=1 show_if=always w=160 x=32 y=-384 z_index=5 draw rect color=green fill=1 h=800 penwidth=1 show_if=always w=192 x=-192 y=-384 z_index=4 draw rect color=red fill=1 h=768 penwidth=1 show_if=always w=192 x=-416 y=-384 z_index=3 draw rect color=black fill=1 h=-160 penwidth=1 show_if=always w=1088 x=-512 y=384 z_index=2 draw rect color=black fill=1 h=160 penwidth=1 show_if=always w=1152 x=-512 y=-384 z_index=1
Can this be done? Can anyone provide me with some example code or point me in the right direction?
I am guessing that an alternative would be to use other software to create and record a certain number of spin and outcome iterations and present these as videos, but that would limit the experimental design somewhat.
Thankful for any input!
Philip Lindner
post-doc, Stockholm University
Comments
Hi Philip,
That problem is really not trivial. I'm not sure what is the best way to go about this. From a performance perspective videos would probably make most sense, but then you lose all the flexibility of course (or you would have to prepare all possible endings).
Probably you should start by having a static image of a slot machine as background. In the foreground, you replace the three turning wheels with a rapid stream of stimuli. If you just present them statically (not moving from top to bottom), you'll probably get a decent experience with not that much effort. Check out the advanced tutorial to have a starting point for the implementation.
Third option and probably the most difficult to implement, is having an image of all the objects that could appear in the slot machine stacked vertically as a single image and move it iteratively downwards. If it reaches the very bottom it starts at the top again. Important here is that the updating appears in the background layer. The static slot machine and the background will always be drawn in the foreground (sparing the actual wheels).
Regardless of how you choose to do it, you will need to do some python coding in
inline_scripts
.How about you give it a go, and see where you get. From there we might be able to help to get to the end.
Eduard