Placing images randomly without collision and retrieving the position of one image dynamically


Placing images randomly without collision and retrieving the position...
Author
Message
patruvius
patruvius
Distinguished Member (5K reputation)Distinguished Member (5K reputation)Distinguished Member (5K reputation)Distinguished Member (5K reputation)Distinguished Member (5K reputation)Distinguished Member (5K reputation)Distinguished Member (5K reputation)Distinguished Member (5K reputation)Distinguished Member (5K reputation)
Group: Forum Members
Posts: 57, Visits: 1

I just thought Sir Dave had a nice ring to it.


Need your help again though when I really thought I was on clear water.


I need to place a target image (rather one of two over where  the X was in the first display. No problems.


Congruent images are placed over most recent position of X
Incongruent trials place the target images other than where X has last been positioned
Using list counters to position images in either congruent positions on non-congruent positions
*********************************************************
<item targets>
/1 = "target horizontal.png"
/2 = "target vertical.png"
</item>
<picture twotargets>
/items = targets
/select = twotargetscounter
/position = (type1xpos,type1ypos)
/erase = true(black)
/transparentcolor = (black)
</picture>


<list twotargetscounter>
/items = (1,2)
</list>



Then i need to place other distractor images  where the letters H, I, and T were but in no particuar arrangement as long as they don't land on the target image.


I have tried to use the picture.pic2.hposition etc to replace those positions with the new images and I have tried to use the original  counter , using counter.pics. selected values


eg.


<picture rightslash2>
/items =("Right 45 distracter.png")
/hposition = counter.type2xpos.selectedvalue
/vposition = counter.type2ypos.selectedvalue
</picture>


even using screen messages to try and match up these positions doesn't bear a relationship with the actual positions of the original H, T and I images.?


<text ipos>
/ items= (" I position = <% counter.type2xpos.selectedvalue %> ,<% counter.type2ypos.selectedvalue %>")
/ position = (20%,35%)
</text> or


<text ipos>
/ items= (" I position = <% picture.pic3.hposition %> ,<% picture.pic3.vposition %>")
/ position = (20%,35%)
</text>


nether gives reliable results.


Any ideas?



regards,


Vassal patrick


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: 12K, Visits: 98K

You should *not* reuse the 2nd counter. Its selection rate is set to 'always', i.e., every time you access it, a new sample will be drawn.


The code is too incomplete for me to say anything more specific about it. If you could assemble a minimal, runnable example (just enough to convey the core logic; please use <text> elements only, I don't have your picture files), I may be able to give you a more useful answer.


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: 12K, Visits: 98K

Then i need to place other distractor images  where the letters H, I, and T were but in no particuar arrangement as long as they don't land on the target image.


Note that this is exaclty the same as the initial question (placing a target, placing other elements excluding target position). I.e. the exact same solution applies:


<counter distractorxpos>
/ items = (25.0000%, 25.0001%, 75.0000%, 75.0001%)
/ select = noreplace
/ not = (type1xpos)
/ selectionrate = always
</counter>

<counter distractorypos>
/ items = (25.0000%, 75.0000%, 25.0000%, 75.0000%)
/ select = current(distractorxpos)
</counter>


with your 3 distractor elements getting their postiions from the above counters.


patruvius
patruvius
Distinguished Member (5K reputation)Distinguished Member (5K reputation)Distinguished Member (5K reputation)Distinguished Member (5K reputation)Distinguished Member (5K reputation)Distinguished Member (5K reputation)Distinguished Member (5K reputation)Distinguished Member (5K reputation)Distinguished Member (5K reputation)
Group: Forum Members
Posts: 57, Visits: 1

Dave,


below is the code of a text based stimulli.


What  happens with this is that the target or rather one of two targets always lands where the X was. So far so good.


Then I try placing one of the distractors - good, not on X but elsewhere.


Second distractor also good


Final distractor - clashes all over the place - on top of X or other distractors ????


<defaults>
/ screencolor = (0,0,0)
/ fontstyle = ("Arial", 30pt)
/ txcolor =  white
</defaults>

<block myblock>
/ trials = [1=mytrial]
</block>

<trial mytrial>
/ stimulustimes = [1= fixation,txt1,txt2,txt3,txt4 ;500=twotargets,distractor1,distractor2,distractor3]
/ validresponse = (anyresponse)
</trial>

<text fixation>
/ items = ("+")
/ erase = false
/ txbgcolor = black
</text>
<text txt1>
/ items = ("X")
/ txbgcolor = black
/ hposition = counter.type1xpos.selectedvalue
/ vposition = counter.type1ypos.selectedvalue
/ erase = true(black)
</text>
<text txt2>
/ items = ("H")
/ txbgcolor = black
/ hposition = counter.type2xpos.selectedvalue
/ vposition = counter.type2ypos.selectedvalue
/ erase = true(black)
</text>
<text txt3>
/ items = ("I")
/ txbgcolor = black
/ hposition = counter.type2xpos.selectedvalue
/ vposition = counter.type2ypos.selectedvalue
/ erase = true(black)
</text>
<text txt4>
/ items = ("T")
/ txbgcolor = black
/ hposition = counter.type2xpos.selectedvalue
/ vposition = counter.type2ypos.selectedvalue
/ erase = true(black)
</text>
<counter type1xpos>
/ items = (25.0000%, 25.0001%, 75.0000%, 75.0001%)
/ select = noreplace
</counter>
<counter type1ypos>
/ items = (25.0000%,75.0000%,25.0000%,75.0000%)
/ select = current(type1xpos)
</counter>
<counter type2xpos>
/ items = (25.0000%, 25.0001%, 75.0000%, 75.0001%)
/ not = (type1xpos)
/ select = noreplace
/ selectionrate = always
</counter>
<counter type2ypos>
/ items = (25.0000%, 75.0000%, 25.0000%, 75.0000%)
/ select = current(type2xpos)
/ selectionrate = always
</counter>
<counter type3xpos>
/ items = (25.0000%, 25.0001%,75.0000%,75.0001%)
/ not = (type1xpos,type2xpos)
/ select = noreplace
/ selectionrate = always
</counter>
<counter type3ypos>
/ items = (25.0000%, 75.0000%, 25.0000%, 75.0000%)
/ select = current(type3xpos)
/ selectionrate = always
</counter>
<counter type4xpos>
/ items = (25.0000%, 25.0001%,75.0000%,75.0001%)
/ not = (type1xpos,type2xpos,type3xpos)
/ select = noreplace
/ selectionrate = always
</counter>
<counter type4ypos>
/ items = (25.0000%, 75.0000%, 25.0000%, 75.0000%)
/ select = current(type3xpos)
/ selectionrate = always
</counter>
+++++++++++++++++++++++++++++++++++
target placement
+++++++++++++++++++++++++++++++++++

<item targets>
/1 = "|"
/2 = "-"
</item>
<text twotargets>
/items = targets
/ txbgcolor = black
/select = twotargetscounter
/position = (type1xpos,type1ypos)
/erase = true(black)
</text>
<list twotargetscounter>
/items = (1,2)
</list>
+++++++++++++++++++++++++++++++++
Distractor placement
+++++++++++++++++++++++++++++++++
<text distractor1>
/ items = ("/")
/ txcolor = red
/ txbgcolor = white
/select = distractorxpos
/ hposition = (counter.distractorxpos.selectedvalue)
/ vposition = (counter.distractorypos.selectedvalue)
</text>
<text distractor2>
/ items = ("/")
/ txcolor = black
/ txbgcolor = red
/select = distractorxpos2
/ hposition = (counter.distractorxpos.selectedvalue)
/ vposition = (counter.distractorypos.selectedvalue)
</text>
<text distractor3>
/ items = ("\")
/ txcolor = yellow
/ txbgcolor = green
/select = distractorxpos3
/ hposition = (counter.distractorxpos.selectedvalue)
/ vposition = (counter.distractorypos.selectedvalue)
</text>

<counter distractorxpos>
/ items = (25.0000,25.0001, 75.0000, 75.0001)
/ select = noreplace
/ not = (type1xpos)
/ selectionrate = always
</counter>
<counter distractorypos>
/ items = (25.0000%, 75.0000%,25.0000%,75.0000%)
/ select = current(distractorxpos)
</counter>
<counter distractorxpos2>
/ items = (25.0000,25.0001, 75.0000, 75.0001)
/ select = noreplace
/ not = (type1xpos,type2xpos)
/ selectionrate = always
</counter>
<counter distractorypos2>
/ items = (25.0000%, 75.0000%,25.0000%,75.0000%)
/ select = current(distractorxpos2)
</counter>
<counter distractorxpos3>
/ items = (25.0000,25.0001, 75.0000, 75.0001)
/ select = noreplace
/ not = (type1xpos,type2xpos,type3xpos)
/ selectionrate = always
</counter>
<counter distractorypos3>
/ items = (25.0000%, 75.0000%,25.0000%,75.0000%)
/ select = current(distractorxpos3)
</counter>


Note: with the /not property, i have tried using the other distractor positions to exclude,


eg /not = (type1xpos, distractorxpos, distractorxpos2) for no difference in results.


This is all for the congruent trials where the target will be positioned over the X, but in incongruent trials the target(s) must not sit over the X, and in specifying the position of the target as I have for the congruent trials there is no equivalent property of an element such as hposition = not(type1xpos) is there?


Thanks again Dave for sticking with me with this it is driving me particularly batty.


At present I am at a place with little cell phone and therefore mobile broadband connection, so I have had to  drive my car about 20km (sorry 15 miles) to another town where there is some connection.


The joys of country living in Australia.


Patrick



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: 12K, Visits: 98K

<counter type4ypos>
/ items = (25.0000%, 75.0000%, 25.0000%, 75.0000%)
/ select = current(type3xpos)
/ selectionrate = always
</counter>


Wrong dependency. You are also omitting the necessary reset() of certain counters /ontrialend. Please refer to my example for that.


patruvius
patruvius
Distinguished Member (5K reputation)Distinguished Member (5K reputation)Distinguished Member (5K reputation)Distinguished Member (5K reputation)Distinguished Member (5K reputation)Distinguished Member (5K reputation)Distinguished Member (5K reputation)Distinguished Member (5K reputation)Distinguished Member (5K reputation)
Group: Forum Members
Posts: 57, Visits: 1

Thank you, thank you Dave. I got this last night, drove home to try it and of course it works beautifully.


I now have all three components of the puzzle working - distractor, congruent (over X) and incongruent trials (not over X) working and can now possibly get back to my holiday.


I am very grateful as always. Inquisit would be impossible for me without you. I struggle for obvious intellectual deficits, but also because I only get asked occasionally for help with coding as most people here use pre-existing examples or simple questionnaire type applications.


I would like to do more and although I enjoy my interaction with Sir Dave, I would like to be more self reliant too.



cheers,



Patrick


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search