Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[open] visual array experiment

edited May 2014 in OpenSesame

Hi!

I am pretty new using this program however all the tutorials have been really useful!

Nonetheless I have not found help regarding on how to create a visual array of 4 constant images because what I need to be random are the arrays not the images within them.

Any guidance would be appreciated!

Comments

  • edited 8:12AM

    Hi,

    You will not be able to do this using just the OpenSesame GUI, but you could use Python inline scripting to get the same result. So it will be a very good idea to learn some Python.

    A general approach could be the following:

    1) Specify the four image names using a loop, in four variables, named "img1", "img2", "img3", "img4".

    2) Use the following inline_script to randomize the order

    # import the random module
    import random
    
    # put all the image names into a list
    imglist = [exp.get("img1"), exp.get("img2"), exp.get("img3"), exp.get("img4")]
    
    # randomize the order of the list
    random.shuffle(imglist)
    
    # reset the image names
    exp.set("img1", imglist[0])
    exp.set("img2", imglist[1])
    exp.set("img3", imglist[2])
    exp.set("img4", imglist[3])
    

    3) Use a sketchpad to present the images, by referring to them by using the variable names in square brackets, like so (note that the following is OpenSesame syntax, from a sketchpad item!):

    draw image -96.0 -96.0 "[img1]" scale=1.0 center=1 show_if="always"
    draw image -96.0 96.0 "[img2]" scale=1.0 center=1 show_if="always"
    draw image 96.0 -96.0 "[img3]" scale=1.0 center=1 show_if="always"
    draw image 96.0 96.0 "[img4]" scale=1.0 center=1 show_if="always"
    

    Good luck!

Sign In or Register to comment.