[solved] Dynamic visual search experiment
I'm trying to create a simple visual search experiment in which a variable number of objects move around randomly on screen throughout the trial. A target (defined by colour) may be present or absent on each trial. I've been trying to adapt the code from a previous request for a multiple-object-tracking experiment (http://forum.cogsci.nl/index.php?p=/discussion/277/open-using-opensesame-for-m-o-t-task/p1). That code generates displays which are ALMOST exactly what I need.
That is, it gives me:
- A fixation screen containing items in a starting position
- Items that move around at a specified velocity, avoiding one another and elastically bouncing back from the display boundaries.
All I need in addition is to have one target maintain its different colour throughout the trial, and have the trial terminate with a keypress.
Can anyone help?
Comments
Hey,
would you mind pasting the code that you currently use here? In the discussion you are referring to, there are plenty versions around, so it could be a bit confusing trying to add the stuff you need.
Thanks,
Eduard
Hi Eduard,
Thanks for your response. This is the code I'm currently using. Some of it is unnecessary for what I want, but it is a good starting point.
Can you try to replace these lines:
with these ones:
Does this work?
Eduard
Btw. I edited your post, so that it is easier to read.
Hang on - need to make that clearer...
I can't embed the code, but here's the weblink where you can find it:
http://pastebin.com/giytX4uF
Have you seen my response?
I have, thanks. It's hard to tell if it works because there is another problem: the display does not appear centrally on my monitor. The whole display is shifted to the bottom right quadrant, meaning I cannot see all the items.
Incidentally, this second issue has occurred with the latest version of OpenSesame v3.
That is, it worked OK on v1, but has gone askew on v3.
Either disable the checkbox
Uniform coordinatesin the very first item in the overview area (New experiment, or something similar), or subtract half the width/height from all coordinates in the code. The code was written in a version of Opensesame that was older then 3.0.x, in which (0,0) refers to the top left corner. From 3.0.x on, (0,0) refers to the center of the screen.Eduard
That's more like it - it seems to be working!
I would like to recolor the targets on a trial-by-trial basis. If I were to do this in the experimental loop, can I create a variable (say, called, "TargCol") and then refer to it in the script, as
targetColor = '[TargCol]'
And in the experiment loop, would that variable contain the colors as stipulated in RGB values?
Almost. you would have to refer to it like so:
var.TargCol. If you use standard colors, you can also use strings (e.g. red,green, etc). If you need very particular colors, you probably better use the exact labels. You can have a look on this site here. There are many color related information that might help you.Good luck,
Eduard
Seems to work perfectly now. Many thanks, Eduard.
My query is a continuation of the above thread, started by my colleague. The experiment is a visual search task in which a variable number of objects move around randomly on screen throughout the trial. A target (defined by colour) may be present or absent on each trial.
As it stands, the array is on screen for a specified number of frames, after which a mouse cursor appears and is controlled by the user. A left click records the xy position of the cursor and the trial terminates and the next trial begins.
What I need is the following:
Even though the velocity of the objects is fixed (defined as v in the script below), the smaller arrays move noticeably faster than the larger arrays. Is this likely to be a hardware issue?
Rather than have the display run to a fixed number of frames (defined as NFrames in the script), after which the mouse cursor appears and a response can be made, I would like NFrame to specify the maximum run length of a trial before time-out. The trial should be terminated at any point before NFrame completion, where any movement of the mouse makes the cursor appear. When the left click takes place, the data logger records the coordinates and a new trial can begin.
I have defined the target in the script as TC (when it is present in the array) or as DS (when it is absent, and all objects are then the same colour). In the resulting data file, the xy coordinates of all the stimulus objects in the array are provided. Would you know: (i) whether the target is always assigned the same same object number in the data file (e.g., Stim1)? and (ii) whether those xy coordinates refer to the starting positions of the objects, or their positions at the end of the sequence?
Many thanks in advance! You can access the script at the link below (as I can't get the embed function to work)...
https://gist.github.com/anonymous/a29b67a3a125bbe35c4ff9e8fe60b717