Dynamic Positioning of Response Options


Author
Message
jmaram
jmaram
New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)New Member (4 reputation)
Group: Forum Members
Posts: 1, Visits: 17
Hello!

We are designing a task where a user selects a location (1–4), receives new information, and then continues choosing until they reach a final outcome. Each location corresponds to a single trial, and based on their choice, they branch to a different trial.

I would like to randomize the order of the four location options across trials (e.g., sometimes displayed as locations 1 3 5 7, other times as 3 5 7 1, etc.). However, it seems that each position requires manually defining text elements with specific x and y coordinates. Instead of hardcoding every possible combination (a text element describing location 1 at position 1, location 1 at position 2, location 1 at position 3, etc), is there a way to dynamically assign location labels to predefined positions within a trial? There are 20 possible locations and 4 possible positions on the screen, and within a trial, I would like to ideally only set the order of locations.

Any guidance for further efficiency is greatly appreciated! Thank you!
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 106K
jmaram - 3/31/2025
Hello!

We are designing a task where a user selects a location (1–4), receives new information, and then continues choosing until they reach a final outcome. Each location corresponds to a single trial, and based on their choice, they branch to a different trial.

I would like to randomize the order of the four location options across trials (e.g., sometimes displayed as locations 1 3 5 7, other times as 3 5 7 1, etc.). However, it seems that each position requires manually defining text elements with specific x and y coordinates. Instead of hardcoding every possible combination (a text element describing location 1 at position 1, location 1 at position 2, location 1 at position 3, etc), is there a way to dynamically assign location labels to predefined positions within a trial? There are 20 possible locations and 4 possible positions on the screen, and within a trial, I would like to ideally only set the order of locations.

Any guidance for further efficiency is greatly appreciated! Thank you!

Position attributes take variables and you can assign these dynamically as needed, e.g. sampling x/y coordinates from lists /ontrialbegin.

<list x>
/ items = (
    20%, 40%, 60%, 80%,
    20%, 40%, 60%, 80%
)
/ selectionrate = always
</list>

<list y>
/ items = (
    45%, 45%, 45%, 45%,
    55%, 55%, 55%, 55%
)
/ selectionrate = always
/ selectionmode = list.x.currentIndex
</list>

<values>
/ aX = 0%
/ aY = 0%
/ bX = 0%
/ bY = 0%
/ cX = 0%
/ cY = 0%
/ dX = 0%
/ dY = 0%
</values>

<text a>
/ items = ("A")
/ hPosition = values.aX
/ vPosition = values.aY
/ erase = false
</text>

<text b>
/ items = ("B")
/ hPosition = values.bX
/ vPosition = values.bY
/ erase = false
</text>

<text c>
/ items = ("C")
/ hPosition = values.cX
/ vPosition = values.cY
/ erase = false
</text>

<text d>
/ items = ("D")
/ hPosition = values.dX
/ vPosition = values.dY
/ erase = false
</text>

<trial exampleTrial>
/ ontrialbegin = [
    list.x.reset();
    values.aX = list.x.nextValue;
    values.aY = list.y.nextValue;
    values.bX = list.x.nextValue;
    values.bY = list.y.nextValue;
    values.cX = list.x.nextValue;
    values.cY = list.y.nextValue;
    values.dX = list.x.nextValue;
    values.dY = list.y.nextValue;
]
/ stimulusFrames = [1=clearscreen, a, b, c, d]
/ inputDevice = mouse
/ validresponse = (a, b, c, d)
</trial>

<block exampleBlock>
/ trials = [1-4 = exampleTrial]
</block>

You can find numerous other examples of this by searching the forum.

Edited 2 days ago @ 11:07 AM by Dave
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search