Millisecond Forums

Placeholder, variable, dynamic programming?

https://forums.millisecond.com/Topic14849.aspx

By Ziu - 11/3/2014

Hi!
I am completly new on Inquisit and just on the way to findout how it works. For a project I am looking for some sort of variable i’m ableto define in relation to it’s contend.

The initial situation:
I have a few categories. Each of them contains a finitenumber of pictures. I’d like to generate the following result:
                Arandomly selectet picture out oft the randomly selected category should beshown on the screen (eg. picture 5 is selected randomly. Picture 5 should thenbe used in the trial as „p01“. So I just have to say „in trail 1 use P01 on thefirst position, p02 on the second, and so on“. p01 is just a placeholder for arandomly selected item. In a second step I tell Inquisit how it gets a item forp01.)
                Thesame picture (p01) should be shown on the next screen again along with another newrandom picture (p02) out oft the same category.
                On the following screen a new third picture (p03) should beshown.
                And so on…
After this trial another category out of the remaining ones(not the one already used) should be used randomly in a similar way. Then athird one and so on. After all categories are shown it starts again with categoryone in a similar way (the previously randomly generated order of categories should repeat) , but this time the remaining pictures out of category one areused (wich where not used in the first trial).
What I need is a variable or anything like that (a placeholder),whoose contend can be defined and filled by the program during the experiment. TherebyI should be able to define what happens during the experiment and which itemsare seen again without knowing wich specific items will be used in a certaincase.

The result I like to archieve I’d express in pseudocode likethat:
                Selectone category randomly (eg. „Category 3“).
                Usethis category (category 3) as category_01 (eg. „use category_01“; „category_01= random selection out of all categories“. If thats possible the number shouldbe given automatically, so that I only need to say „category_XY“, and define XYstarts with 01 for the first trial, 02 for the second and so on)
                Selectrandomly one item out of category_01 (eg. Picture 5) and call it p01
                Show p01on the screen
                Change screen
                Select randomlyanother picture out of category_01 and call it p02.
                Show p01randomly left or right and show on the other position p02.
                Change screenand show another random item called p03.
                And soon.
After all items have been shown, specific items should be shown again. Eg. Thefirst shown picture or the fifth shown picture should be shown again. So theprogram has to remember wich item was p05 till the end.
It is important, that everything is random, so I can‘t sayeg. trial one uses category 3. Same with the items. But it’s necessary to saywich randomly selected items have to be shown again during specific events inthe experiment.

For help in this case i would be very grateful!
By Dave - 11/3/2014

Start with something like this

<block myblock>
/ trials = [1-6=sequence(trial1, trial2, trial3)]
</block>

*** select category, display 1st stimulus ***
<trial trial1>
/ ontrialbegin = [values.t01hpos=50%]
/ ontrialbegin = [if(list.categorylist.unselectedcount>0) {values.selectedcategory=list.categorylist.nextvalue;
    list.categoryrepeatlist.appenditem(values.selectedcategory); }
    else values.selectedcategory=list.categoryrepeatlist.nextvalue]
/ ontrialbegin = [if (values.selectedcategory==1) {
    values.t01item=list.cat1itemlist.nextvalue;
    values.t02item=list.cat1itemlist.nextvalue;
    values.t03item=list.cat1itemlist.nextvalue;
    }]
/ ontrialbegin = [if (values.selectedcategory==2) {
    values.t01item=list.cat2itemlist.nextvalue;
    values.t02item=list.cat2itemlist.nextvalue;
    values.t03item=list.cat2itemlist.nextvalue;
    }]
/ ontrialbegin = [if (values.selectedcategory==3) {
    values.t01item=list.cat3itemlist.nextvalue;
    values.t02item=list.cat3itemlist.nextvalue;
    values.t03item=list.cat3itemlist.nextvalue;
    }]
/ stimulusframes = [1=t01]
/ validresponse = (57)
</trial>

*** display 1st and 2nd stimulus ***
<trial trial2>
/ ontrialbegin = [values.t01hpos=list.2poslist.nextvalue;
    values.t02hpos=list.2poslist.nextvalue; ]
/ stimulusframes = [1=t01, t02]
/ validresponse = (57)
</trial>

*** display 1st, 2nd and 3rd stimulus ***
<trial trial3>
/ ontrialbegin = [values.t01hpos=list.3poslist.nextvalue;
    values.t02hpos=list.3poslist.nextvalue;
    values.t03hpos=list.3poslist.nextvalue; ]
/ stimulusframes = [1=t01, t02, t03]
/ validresponse = (57)
</trial>

*** Some global variables for currently selected category, selected items and positions ***
<values>
/ selectedcategory = 0
/ t01item = 1
/ t02item = 1
/ t03item = 1
/ t01hpos = 50%
/ t02hpos = 50%
/ t03hpos = 50%
</values>

*** 3 categories / selected at random ***
<list categorylist>
/ items = (1,2,3)
</list>

*** store initial random order of categories for later repetition ***
<list categoryrepeatlist>
/ selectionmode = sequence
</list>

*** item numbers for 6 items in category 1 ***
<list cat1itemlist>
/ items = (1,2,3,4,5,6)
/ selectionrate = always
</list>

*** item numbers for 6 items in category 2 ***
<list cat2itemlist>
/ items = (7,8,9,10,11,12)
/ selectionrate = always
</list>

*** item numbers for 6 items in category 3 ***
<list cat3itemlist>
/ items = (13,14,15,16,17,18)
/ selectionrate = always
</list>

*** random left / right position ***
<list 2poslist>
/ items = (40%, 60%)
/ selectionrate = always
</list>

*** random left / middle / right position  ***
<list 3poslist>
/ items = (30%, 50%, 70%)
/ selectionrate = always
</list>

<text t01>
/ items = myitems
/ select = values.t01item
/ hposition = values.t01hpos
</text>

<text t02>
/ items = myitems
/ select = values.t02item
/ hposition = values.t02hpos
</text>

<text t03>
/ items = myitems
/ select = values.t03item
/ hposition = values.t03hpos
</text>

<item myitems>
/ 1 = "Category 1 Item 1"
/ 2 = "Category 1 Item 2"
/ 3 = "Category 1 Item 3"
/ 4 = "Category 1 Item 4"
/ 5 = "Category 1 Item 5"
/ 6 = "Category 1 Item 6"

/ 7 = "Category 2 Item 1"
/ 8 = "Category 2 Item 2"
/ 9 = "Category 2 Item 3"
/ 10 = "Category 2 Item 4"
/ 11 = "Category 2 Item 5"
/ 12 = "Category 2 Item 6"

/ 13 = "Category 3 Item 1"
/ 14 = "Category 3 Item 2"
/ 15 = "Category 3 Item 3"
/ 16 = "Category 3 Item 4"
/ 17 = "Category 3 Item 5"
/ 18 = "Category 3 Item 6"
</item>


and build / extend from there. I would recommend (1) working through the tutorials and the how-to section in the documentation for the basics, (2) study the topics on conditional logic, functions, operators, <values> and <expressions>, (3) familiarize yourself with <list> elements, their properties and functions via the applicable language reference topics.

In addition, perhaps pick out a couple of scripts from the task / test library to study to see the things mentioned above in practical use.
By Ziuc - 11/6/2014

Hi Dave!
Thank you very much for your response. It helped me a lot! Especially understanding how Inquisit works!