Randomly select object locations


Author
Message
eeberts525
eeberts525
New Member (12 reputation)New Member (12 reputation)New Member (12 reputation)New Member (12 reputation)New Member (12 reputation)New Member (12 reputation)New Member (12 reputation)New Member (12 reputation)New Member (12 reputation)
Group: Forum Members
Posts: 4, Visits: 20
Hi,

I am trying to randomly select the horizontal position on the screen for 4 pictures (target, foil1, lure, foil2). I have predefined 4 positions and want each picture to be in one unique position (so that no two pictures are on the same spot) on every trial. I am using the counter element to select one location for each picture, and it is working on most trials, such that each picture is in its own position with no overlap, but on some trials two of the pictures will be on the exact same horizontal position.

I have pasted some of my code below, and I really appreciate any advice on solving this!

Thanks,
Elizabeth

<counter location1>
/items = (13%, 38%, 63%, 88%)
/not = (location2, location3, location4)
/select = noreplace
/selectionrate = always
</counter>

<counter location2>
/items = (13%, 38%, 63%, 88%)
/not = (location1, location3, location4)
/select = noreplace
/selectionrate = always
</counter>

<counter location3>
/items = (13%, 38%, 63%, 88%)
/not = (location1, location2, location4)
/select = noreplace
/selectionrate = always
</counter>

<counter location4>
/items = (13%, 38%, 63%, 88%)
/not = (location1, location2, location3)
/select = noreplace
/selectionrate = always
</counter>

<picture target>
/items = target
/vposition = 70%
/hposition = counter.location1.selectedvalue
/size = (20%,20%)
/select = sequence
</picture>

<picture foil1>
/items = foil1
/vposition = 70%
/hposition = counter.location2.selectedvalue
/size = (20%,20%)
/select = sequence
</picture>

<picture lure>
/items = lure
/vposition = 70%
/hposition = counter.location3.selectedvalue
/size = (20%,20%)
/select = sequence
</picture>

<picture foil2>
/items = foil2
/vposition = 70%
/hposition = counter.location4.selectedvalue
/size = (20%,20%)
/select = sequence
</picture>

<trial item>
/stimulustimes = [1 = fixation; 500 = clearscreen, test, target, foil1, lure, foil2, f, g, h, j]
/validresponse = ("f","g","h","j")
/ontrialend = [reset(counter.location1, counter.location2, counter.location3, counter.location4)]
</trial>

Dave
Dave
Supreme Being (818K reputation)Supreme Being (818K reputation)Supreme Being (818K reputation)Supreme Being (818K reputation)Supreme Being (818K reputation)Supreme Being (818K reputation)Supreme Being (818K reputation)Supreme Being (818K reputation)Supreme Being (818K reputation)
Group: Administrators
Posts: 10K, Visits: 57K
eeberts525 - 6/30/2020
Hi,

I am trying to randomly select the horizontal position on the screen for 4 pictures (target, foil1, lure, foil2). I have predefined 4 positions and want each picture to be in one unique position (so that no two pictures are on the same spot) on every trial. I am using the counter element to select one location for each picture, and it is working on most trials, such that each picture is in its own position with no overlap, but on some trials two of the pictures will be on the exact same horizontal position.

I have pasted some of my code below, and I really appreciate any advice on solving this!

Thanks,
Elizabeth

<counter location1>
/items = (13%, 38%, 63%, 88%)
/not = (location2, location3, location4)
/select = noreplace
/selectionrate = always
</counter>

<counter location2>
/items = (13%, 38%, 63%, 88%)
/not = (location1, location3, location4)
/select = noreplace
/selectionrate = always
</counter>

<counter location3>
/items = (13%, 38%, 63%, 88%)
/not = (location1, location2, location4)
/select = noreplace
/selectionrate = always
</counter>

<counter location4>
/items = (13%, 38%, 63%, 88%)
/not = (location1, location2, location3)
/select = noreplace
/selectionrate = always
</counter>

<picture target>
/items = target
/vposition = 70%
/hposition = counter.location1.selectedvalue
/size = (20%,20%)
/select = sequence
</picture>

<picture foil1>
/items = foil1
/vposition = 70%
/hposition = counter.location2.selectedvalue
/size = (20%,20%)
/select = sequence
</picture>

<picture lure>
/items = lure
/vposition = 70%
/hposition = counter.location3.selectedvalue
/size = (20%,20%)
/select = sequence
</picture>

<picture foil2>
/items = foil2
/vposition = 70%
/hposition = counter.location4.selectedvalue
/size = (20%,20%)
/select = sequence
</picture>

<trial item>
/stimulustimes = [1 = fixation; 500 = clearscreen, test, target, foil1, lure, foil2, f, g, h, j]
/validresponse = ("f","g","h","j")
/ontrialend = [reset(counter.location1, counter.location2, counter.location3, counter.location4)]
</trial>

Your approach is more complicated than it needs to be. All you should need is a single <list> element (<list>s are <counter> replacements, you should -- as a general matter -- not use <counter> anymore).

<values>
/ target_h = 0%
/ foil1_h = 0%
/ foil2_h = 0%
/ lure_h = 0%
</values>

<list locations>
/items = (13%, 38%, 63%, 88%)
/selectionrate = always
</list>

<picture target>
/items = target
/vposition = 70%
/hposition = values.target_h
/size = (20%,20%)
/select = sequence
</picture>

<picture foil1>
/items = foil1
/vposition = 70%
/hposition = values.foil1_h
/size = (20%,20%)
/select = sequence
</picture>

<picture lure>
/items = lure
/vposition = 70%
/hposition = values.lure_h
/size = (20%,20%)
/select = sequence
</picture>

<picture foil2>
/items = foil2
/vposition = 70%
/hposition = values.foil2_h
/size = (20%,20%)
/select = sequence
</picture>

<trial item>
/ ontrialbegin = [
    values.target_h = list.locations.nextvalue;
    values.foil1_h = list.locations.nextvalue;
    values.lure_h = list.locations.nextvalue;
    values.foil2_h = list.locations.nextvalue;
]
/stimulustimes = [1 = fixation; 500 = clearscreen, test, target, foil1, lure, foil2, f, g, h, j]
/validresponse = ("f","g","h","j")
</trial>


eeberts525
eeberts525
New Member (12 reputation)New Member (12 reputation)New Member (12 reputation)New Member (12 reputation)New Member (12 reputation)New Member (12 reputation)New Member (12 reputation)New Member (12 reputation)New Member (12 reputation)
Group: Forum Members
Posts: 4, Visits: 20
Dave - 6/30/2020
eeberts525 - 6/30/2020
Hi,

I am trying to randomly select the horizontal position on the screen for 4 pictures (target, foil1, lure, foil2). I have predefined 4 positions and want each picture to be in one unique position (so that no two pictures are on the same spot) on every trial. I am using the counter element to select one location for each picture, and it is working on most trials, such that each picture is in its own position with no overlap, but on some trials two of the pictures will be on the exact same horizontal position.

I have pasted some of my code below, and I really appreciate any advice on solving this!

Thanks,
Elizabeth

<counter location1>
/items = (13%, 38%, 63%, 88%)
/not = (location2, location3, location4)
/select = noreplace
/selectionrate = always
</counter>

<counter location2>
/items = (13%, 38%, 63%, 88%)
/not = (location1, location3, location4)
/select = noreplace
/selectionrate = always
</counter>

<counter location3>
/items = (13%, 38%, 63%, 88%)
/not = (location1, location2, location4)
/select = noreplace
/selectionrate = always
</counter>

<counter location4>
/items = (13%, 38%, 63%, 88%)
/not = (location1, location2, location3)
/select = noreplace
/selectionrate = always
</counter>

<picture target>
/items = target
/vposition = 70%
/hposition = counter.location1.selectedvalue
/size = (20%,20%)
/select = sequence
</picture>

<picture foil1>
/items = foil1
/vposition = 70%
/hposition = counter.location2.selectedvalue
/size = (20%,20%)
/select = sequence
</picture>

<picture lure>
/items = lure
/vposition = 70%
/hposition = counter.location3.selectedvalue
/size = (20%,20%)
/select = sequence
</picture>

<picture foil2>
/items = foil2
/vposition = 70%
/hposition = counter.location4.selectedvalue
/size = (20%,20%)
/select = sequence
</picture>

<trial item>
/stimulustimes = [1 = fixation; 500 = clearscreen, test, target, foil1, lure, foil2, f, g, h, j]
/validresponse = ("f","g","h","j")
/ontrialend = [reset(counter.location1, counter.location2, counter.location3, counter.location4)]
</trial>

Your approach is more complicated than it needs to be. All you should need is a single <list> element (<list>s are <counter> replacements, you should -- as a general matter -- not use <counter> anymore).

<values>
/ target_h = 0%
/ foil1_h = 0%
/ foil2_h = 0%
/ lure_h = 0%
</values>

<list locations>
/items = (13%, 38%, 63%, 88%)
/selectionrate = always
</list>

<picture target>
/items = target
/vposition = 70%
/hposition = values.target_h
/size = (20%,20%)
/select = sequence
</picture>

<picture foil1>
/items = foil1
/vposition = 70%
/hposition = values.foil1_h
/size = (20%,20%)
/select = sequence
</picture>

<picture lure>
/items = lure
/vposition = 70%
/hposition = values.lure_h
/size = (20%,20%)
/select = sequence
</picture>

<picture foil2>
/items = foil2
/vposition = 70%
/hposition = values.foil2_h
/size = (20%,20%)
/select = sequence
</picture>

<trial item>
/ ontrialbegin = [
    values.target_h = list.locations.nextvalue;
    values.foil1_h = list.locations.nextvalue;
    values.lure_h = list.locations.nextvalue;
    values.foil2_h = list.locations.nextvalue;
]
/stimulustimes = [1 = fixation; 500 = clearscreen, test, target, foil1, lure, foil2, f, g, h, j]
/validresponse = ("f","g","h","j")
</trial>


This works perfectly - thank you so much!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search