By nashby - 2/25/2015
So i have say this list: <list a2optiono1> / items = (70 100) </list>
And this counter: <counter a2option> / items = (1;2) / select = noreplace </counter>
How do I call list.a2optiono1.(x) where x is counter.a2option.currentvalue or nextvalue?
Thanks for any help.
|
By Dave - 2/25/2015
#1: You should not use a <counter> at all. Use only <list> elements. #2:
<values> / myvalue = 0 </values>
<list a2optiono1> / items = (70, 100) </list>
<list a2option> / items = (1, 2) </list>
<block myblock> / trials = [1-2=mytrial] </block>
<trial mytrial> / ontrialbegin = [values.myvalue=list.a2optiono1.item(list.a2option.nextvalue)] / stimulusframes = [1=mytext] / validresponse = (57) </trial>
<text mytext> / items = ("<%values.myvalue%>") </text>
(I admittedly have trouble seeing a realistic use case for this; it strikes me as unnecessarily complicated)
|
By nashby - 2/25/2015
I have an experiment with 16 buttons. Randomly assigned to each one of those buttons are 16 different gambles that have two outcomes that occur at different probabilities. What I really need is randomly matched arrays but I know inquisit cant do arrays.
|
By Dave - 2/25/2015
<list> elements are very much like arrays.
|
By nashby - 2/25/2015
I just cant figure it out. I need say an array list whatever that is (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16).
I then need to say shuffle that array so they arent in order. Then I need to grab position 1 and assign to several different things, then position 2 and assign that to several different things. How do I do this with a list or counter or anything?
|
By nashby - 2/25/2015
/ onblockbegin = [values.o1a = list.a2optiono1.(x1);values.o1b = list.a2optiono2.(x1);values.o2a = list.a2optiono1.(x2);values.o2b = list.a2optiono2.(x2); values.o1p = list.a2optionp.(x1); values.o2p = list.a2optionp.(x2); ]
So like above where I need each x1 or x2 or x16 to be a different number drawn from 1-16 without replacement.
|
By Dave - 2/25/2015
The /selectionmode is what "shuffles" your list. You can just pull out items randomly from it and assign.
<values> / a1 = 0 / a2 = 0 / b1 = 0 / b2 = 0 </values>
<block myblock> / trials = [1=mytrial] </block>
<list mylist> / poolsize = 16 / selectionmode = random / selectionrate = always </list>
<trial mytrial> / ontrialbegin = [values.a1=list.mylist.nextindex; values.a2=list.mylist.currentindex; values.b1=list.mylist.nextindex; values.b2=list.mylist.currentindex; ] / stimulusframes = [1=mytext] / validresponse = (57) </trial>
<text mytext> / items = ("<%values.a1%>, <%values.a2%>, <%values.b1%>, <%values.b2%>") </text>
Or you can "shuffle" the thing once, store that result in another list / array and then grab your values in order:
<block myblock> / onblockbegin = [list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex); list.mylist_shuffled.appenditem(list.mylist.nextindex); ] / trials = [1=mytrial] </block>
<list mylist> / poolsize = 16 / selectionmode = random / selectionrate = always </list>
<list mylist_shuffled> </list>
<trial mytrial> / stimulusframes = [1=mytext] / validresponse = (57) </trial>
<text mytext> / items = ("<%list.mylist_shuffled.item(1)%>, <%list.mylist_shuffled.item(2)%>, <%list.mylist_shuffled.item(3)%>, ...") </text>
It all depends on what exactly you want to do.
|
By nashby - 2/25/2015
So i can call something like List.xxx.item(<%list.mylist_shuffled.item(1)%>)? Doesnt seem to work?
|
By Dave - 2/25/2015
That's broken syntax. If you use proper syntax, that works just fine:
<list a> / items = ("C", "A", "B") </list>
<list b> / items = (1,2,3) </list>
<trial mytrial> / ontrialbegin = [values.myvalue = list.a.item(list.b.item(1))] / stimulusframes = [1=mytext] / validresponse = (57) </trial>
<text mytext> / items = ("<%values.myvalue%>") </text>
<values> / myvalue = "" </values>
|
By Dave - 2/25/2015
> / onblockbegin = [values.o1a = list.a2optiono1.(x1);values.o1b = list.a2optiono2.(x1);values.o2a = list.a2optiono1.(x2);values.o2b > = list.a2optiono2.(x2); values.o1p = list.a2optionp.(x1); values.o2p = list.a2optionp.(x2); ] > > So like above where I need each x1 or x2 or x16 to be a different number drawn from 1-16 without replacement.
See the 1st example I posted in my previous reply: https://www.millisecond.com/forums/FindPost15614.aspx
All you need is a single <list> with /selectionrate set to 'always'. nextindex forces a new selection, currentindex does not (same for nextvalue and currentvalue).
|
By nashby - 2/25/2015
But that doesnt assign that doesnt assign them randomly.I need position 1 to be a random item, not item 1 in the list.
Here is the bits of my experiment that should be relevant to understand what I am trying to do.
<list a2option> / items = (1 2) / selectionmode = random / selectionrate = always </list>
<list a2optiono1> / items = (70 100) </list>
<list a2optiono2> / items = (60 30) </list>
<list a2optionp> / items = (50 20) </list>
<trial mytrial2> / stimulusframes = [1= InPlay, LabelA, LabelB, O1, O2] / validresponse = (LabelA, LabelB) / inputdevice = mouse / ontrialend = [values.samples += 1] / ontrialbegin = [values.condition = 4] / ontrialbegin = [values.ran = round(rand(1,100))] / ontrialend = [ if (trial.mytrial2.response == "LabelA" && values.ran <= values.o1p) {values.outcome=(values.o1a); values.spicked = 0; }] / ontrialend = [ if (trial.mytrial2.response == "LabelA" && values.ran > values.o1p) {values.outcome=(values.o1b); values.spicked = 0; }] / ontrialend = [ if (trial.mytrial2.response == "LabelB" && values.ran <= values.o2p) {values.outcome=(values.o2a); values.spicked = 1; }] / ontrialend = [ if (trial.mytrial2.response == "LabelB" && values.ran > values.o2p){values.outcome=(values.o2b); values.spicked = 1; }] / ontrialend = [ if (trial.mytrial2.response == "LabelA") {text.o1.item.1=(values.outcome);text.o2.item.1=(" "); text.o3.item.1=(" "); text.o4.item.1=(" ");text.o5.item.1=(" ");text.o6.item.1=(" "); text.o7.item.1=(" "); text.o8.item.1=(" ");text.o9.item.1=(" "); text.o10.item.1=(" "); text.o11.item.1=(" ");text.o12.item.1=(" ");text.o13.item.1=(" "); text.o14.item.1=(" "); text.o15.item.1=(" "); text.o16.item.1=(" ");}] / ontrialend = [ if (trial.mytrial2.response == "LabelB") {text.o2.item.1=(values.outcome);text.o1.item.1=(" "); text.o3.item.1=(" "); text.o4.item.1=(" ");text.o5.item.1=(" ");text.o6.item.1=(" "); text.o7.item.1=(" "); text.o8.item.1=(" ");text.o9.item.1=(" "); text.o10.item.1=(" "); text.o11.item.1=(" ");text.o12.item.1=(" ");text.o13.item.1=(" "); text.o14.item.1=(" "); text.o15.item.1=(" "); text.o16.item.1=(" ");}] / ontrialend = [values.tot += values.outcome] </trial>
<block picking2> / trials = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101, 103,105,107,109,111,113,115,117,119,121,123,125,127,129,131,133,135,137,139,141,143,145,147,149,151,153,155,157,159,161,163,165,167,169,171,173,175,177,179,181, 183,185,187,189,191,193,195,197,199,201= mytrial2; 2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114, 116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196, 198,200,202= blank2;] / onblockbegin = [values.o1a = list.a2optiono1.item(list.a2option.item(1));values.o1b = list.a2optiono2.item(list.a2option.item(1));values.o2a = list.a2optiono1.item(list.a2option.item(2));values.o2b = list.a2optiono2.item(list.a2option.item(2)); values.o1p = list.a2optionp.item(list.a2option.item(1)); values.o2p = list.a2optionp.item(list.a2option.item(2)); ] </block>
|
By Dave - 2/25/2015
> But that doesnt assign that doesnt assign them randomly.I need position 1 to be a random item, not item 1 in the list.
Of course it does assign items randomly:
<values> / a1 = 0 / a2 = 0 / b1 = 0 / b2 = 0 </values>
<block myblock> / trials = [1=mytrial] </block>
<list mylist> / poolsize = 16 / selectionmode = random / selectionrate = always </list>
<trial mytrial> / ontrialbegin = [values.a1=list.mylist.nextindex; values.a2=list.mylist.currentindex; values.b1=list.mylist.nextindex; values.b2=list.mylist.currentindex; ] / stimulusframes = [1=mytext] / validresponse = (57) </trial>
<text mytext> / items = ("<%values.a1%>, <%values.a2%>, <%values.b1%>, <%values.b2%>") </text>
How is this not random?
|
By Dave - 2/25/2015
And to avoid any confusion, there is *no* need for operating with index values. It works the same with any type of item:
<values> / a1 = 0 / a2 = 0 / b1 = 0 / b2 = 0 </values>
<block myblock> / trials = [1=mytrial] </block>
<list mylist> / items = (0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100%) / selectionmode = random / selectionrate = always </list>
<trial mytrial> / ontrialbegin = [values.a1=list.mylist.nextvalue; values.a2=list.mylist.currentvalue; values.b1=list.mylist.nextvalue; values.b2=list.mylist.currentvalue; ] / stimulusframes = [1=mytext] / validresponse = (57) </trial>
<text mytext> / items = ("<%values.a1%>, <%values.a2%>, <%values.b1%>, <%values.b2%>") </text>
|
By nashby - 2/25/2015
Ok I get it now. I just hate inquist syntax its very counter intuitive :)
|
By nashby - 8/10/2015
So I am stuck again but with a different problem.
I have 16 locations that need to have 16 different pictures randomly assigned to them but I also have the 16 text descriptions of those pictures that need to be assigned to the correct picture. So whatever place Picture 1 ends up Text 1 needs to end up there as well, but again the where needs to be random.
I have tried everything I can think of (spent the last 4 days working on this one issue) but nothing is matching the text up with the proper picture and I keep getting repeats of text and pictures.
Can anyone show me a simple way to do this?
|
By Dave - 8/10/2015
For example:
<values> / location1item = 1 / location2item = 1 / location3item = 1 / location4item = 1 </values>
<block myblock> / trials = [1-4=mytrial] </block>
<trial mytrial> / ontrialbegin = [values.location1item=list.itemlist.nextindex; values.location2item=list.itemlist.nextindex; values.location3item=list.itemlist.nextindex; values.location4item=list.itemlist.nextindex; ] / ontrialend = [list.itemlist.reset(); ] / stimulusframes = [1=pic1, desc1, pic2, desc2, pic3, desc3, pic4, desc4] / validresponse = (57) </trial>
<text pic1> / items = picitems / select = values.location1item / position = (20%, 50%) </text>
<text pic2> / items = picitems / select = values.location2item / position = (40%, 50%) </text>
<text pic3> / items = picitems / select = values.location3item / position = (60%, 50%) </text>
<text pic4> / items = picitems / select = values.location4item / position = (80%, 50%) </text>
<text desc1> / items = descitems / select = values.location1item / position = (20%, 55%) </text>
<text desc2> / items = descitems / select = values.location2item / position = (40%, 55%) </text>
<text desc3> / items = descitems / select = values.location3item / position = (60%, 55%) </text>
<text desc4> / items = descitems / select = values.location4item / position = (80%, 55%) </text>
<item picitems> / 1 = "cat.jpg" / 2 = "dog.jpg" / 3 = "cow.jpg" / 4 = "bird.jpg" / 5 = "fish.jpg" </item>
<item descitems> / 1 = "A cute cat" / 2 = "A happy dog" / 3 = "A big cow" / 4 = "A colorful bird" / 5 = "An exotic fish" </item>
<list itemlist> / poolsize = 5 / selectionrate = always </list>
|
By Dave - 8/10/2015
You can also frame the problem differently and assign positions to objects: https://www.millisecond.com/forums/Topic5501.aspx
Instead of using a <counter> directly in /hposition and /vposition, I would recommend (1) the use of <list> instead of <counter> and (2) using <values> to store a given element's' position.
|
By nashby - 8/10/2015
As always thanks Dave got it working now.
|
|