Howdy, Stranger!

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

Supported by

[solved] Background colour as variable

edited October 2013 in OpenSesame

Dear all,

In our experiment we want to link pictures (n=120) to a backgroundcolour (red, yellow, green, blue). We want OpenSesame to randomly assign a colour to a picture. We now have one loop with the variable [colours], and a loop within that loop with the pictures. That sequence exists of the variables [pictures] and [colours].

How do we need to set the repeat options so that the pictures occur ONCE and that they are randomly assigned to a colour?

Thanks!

Comments

  • edited October 2013

    Hi Marte,

    I think you should arrange your loops the other way around, such that the loop where you define the variable 'picture' is the outer loop, and the loop where you define the variable 'color' is the inner loop. To avoid all pictures being shown four times instead of one, you should set the number of cycles of the inner loop to 0.25.

    So:

    image

    Next, you could use the square bracket method to set the desired background color in a given sketchpad item via the script editor:

    image

    A working example experiment can be downloaded here (save with the extension '.opensesame' and open as normally):

    Note that the above-described method makes sure that every color appears on approximately 25% of the trials. If your design requires every color to be shown on exactly 25% of the trials (i.e. in your case 30 trials), you need a tiny bit of Python inline scripting. Let me know if the latter is what you're looking for!

    Hope this helps!

    Cheers,

    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • edited 1:54AM

    Thanks Lotje,

    It works now! :)

  • edited 1:54AM

    Perfect! Good to hear! :)

    Did you like my answer? Feel free to Buy Me A Coffee :)

Sign In or Register to comment.