Search the Legacy Support Archive (up to v2020)
  1. Read-only archive (2005–2024). Posting is closed. Need help with MediaLab or DirectRT 2027? Email service@empirisoft.com.

    All words · “exact phrase” · -leave out

    Advanced search

Placing an Image in a Random location from a set of possible locations?

  1. #1

    Placing an Image in a Random location from a set of possible locations?

    I want an image to appear in one of several pre-mediated positions. (positions that are an equal distance from a place of focus)

    So I want to place the image in a random place, amongst a selection.

    however, 'loc' requires that x and y coordinates are entered seperately.
    I tried using the rand function for a selection of x,y values, looking like this:

    loc:
    rand((x,y),(x2,y2),(x3,y3)),1

    But that did not work.

    Will I have to make a different stimulus for every different position, and then randomly cycle through the stimuli? considering that multiple combinations of images must appear on each trial, this is looking impractical?

    surely there is a way to place objects in a random position out of a selection? It says that the rand() function can be used to place objects in random places, but there is no other information available on this topic?

  2. #2
    My second Location problem involves placing an object in the same place as another object.

    So, say object 1 appears at x,y (a randomly generated position), and I want object 2 to appear at the same place,

    how do I tell it to use the same position as was used before?

  3. #3
    * Note that the features below have been added to DirectRT v2010 (including the beta) and are not active in v2008 and prior versions. For a related solution for use in v2006 and subsequent versions, see http://www.empirisoft.com/support/showthread.php?t=4734

    ----------------------

    The functionality of the 'rand()' feature is now extended. As you've noted, the following syntax does not work: rand((x,y),(x2,y2),(x3,y3)),1
    This error arises due to the fact that the software can't quite figure out how to split the values up. The software would parse the above text normally by using the comma as an identifier. If the software were to do so in a scenario for the input you've provided, you would split up the above choices in the following way: '(x' , 'y)' , '(x2' , 'y2)' , '(x3' , 'y3)' - This wouldn't be too helpful.

    To remedy this problem, I've made it so that commas you don't want parsed can be identified by using the following: '' (not ")
    For example, you would be able to present the desired syntax above as: rand((x''y),(x2''y2),(x3''y3)),1 - rather than - rand((x,y),(x2,y2),(x3,y3)),1

    Next, I worked on the second issue. Your second issue noted that you want to be able to use the same rand() values that have previously been generated. This can now be done by using the new 'write' and 'read' syntax. Let's say you have the following: rand(1,2,3,4)
    If you want the result of this operation stored, simply write something such as: rand(write:Capulet|1,2,3,4)

    The value 'Capulet' is a variable that you've created. This variable can have any name. The above function selects a random value out of the four listed above, and then writes that value to both the experiment and the variable 'Capulet'. The variable 'Capulet' can be re-read at any time by using the following syntax: rand(read:Capulet) . Rather than creating a new random value, this will simply make a pointer to our variable 'Capulet' and use the value that is stored within. Both read and write values can be located anywhere within the spreadsheet. You can read a variable even if it's located further down in the experiment.

    Please let me know if you have any additional questions or if I can help in any way.

  4. #4
    Please note that these features are not active in any version of DirectRT.