Howdy, Stranger!

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

Supported by

[open] Random Placement of Image in Sketchpad

edited September 2015 in OpenSesame

Hello,

Apologies if this question has already been asked and resolved, but I am trying to create a Choice-Reaction Time experiment (a picture appears and a second or two later a dot appears in one of five places [top right, bottom right, top left, bottom left and centre] and the participant has to click on the dot - longer RTs = more interest in the picture).

I'm struggling to find out how to get this dot to present after a period of time and in one of the five places, randomly. Is it to do with the 'show if =' statement in the sketchpad?

Thanks!

Comments

  • edited September 2015

    Hi,

    Answer to your question: no. The show if statement is to indicate the condition under which your sketchpad must be shown. We can assume that you want to show your sketchpad regardless of condition, so it's better left at the default setting ("always").

    I think it's better to use an inline_script. With inline_scripts you would have to write some code, but it's the most straightforward way to implement certain manipulations, such as presenting a dot at a random location. Have a look here: http://osdoc.cogsci.nl/python/canvas/

    The canvas function substitutes for the sketchpad. What you further have to do, is indicate the five possible dot positions (x and y coordinates). You could make a list containing the five positions as follows: positions = [[10,10], [20,20], [20,40], [40,20], [40,40]] (note that these coordinates don't make sense!). Picking a random position and placing it on your canvas goes as follows:

        import random
        positions = [[0,0], [21, 41], [2,5]] # again don't mind the values here..
        chosen_position = random.choice(positions)
        exp.canvas.fixdot(y = chosen_position[1], x=chosen_position[0])
    

    Hope this helps. Good luck!

    Josh

Sign In or Register to comment.