Question about random selecting stimuli


Author
Message
Kate61
Kate61
Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)
Group: Forum Members
Posts: 29, Visits: 56
Hi,
We are trying to write the code for a study, but we don't know how to realize our design (see below) in an appropriate way (i.e., without having to manually write all possible combinations which could be numerous). Any suggestion/comment/help is very much appreciated!

The design:
We have 4 types of stimuli, say A, B, C, and D. Each type contains 20 different pictures;
We also generated lots of different random locations (x, y combinations) that we want these pictures to appear on;

For each trial, we want to display certain numbers of total pictures (like from 10 to 20; to simplify this, we can also fix it to 14)--but can Inquisit realize the former way?
So N (A) + N (B) + N (C) + N (D) = 14, but these 4 numbers can be any possible combination that adds up to 14
Also, pictures selected (in each type) should be different; locations selected (across all types) should be different from each other

We are wondering whether we can realize this design in Inquisit 5 and how to do it. Thank you very much!

Best,
Kate
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
Kate61 - Saturday, November 18, 2017
Hi,
We are trying to write the code for a study, but we don't know how to realize our design (see below) in an appropriate way (i.e., without having to manually write all possible combinations which could be numerous). Any suggestion/comment/help is very much appreciated!

The design:
We have 4 types of stimuli, say A, B, C, and D. Each type contains 20 different pictures;
We also generated lots of different random locations (x, y combinations) that we want these pictures to appear on;

For each trial, we want to display certain numbers of total pictures (like from 10 to 20; to simplify this, we can also fix it to 14)--but can Inquisit realize the former way?
So N (A) + N (B) + N (C) + N (D) = 14, but these 4 numbers can be any possible combination that adds up to 14
Also, pictures selected (in each type) should be different; locations selected (across all types) should be different from each other

We are wondering whether we can realize this design in Inquisit 5 and how to do it. Thank you very much!

Best,
Kate

Sure. Put your picture elements in a <list> in the desired numbers (or sample with replacement). E.g.

<list picturestims>
/ items = (picture.a, picture.b, picture.c, picture.d)
/ replace = true
/ selectionrate = always
</list>

Then just sample the amount of pictures you wish to display in the <trial> /ontrialbegin:

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
...
</trial>

The above will sample 14 random picture stimuli from the <list> -- it could be any number of "a", "b", "c", or "d" -- and the trial will display them.

Kate61
Kate61
Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)
Group: Forum Members
Posts: 29, Visits: 56
Dave - Monday, November 20, 2017
Kate61 - Saturday, November 18, 2017
Hi,
We are trying to write the code for a study, but we don't know how to realize our design (see below) in an appropriate way (i.e., without having to manually write all possible combinations which could be numerous). Any suggestion/comment/help is very much appreciated!

The design:
We have 4 types of stimuli, say A, B, C, and D. Each type contains 20 different pictures;
We also generated lots of different random locations (x, y combinations) that we want these pictures to appear on;

For each trial, we want to display certain numbers of total pictures (like from 10 to 20; to simplify this, we can also fix it to 14)--but can Inquisit realize the former way?
So N (A) + N (B) + N (C) + N (D) = 14, but these 4 numbers can be any possible combination that adds up to 14
Also, pictures selected (in each type) should be different; locations selected (across all types) should be different from each other

We are wondering whether we can realize this design in Inquisit 5 and how to do it. Thank you very much!

Best,
Kate

Sure. Put your picture elements in a <list> in the desired numbers (or sample with replacement). E.g.

<list picturestims>
/ items = (picture.a, picture.b, picture.c, picture.d)
/ replace = true
/ selectionrate = always
</list>

Then just sample the amount of pictures you wish to display in the <trial> /ontrialbegin:

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
...
</trial>

The above will sample 14 random picture stimuli from the <list> -- it could be any number of "a", "b", "c", or "d" -- and the trial will display them.

Thank you for the answer, Dave! So with these codes we should be able to randomly select 14 pictures from the 4 types. But we are wondering how we can also control the parameters (e.g., if we want each display to have at least one picture from each type, and also record how many pictures from each type are selected in each trial). Also, where should we define location info so that those selected pictures don't collide with each other? (I ran an example file using the codes but it only showed me 4 pictures--seem like they are hiding beneath one another...)?

Thank you very much!
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
Kate61 - Monday, November 20, 2017
Dave - Monday, November 20, 2017
Kate61 - Saturday, November 18, 2017
Hi,
We are trying to write the code for a study, but we don't know how to realize our design (see below) in an appropriate way (i.e., without having to manually write all possible combinations which could be numerous). Any suggestion/comment/help is very much appreciated!

The design:
We have 4 types of stimuli, say A, B, C, and D. Each type contains 20 different pictures;
We also generated lots of different random locations (x, y combinations) that we want these pictures to appear on;

For each trial, we want to display certain numbers of total pictures (like from 10 to 20; to simplify this, we can also fix it to 14)--but can Inquisit realize the former way?
So N (A) + N (B) + N (C) + N (D) = 14, but these 4 numbers can be any possible combination that adds up to 14
Also, pictures selected (in each type) should be different; locations selected (across all types) should be different from each other

We are wondering whether we can realize this design in Inquisit 5 and how to do it. Thank you very much!

Best,
Kate

Sure. Put your picture elements in a <list> in the desired numbers (or sample with replacement). E.g.

<list picturestims>
/ items = (picture.a, picture.b, picture.c, picture.d)
/ replace = true
/ selectionrate = always
</list>

Then just sample the amount of pictures you wish to display in the <trial> /ontrialbegin:

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
...
</trial>

The above will sample 14 random picture stimuli from the <list> -- it could be any number of "a", "b", "c", or "d" -- and the trial will display them.

Thank you for the answer, Dave! So with these codes we should be able to randomly select 14 pictures from the 4 types. But we are wondering how we can also control the parameters (e.g., if we want each display to have at least one picture from each type, and also record how many pictures from each type are selected in each trial). Also, where should we define location info so that those selected pictures don't collide with each other? (I ran an example file using the codes but it only showed me 4 pictures--seem like they are hiding beneath one another...)?

Thank you very much!

This depends entirely on how you wish to set things up. To be clear: If you want the trial to display X stimulus objects there need to be at least X distinct stimulus objects. You cannot, in essence, display the same stimulus object twice or more and have it inhabit different positions or display different items.

This is probably easier if you were able to give me a concrete example of what exactly the end result is supposed to be. If possible, please produce a minimal condensed example (fewer items, fewer trials, etc.) that _includes_ all necessary features (the various positions, etc.) instead of providing relatively high-level descriptions that ultimately lack various wrinkles that. For example, This 

> But we are wondering how we can also control the parameters (e.g., if we want each display to have at least one picture from each type,
> and also record how many pictures from each type are selected in each trial)."

is not something you had mentioned before. So please spell out what precisely you need to control and how; those details matter, and even what may seem like only a minor add-on can make a huge difference regarding whether a certain implementation approach is viable or not.

Kate61
Kate61
Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)
Group: Forum Members
Posts: 29, Visits: 56
Dave - Monday, November 20, 2017
Kate61 - Monday, November 20, 2017
Dave - Monday, November 20, 2017
Kate61 - Saturday, November 18, 2017
Hi,
We are trying to write the code for a study, but we don't know how to realize our design (see below) in an appropriate way (i.e., without having to manually write all possible combinations which could be numerous). Any suggestion/comment/help is very much appreciated!

The design:
We have 4 types of stimuli, say A, B, C, and D. Each type contains 20 different pictures;
We also generated lots of different random locations (x, y combinations) that we want these pictures to appear on;

For each trial, we want to display certain numbers of total pictures (like from 10 to 20; to simplify this, we can also fix it to 14)--but can Inquisit realize the former way?
So N (A) + N (B) + N (C) + N (D) = 14, but these 4 numbers can be any possible combination that adds up to 14
Also, pictures selected (in each type) should be different; locations selected (across all types) should be different from each other

We are wondering whether we can realize this design in Inquisit 5 and how to do it. Thank you very much!

Best,
Kate

Sure. Put your picture elements in a <list> in the desired numbers (or sample with replacement). E.g.

<list picturestims>
/ items = (picture.a, picture.b, picture.c, picture.d)
/ replace = true
/ selectionrate = always
</list>

Then just sample the amount of pictures you wish to display in the <trial> /ontrialbegin:

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
...
</trial>

The above will sample 14 random picture stimuli from the <list> -- it could be any number of "a", "b", "c", or "d" -- and the trial will display them.

Thank you for the answer, Dave! So with these codes we should be able to randomly select 14 pictures from the 4 types. But we are wondering how we can also control the parameters (e.g., if we want each display to have at least one picture from each type, and also record how many pictures from each type are selected in each trial). Also, where should we define location info so that those selected pictures don't collide with each other? (I ran an example file using the codes but it only showed me 4 pictures--seem like they are hiding beneath one another...)?

Thank you very much!

This depends entirely on how you wish to set things up. To be clear: If you want the trial to display X stimulus objects there need to be at least X distinct stimulus objects. You cannot, in essence, display the same stimulus object twice or more and have it inhabit different positions or display different items.

This is probably easier if you were able to give me a concrete example of what exactly the end result is supposed to be. If possible, please produce a minimal condensed example (fewer items, fewer trials, etc.) that _includes_ all necessary features (the various positions, etc.) instead of providing relatively high-level descriptions that ultimately lack various wrinkles that. For example, This 

> But we are wondering how we can also control the parameters (e.g., if we want each display to have at least one picture from each type,
> and also record how many pictures from each type are selected in each trial)."

is not something you had mentioned before. So please spell out what precisely you need to control and how; those details matter, and even what may seem like only a minor add-on can make a huge difference regarding whether a certain implementation approach is viable or not.

Sorry for the confusion!
We think the end result we are hoping to get is: (for each trial)
1. randomly selecting 14 different pictures from 4 types of stimuli (at least one from each type)
2. each picture has a different location (randomly selecting from a set of x and y)
3. also record how many pictures from each type are selected 
4. before displaying the 14 pictures, a fixation cross followed by a blank screen will be shown

Here's an example:

Four different types of stimuli, 20 each:

<picture WM>
/items = ("WML1.jpg","WML2.jpg","WML3.jpg","WML4.jpg","WML5.jpg","WML6.jpg","WML7.jpg","WML8.jpg","WML9.jpg","WML10.jpg",
"WMH1.jpg","WMH2.jpg","WMH3.jpg","WMH4.jpg","WMH5.jpg","WMH6.jpg","WMH7.jpg","WMH8.jpg","WMH9.jpg","WMH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture WF>
/items = ("WFL1.jpg","WFL2.jpg","WFL3.jpg","WFL4.jpg","WFL5.jpg","WFL6.jpg","WFL7.jpg","WFL8.jpg","WFL9.jpg","WFL10.jpg",
"WFH1.jpg","WFH2.jpg","WFH3.jpg","WFH4.jpg","WFH5.jpg","WFH6.jpg","WFH7.jpg","WFH8.jpg","WFH9.jpg","WFH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture BM>
/items = ("BML1.jpg","BML2.jpg","BML3.jpg","BML4.jpg","BML5.jpg","BML6.jpg","BML7.jpg","BML8.jpg","BML9.jpg","BML10.jpg",
"BMH1.jpg","BMH2.jpg","BMH3.jpg","BMH4.jpg","BMH5.jpg","BMH6.jpg","BMH7.jpg","BMH8.jpg","BMH9.jpg","BMH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture BF>
/items = ("BFL1.jpg","BFL2.jpg","BFL3.jpg","BFL4.jpg","BFL5.jpg","BFL6.jpg","BFL7.jpg","BFL8.jpg","BFL9.jpg","BFL10.jpg",
"BFH1.jpg","BFH2.jpg","BFH3.jpg","BFH4.jpg","BFH5.jpg","BFH6.jpg","BFH7.jpg","BFH8.jpg","BFH9.jpg","BFH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

We also need to display a fixation "cross" sign and a blank screen before displaying the stimuli

<picture cross>
/items = ("cross.jpg")
/position = (50%, 50%)
</picture>

<shape blank>
/shape = rectangle
/size = (100%,100%)
/color = white
</shape>

Here are the random locations:

<counter faceXpos_grid>
/items = (9.7%,10.8%,10.05%,9.6%,10.5%,10.7%,9.5%,10.4%,10.8%,19.8%,19.74%,20.3%,19.3%,19.4%,20.4%,19.8%,20.26%,19.7%,30.8%,30.3%,29.1%,29.7%,29.1%,30.3%,29.4%,30.4%,29.2%,40.5%,39.8%,39.1%,40.7%,39.8%,40.5%,39.8%,39.5%,40.7%,
50.6%,49.6%,50.4%,49.7%,50.6%,49.4%,50.3%,50.8%,50.7%,60.8%,59.7%,60.7%,59.4%,60.6%,60.8%,59.2%,59.1%,60.3%,70.5%,69.6%,69.7%,70.7%,70.6%,70.3%,70.4%,70.7%,69.1%,80.2%,80.5%,79.7%,80.2%,80.8%,80.7%,79.2%,79.6%,79.8%,90.2%,89.8%,90.9%,90.2%,89.3%,90.8%,89.8%,89.1%,89.5%)
/select = noreplace
/selectionrate = always
</counter>

<counter faceYpos_grid>
/items = (9.8%, 20.5%, 30.8%, 39.2%, 50.9%, 60.3%, 69.1%, 80.6% 89.5%,10.6%, 20.2%, 30.9%, 40.6%, 49.2%, 59.2%, 70.6%, 79.5%, 89.6%, 9.5%, 19.1%, 29.7%, 40.4%, 50.2%, 59.7%, 70.8%, 80.5%, 90.3%, 9.2%, 19.5%, 29.1%, 39.8%, 50.2%, 60.2%, 70.3%, 79.3%, 89.1%,
9.2%, 19.7%, 30.1%, 40.8%, 49.93%, 60.7%, 70.3%, 79.4%, 89.1%, 9.1%, 20.6%, 30.2%, 39.8%, 50.2%, 59.2%, 70.6%, 79.2%, 90.3%, 10.4%, 20.4%, 30.8%, 39.8%, 50.4%, 60.2%, 70.2%, 79.5%, 89.3%, 10.2%, 20.8%, 30.8%, 40.2%, 49.3%, 59.7%, 70.2%, 79.7%, 89.2%, 9.5%, 20.7%, 29.4%, 39.5%, 49.8%, 59.2%, 70.2%, 80.2%, 90.8%)
/select = current(faceXpos_grid)
/selectionrate = always
</counter>

Here are the helpful codes you generated: (We added "stimulustimes" and other lines to match our design)

<list picturestims>
/ items = (picture.WM, picture.WF, picture.BM, picture.BF)
/ replace = true
/ selectionrate = always
</list>

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
/stimulustimes = [0=blank; 1=cross; 1250=blank; 2250=list.picturestims]
/ validresponse = (anyresponse)
/ ontrialend = [reset(counter.faceXpos_grid),reset(counter.faceYpos_grid)]
/timeout = 3250
</trial>

<block exampleblock>
/ trials = [1,2,3,4,5,6=example]

Hope these make sense! Thank you for the help!
Kate61
Kate61
Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)
Group: Forum Members
Posts: 29, Visits: 56
Kate61 - Monday, November 20, 2017
Dave - Monday, November 20, 2017
Kate61 - Monday, November 20, 2017
Dave - Monday, November 20, 2017
Kate61 - Saturday, November 18, 2017
Hi,
We are trying to write the code for a study, but we don't know how to realize our design (see below) in an appropriate way (i.e., without having to manually write all possible combinations which could be numerous). Any suggestion/comment/help is very much appreciated!

The design:
We have 4 types of stimuli, say A, B, C, and D. Each type contains 20 different pictures;
We also generated lots of different random locations (x, y combinations) that we want these pictures to appear on;

For each trial, we want to display certain numbers of total pictures (like from 10 to 20; to simplify this, we can also fix it to 14)--but can Inquisit realize the former way?
So N (A) + N (B) + N (C) + N (D) = 14, but these 4 numbers can be any possible combination that adds up to 14
Also, pictures selected (in each type) should be different; locations selected (across all types) should be different from each other

We are wondering whether we can realize this design in Inquisit 5 and how to do it. Thank you very much!

Best,
Kate

Sure. Put your picture elements in a <list> in the desired numbers (or sample with replacement). E.g.

<list picturestims>
/ items = (picture.a, picture.b, picture.c, picture.d)
/ replace = true
/ selectionrate = always
</list>

Then just sample the amount of pictures you wish to display in the <trial> /ontrialbegin:

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
...
</trial>

The above will sample 14 random picture stimuli from the <list> -- it could be any number of "a", "b", "c", or "d" -- and the trial will display them.

Thank you for the answer, Dave! So with these codes we should be able to randomly select 14 pictures from the 4 types. But we are wondering how we can also control the parameters (e.g., if we want each display to have at least one picture from each type, and also record how many pictures from each type are selected in each trial). Also, where should we define location info so that those selected pictures don't collide with each other? (I ran an example file using the codes but it only showed me 4 pictures--seem like they are hiding beneath one another...)?

Thank you very much!

This depends entirely on how you wish to set things up. To be clear: If you want the trial to display X stimulus objects there need to be at least X distinct stimulus objects. You cannot, in essence, display the same stimulus object twice or more and have it inhabit different positions or display different items.

This is probably easier if you were able to give me a concrete example of what exactly the end result is supposed to be. If possible, please produce a minimal condensed example (fewer items, fewer trials, etc.) that _includes_ all necessary features (the various positions, etc.) instead of providing relatively high-level descriptions that ultimately lack various wrinkles that. For example, This 

> But we are wondering how we can also control the parameters (e.g., if we want each display to have at least one picture from each type,
> and also record how many pictures from each type are selected in each trial)."

is not something you had mentioned before. So please spell out what precisely you need to control and how; those details matter, and even what may seem like only a minor add-on can make a huge difference regarding whether a certain implementation approach is viable or not.

Sorry for the confusion!
We think the end result we are hoping to get is: (for each trial)
1. randomly selecting 14 different pictures from 4 types of stimuli (at least one from each type)
2. each picture has a different location (randomly selecting from a set of x and y)
3. also record how many pictures from each type are selected 
4. before displaying the 14 pictures, a fixation cross followed by a blank screen will be shown

Here's an example:

Four different types of stimuli, 20 each:

<picture WM>
/items = ("WML1.jpg","WML2.jpg","WML3.jpg","WML4.jpg","WML5.jpg","WML6.jpg","WML7.jpg","WML8.jpg","WML9.jpg","WML10.jpg",
"WMH1.jpg","WMH2.jpg","WMH3.jpg","WMH4.jpg","WMH5.jpg","WMH6.jpg","WMH7.jpg","WMH8.jpg","WMH9.jpg","WMH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture WF>
/items = ("WFL1.jpg","WFL2.jpg","WFL3.jpg","WFL4.jpg","WFL5.jpg","WFL6.jpg","WFL7.jpg","WFL8.jpg","WFL9.jpg","WFL10.jpg",
"WFH1.jpg","WFH2.jpg","WFH3.jpg","WFH4.jpg","WFH5.jpg","WFH6.jpg","WFH7.jpg","WFH8.jpg","WFH9.jpg","WFH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture BM>
/items = ("BML1.jpg","BML2.jpg","BML3.jpg","BML4.jpg","BML5.jpg","BML6.jpg","BML7.jpg","BML8.jpg","BML9.jpg","BML10.jpg",
"BMH1.jpg","BMH2.jpg","BMH3.jpg","BMH4.jpg","BMH5.jpg","BMH6.jpg","BMH7.jpg","BMH8.jpg","BMH9.jpg","BMH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture BF>
/items = ("BFL1.jpg","BFL2.jpg","BFL3.jpg","BFL4.jpg","BFL5.jpg","BFL6.jpg","BFL7.jpg","BFL8.jpg","BFL9.jpg","BFL10.jpg",
"BFH1.jpg","BFH2.jpg","BFH3.jpg","BFH4.jpg","BFH5.jpg","BFH6.jpg","BFH7.jpg","BFH8.jpg","BFH9.jpg","BFH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

We also need to display a fixation "cross" sign and a blank screen before displaying the stimuli

<picture cross>
/items = ("cross.jpg")
/position = (50%, 50%)
</picture>

<shape blank>
/shape = rectangle
/size = (100%,100%)
/color = white
</shape>

Here are the random locations:

<counter faceXpos_grid>
/items = (9.7%,10.8%,10.05%,9.6%,10.5%,10.7%,9.5%,10.4%,10.8%,19.8%,19.74%,20.3%,19.3%,19.4%,20.4%,19.8%,20.26%,19.7%,30.8%,30.3%,29.1%,29.7%,29.1%,30.3%,29.4%,30.4%,29.2%,40.5%,39.8%,39.1%,40.7%,39.8%,40.5%,39.8%,39.5%,40.7%,
50.6%,49.6%,50.4%,49.7%,50.6%,49.4%,50.3%,50.8%,50.7%,60.8%,59.7%,60.7%,59.4%,60.6%,60.8%,59.2%,59.1%,60.3%,70.5%,69.6%,69.7%,70.7%,70.6%,70.3%,70.4%,70.7%,69.1%,80.2%,80.5%,79.7%,80.2%,80.8%,80.7%,79.2%,79.6%,79.8%,90.2%,89.8%,90.9%,90.2%,89.3%,90.8%,89.8%,89.1%,89.5%)
/select = noreplace
/selectionrate = always
</counter>

<counter faceYpos_grid>
/items = (9.8%, 20.5%, 30.8%, 39.2%, 50.9%, 60.3%, 69.1%, 80.6% 89.5%,10.6%, 20.2%, 30.9%, 40.6%, 49.2%, 59.2%, 70.6%, 79.5%, 89.6%, 9.5%, 19.1%, 29.7%, 40.4%, 50.2%, 59.7%, 70.8%, 80.5%, 90.3%, 9.2%, 19.5%, 29.1%, 39.8%, 50.2%, 60.2%, 70.3%, 79.3%, 89.1%,
9.2%, 19.7%, 30.1%, 40.8%, 49.93%, 60.7%, 70.3%, 79.4%, 89.1%, 9.1%, 20.6%, 30.2%, 39.8%, 50.2%, 59.2%, 70.6%, 79.2%, 90.3%, 10.4%, 20.4%, 30.8%, 39.8%, 50.4%, 60.2%, 70.2%, 79.5%, 89.3%, 10.2%, 20.8%, 30.8%, 40.2%, 49.3%, 59.7%, 70.2%, 79.7%, 89.2%, 9.5%, 20.7%, 29.4%, 39.5%, 49.8%, 59.2%, 70.2%, 80.2%, 90.8%)
/select = current(faceXpos_grid)
/selectionrate = always
</counter>

Here are the helpful codes you generated: (We added "stimulustimes" and other lines to match our design)

<list picturestims>
/ items = (picture.WM, picture.WF, picture.BM, picture.BF)
/ replace = true
/ selectionrate = always
</list>

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
/stimulustimes = [0=blank; 1=cross; 1250=blank; 2250=list.picturestims]
/ validresponse = (anyresponse)
/ ontrialend = [reset(counter.faceXpos_grid),reset(counter.faceYpos_grid)]
/timeout = 3250
</trial>

<block exampleblock>
/ trials = [1,2,3,4,5,6=example]

Hope these make sense! Thank you for the help!

This might be a better example (without pictures and more simplified)!

<text 1>
/items = ("1","2","3","4","5","6","7","8","9")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</text>

<text A>
/items = ("A","B","C"."D","E","F","G","H","I")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</text>

<picture cross>
/items = ("cross.jpg")
/position = (50%, 50%)
</picture>


<shape blank>
/shape = rectangle
/size = (100%,100%)
/color = white
</shape>

<counter faceXpos_grid>
/items = (9.7%,10.8%,10.05%,9.6%,10.5%,10.7%,9.5%,10.4%,10.8%,19.8%,19.74%,20.3%,19.3%,19.4%,20.4%,19.8%,20.26%,19.7%,30.8%,30.3%,29.1%,29.7%,29.1%,30.3%,29.4%,30.4%,29.2%,40.5%,39.8%,39.1%,40.7%,39.8%,40.5%,39.8%,39.5%,40.7%,
50.6%,49.6%,50.4%,49.7%,50.6%,49.4%,50.3%,50.8%,50.7%,60.8%,59.7%,60.7%,59.4%,60.6%,60.8%,59.2%,59.1%,60.3%,70.5%,69.6%,69.7%,70.7%,70.6%,70.3%,70.4%,70.7%,69.1%,80.2%,80.5%,79.7%,80.2%,80.8%,80.7%,79.2%,79.6%,79.8%,90.2%,89.8%,90.9%,90.2%,89.3%,90.8%,89.8%,89.1%,89.5%)
/select = noreplace
/selectionrate = always
</counter>

<counter faceYpos_grid>
/items = (9.8%, 20.5%, 30.8%, 39.2%, 50.9%, 60.3%, 69.1%, 80.6% 89.5%,10.6%, 20.2%, 30.9%, 40.6%, 49.2%, 59.2%, 70.6%, 79.5%, 89.6%, 9.5%, 19.1%, 29.7%, 40.4%, 50.2%, 59.7%, 70.8%, 80.5%, 90.3%, 9.2%, 19.5%, 29.1%, 39.8%, 50.2%, 60.2%, 70.3%, 79.3%, 89.1%,
9.2%, 19.7%, 30.1%, 40.8%, 49.93%, 60.7%, 70.3%, 79.4%, 89.1%, 9.1%, 20.6%, 30.2%, 39.8%, 50.2%, 59.2%, 70.6%, 79.2%, 90.3%, 10.4%, 20.4%, 30.8%, 39.8%, 50.4%, 60.2%, 70.2%, 79.5%, 89.3%, 10.2%, 20.8%, 30.8%, 40.2%, 49.3%, 59.7%, 70.2%, 79.7%, 89.2%, 9.5%, 20.7%, 29.4%, 39.5%, 49.8%, 59.2%, 70.2%, 80.2%, 90.8%)
/select = current(faceXpos_grid)
/selectionrate = alwayss
</counter>

<list picturestims>
/ items = (text.1,text.A)
/ replace = true
/ selectionrate = always
</list>

<list locations>
/ items = (counter.faceXpos_grid,counter.faceYpos_grid)
/ replace = true
/ selectionrate = always
</list>

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
/stimulustimes = [0=blank; 1=cross; 1250=blank; 2250=list.picturestims]
/ validresponse = (anyresponse)
/ ontrialend = [reset(counter.faceXpos_grid),reset(counter.faceYpos_grid)]
/timeout = 3250
</trial>

<block exampleblock>
/ trials = [1,2,3,4,5,6=example]



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
Kate61 - Monday, November 20, 2017
Kate61 - Monday, November 20, 2017
Dave - Monday, November 20, 2017
Kate61 - Monday, November 20, 2017
Dave - Monday, November 20, 2017
Kate61 - Saturday, November 18, 2017
Hi,
We are trying to write the code for a study, but we don't know how to realize our design (see below) in an appropriate way (i.e., without having to manually write all possible combinations which could be numerous). Any suggestion/comment/help is very much appreciated!

The design:
We have 4 types of stimuli, say A, B, C, and D. Each type contains 20 different pictures;
We also generated lots of different random locations (x, y combinations) that we want these pictures to appear on;

For each trial, we want to display certain numbers of total pictures (like from 10 to 20; to simplify this, we can also fix it to 14)--but can Inquisit realize the former way?
So N (A) + N (B) + N (C) + N (D) = 14, but these 4 numbers can be any possible combination that adds up to 14
Also, pictures selected (in each type) should be different; locations selected (across all types) should be different from each other

We are wondering whether we can realize this design in Inquisit 5 and how to do it. Thank you very much!

Best,
Kate

Sure. Put your picture elements in a <list> in the desired numbers (or sample with replacement). E.g.

<list picturestims>
/ items = (picture.a, picture.b, picture.c, picture.d)
/ replace = true
/ selectionrate = always
</list>

Then just sample the amount of pictures you wish to display in the <trial> /ontrialbegin:

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
...
</trial>

The above will sample 14 random picture stimuli from the <list> -- it could be any number of "a", "b", "c", or "d" -- and the trial will display them.

Thank you for the answer, Dave! So with these codes we should be able to randomly select 14 pictures from the 4 types. But we are wondering how we can also control the parameters (e.g., if we want each display to have at least one picture from each type, and also record how many pictures from each type are selected in each trial). Also, where should we define location info so that those selected pictures don't collide with each other? (I ran an example file using the codes but it only showed me 4 pictures--seem like they are hiding beneath one another...)?

Thank you very much!

This depends entirely on how you wish to set things up. To be clear: If you want the trial to display X stimulus objects there need to be at least X distinct stimulus objects. You cannot, in essence, display the same stimulus object twice or more and have it inhabit different positions or display different items.

This is probably easier if you were able to give me a concrete example of what exactly the end result is supposed to be. If possible, please produce a minimal condensed example (fewer items, fewer trials, etc.) that _includes_ all necessary features (the various positions, etc.) instead of providing relatively high-level descriptions that ultimately lack various wrinkles that. For example, This 

> But we are wondering how we can also control the parameters (e.g., if we want each display to have at least one picture from each type,
> and also record how many pictures from each type are selected in each trial)."

is not something you had mentioned before. So please spell out what precisely you need to control and how; those details matter, and even what may seem like only a minor add-on can make a huge difference regarding whether a certain implementation approach is viable or not.

Sorry for the confusion!
We think the end result we are hoping to get is: (for each trial)
1. randomly selecting 14 different pictures from 4 types of stimuli (at least one from each type)
2. each picture has a different location (randomly selecting from a set of x and y)
3. also record how many pictures from each type are selected 
4. before displaying the 14 pictures, a fixation cross followed by a blank screen will be shown

Here's an example:

Four different types of stimuli, 20 each:

<picture WM>
/items = ("WML1.jpg","WML2.jpg","WML3.jpg","WML4.jpg","WML5.jpg","WML6.jpg","WML7.jpg","WML8.jpg","WML9.jpg","WML10.jpg",
"WMH1.jpg","WMH2.jpg","WMH3.jpg","WMH4.jpg","WMH5.jpg","WMH6.jpg","WMH7.jpg","WMH8.jpg","WMH9.jpg","WMH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture WF>
/items = ("WFL1.jpg","WFL2.jpg","WFL3.jpg","WFL4.jpg","WFL5.jpg","WFL6.jpg","WFL7.jpg","WFL8.jpg","WFL9.jpg","WFL10.jpg",
"WFH1.jpg","WFH2.jpg","WFH3.jpg","WFH4.jpg","WFH5.jpg","WFH6.jpg","WFH7.jpg","WFH8.jpg","WFH9.jpg","WFH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture BM>
/items = ("BML1.jpg","BML2.jpg","BML3.jpg","BML4.jpg","BML5.jpg","BML6.jpg","BML7.jpg","BML8.jpg","BML9.jpg","BML10.jpg",
"BMH1.jpg","BMH2.jpg","BMH3.jpg","BMH4.jpg","BMH5.jpg","BMH6.jpg","BMH7.jpg","BMH8.jpg","BMH9.jpg","BMH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture BF>
/items = ("BFL1.jpg","BFL2.jpg","BFL3.jpg","BFL4.jpg","BFL5.jpg","BFL6.jpg","BFL7.jpg","BFL8.jpg","BFL9.jpg","BFL10.jpg",
"BFH1.jpg","BFH2.jpg","BFH3.jpg","BFH4.jpg","BFH5.jpg","BFH6.jpg","BFH7.jpg","BFH8.jpg","BFH9.jpg","BFH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

We also need to display a fixation "cross" sign and a blank screen before displaying the stimuli

<picture cross>
/items = ("cross.jpg")
/position = (50%, 50%)
</picture>

<shape blank>
/shape = rectangle
/size = (100%,100%)
/color = white
</shape>

Here are the random locations:

<counter faceXpos_grid>
/items = (9.7%,10.8%,10.05%,9.6%,10.5%,10.7%,9.5%,10.4%,10.8%,19.8%,19.74%,20.3%,19.3%,19.4%,20.4%,19.8%,20.26%,19.7%,30.8%,30.3%,29.1%,29.7%,29.1%,30.3%,29.4%,30.4%,29.2%,40.5%,39.8%,39.1%,40.7%,39.8%,40.5%,39.8%,39.5%,40.7%,
50.6%,49.6%,50.4%,49.7%,50.6%,49.4%,50.3%,50.8%,50.7%,60.8%,59.7%,60.7%,59.4%,60.6%,60.8%,59.2%,59.1%,60.3%,70.5%,69.6%,69.7%,70.7%,70.6%,70.3%,70.4%,70.7%,69.1%,80.2%,80.5%,79.7%,80.2%,80.8%,80.7%,79.2%,79.6%,79.8%,90.2%,89.8%,90.9%,90.2%,89.3%,90.8%,89.8%,89.1%,89.5%)
/select = noreplace
/selectionrate = always
</counter>

<counter faceYpos_grid>
/items = (9.8%, 20.5%, 30.8%, 39.2%, 50.9%, 60.3%, 69.1%, 80.6% 89.5%,10.6%, 20.2%, 30.9%, 40.6%, 49.2%, 59.2%, 70.6%, 79.5%, 89.6%, 9.5%, 19.1%, 29.7%, 40.4%, 50.2%, 59.7%, 70.8%, 80.5%, 90.3%, 9.2%, 19.5%, 29.1%, 39.8%, 50.2%, 60.2%, 70.3%, 79.3%, 89.1%,
9.2%, 19.7%, 30.1%, 40.8%, 49.93%, 60.7%, 70.3%, 79.4%, 89.1%, 9.1%, 20.6%, 30.2%, 39.8%, 50.2%, 59.2%, 70.6%, 79.2%, 90.3%, 10.4%, 20.4%, 30.8%, 39.8%, 50.4%, 60.2%, 70.2%, 79.5%, 89.3%, 10.2%, 20.8%, 30.8%, 40.2%, 49.3%, 59.7%, 70.2%, 79.7%, 89.2%, 9.5%, 20.7%, 29.4%, 39.5%, 49.8%, 59.2%, 70.2%, 80.2%, 90.8%)
/select = current(faceXpos_grid)
/selectionrate = always
</counter>

Here are the helpful codes you generated: (We added "stimulustimes" and other lines to match our design)

<list picturestims>
/ items = (picture.WM, picture.WF, picture.BM, picture.BF)
/ replace = true
/ selectionrate = always
</list>

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
/stimulustimes = [0=blank; 1=cross; 1250=blank; 2250=list.picturestims]
/ validresponse = (anyresponse)
/ ontrialend = [reset(counter.faceXpos_grid),reset(counter.faceYpos_grid)]
/timeout = 3250
</trial>

<block exampleblock>
/ trials = [1,2,3,4,5,6=example]

Hope these make sense! Thank you for the help!

This might be a better example (without pictures and more simplified)!

<text 1>
/items = ("1","2","3","4","5","6","7","8","9")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</text>

<text A>
/items = ("A","B","C"."D","E","F","G","H","I")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</text>

<picture cross>
/items = ("cross.jpg")
/position = (50%, 50%)
</picture>


<shape blank>
/shape = rectangle
/size = (100%,100%)
/color = white
</shape>

<counter faceXpos_grid>
/items = (9.7%,10.8%,10.05%,9.6%,10.5%,10.7%,9.5%,10.4%,10.8%,19.8%,19.74%,20.3%,19.3%,19.4%,20.4%,19.8%,20.26%,19.7%,30.8%,30.3%,29.1%,29.7%,29.1%,30.3%,29.4%,30.4%,29.2%,40.5%,39.8%,39.1%,40.7%,39.8%,40.5%,39.8%,39.5%,40.7%,
50.6%,49.6%,50.4%,49.7%,50.6%,49.4%,50.3%,50.8%,50.7%,60.8%,59.7%,60.7%,59.4%,60.6%,60.8%,59.2%,59.1%,60.3%,70.5%,69.6%,69.7%,70.7%,70.6%,70.3%,70.4%,70.7%,69.1%,80.2%,80.5%,79.7%,80.2%,80.8%,80.7%,79.2%,79.6%,79.8%,90.2%,89.8%,90.9%,90.2%,89.3%,90.8%,89.8%,89.1%,89.5%)
/select = noreplace
/selectionrate = always
</counter>

<counter faceYpos_grid>
/items = (9.8%, 20.5%, 30.8%, 39.2%, 50.9%, 60.3%, 69.1%, 80.6% 89.5%,10.6%, 20.2%, 30.9%, 40.6%, 49.2%, 59.2%, 70.6%, 79.5%, 89.6%, 9.5%, 19.1%, 29.7%, 40.4%, 50.2%, 59.7%, 70.8%, 80.5%, 90.3%, 9.2%, 19.5%, 29.1%, 39.8%, 50.2%, 60.2%, 70.3%, 79.3%, 89.1%,
9.2%, 19.7%, 30.1%, 40.8%, 49.93%, 60.7%, 70.3%, 79.4%, 89.1%, 9.1%, 20.6%, 30.2%, 39.8%, 50.2%, 59.2%, 70.6%, 79.2%, 90.3%, 10.4%, 20.4%, 30.8%, 39.8%, 50.4%, 60.2%, 70.2%, 79.5%, 89.3%, 10.2%, 20.8%, 30.8%, 40.2%, 49.3%, 59.7%, 70.2%, 79.7%, 89.2%, 9.5%, 20.7%, 29.4%, 39.5%, 49.8%, 59.2%, 70.2%, 80.2%, 90.8%)
/select = current(faceXpos_grid)
/selectionrate = alwayss
</counter>

<list picturestims>
/ items = (text.1,text.A)
/ replace = true
/ selectionrate = always
</list>

<list locations>
/ items = (counter.faceXpos_grid,counter.faceYpos_grid)
/ replace = true
/ selectionrate = always
</list>

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
/stimulustimes = [0=blank; 1=cross; 1250=blank; 2250=list.picturestims]
/ validresponse = (anyresponse)
/ ontrialend = [reset(counter.faceXpos_grid),reset(counter.faceYpos_grid)]
/timeout = 3250
</trial>

<block exampleblock>
/ trials = [1,2,3,4,5,6=example]



Thanks for the additional details -- in light of those details, I would advocate a different kind of approach. Ultimately, you need 14 <picture> elements if you want the trial to display 14 distinct objects on-screen. You can consider those 14 <picture> elements as neutral "slots" -- i.e. they are not tied to any particular stimulus category per se. You would use <list> elements to store the grid positions, and -- more importantly -- <list> elements holding the item numbers constituting the various stimulus "categories" "WM", WF", "BM", and "BF"). Then, in each trial you would assign (1) a grid position, and (2) an item number to each of the 14 neutral slots.

In a nutshell:


// items 1 to 20 are category WM
<list WM_itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
/ selectionrate = always
</list>

// items 21 to 40 are category WF
<list WF_itemnumbers>
/ items = (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40)
/ selectionrate = always
</list>

// items 41 to 60 are category BM
<list BM_itemnumbers>
/ items = (41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
/ selectionrate = always
</list>

// items 61 to 80 are category BF
<list BF_itemnumbers>
/ items = (61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80)
/ selectionrate = always
</list>

// fill the first four "slots" by sampling from this list
// to ensure that at least one item of each category is represented in each trial:
<list firstfour>
/ items = (list.WM_itemnumbers.nextvalue,list.WF_itemnumbers.nextvalue,list.BM_itemnumbers.nextvalue,list.BF_itemnumbers.nextvalue)
/ replace = false
/ selectionrate = always
</list>

// fill the remaining ten "slots" by sampling from this list
<list remainingten>
/ items = (list.WM_itemnumbers.nextvalue,list.WF_itemnumbers.nextvalue,list.BM_itemnumbers.nextvalue,list.BF_itemnumbers.nextvalue)
/ replace = true
/ selectionrate = always
</list>


<item allitems>
/ 1 = "WML1.jpg"
/ 2 = "WML2.jpg"
/ 3 = "WML3.jpg"
/ 4 = "WML4.jpg"
/ 5 = "WML5.jpg"
/ 6 = "WML6.jpg"
/ 7 = "WML7.jpg"
/ 8 = "WML8.jpg"
/ 9 = "WML9.jpg"
/ 10 = "WML10.jpg"
/ 11 = "WMH1.jpg"
/ 12 = "WMH2.jpg"
/ 13 = "WMH3.jpg"
/ 14 = "WMH4.jpg"
/ 15 = "WMH5.jpg"
/ 16 = "WMH6.jpg"
/ 17 = "WMH7.jpg"
/ 18 = "WMH8.jpg"
/ 19 = "WMH9.jpg"
/ 20 = "WMH10.jpg"

/ 21 = "WFL1.jpg"
/ 22 = "WFL2.jpg"
/ 23 = "WFL3.jpg"
/ 24 = "WFL4.jpg"
/ 25 = "WFL5.jpg"
/ 26 = "WFL6.jpg"
/ 27 = "WFL7.jpg"
/ 28 = "WFL8.jpg"
/ 29 = "WFL9.jpg"
/ 30 = "WFL10.jpg"
/ 31 = "WFH1.jpg"
/ 32 = "WFH2.jpg"
/ 33 = "WFH3.jpg"
/ 34 = "WFH4.jpg"
/ 35 = "WFH5.jpg"
/ 36 = "WFH6.jpg"
/ 37 = "WFH7.jpg"
/ 38 = "WFH8.jpg"
/ 39 = "WFH9.jpg"
/ 40 = "WFH10.jpg"

/ 41 = "BML1.jpg"
/ 42 = "BML2.jpg"
/ 43 = "BML3.jpg"
/ 44 = "BL4.jpg"
/ 45 = "BML5.jpg"
/ 46 = "BML6.jpg"
/ 47 = "BML7.jpg"
/ 48 = "BML8.jpg"
/ 49 = "BML9.jpg"
/ 50 = "BML10.jpg"
/ 51 = "BMH1.jpg"
/ 52 = "BMH2.jpg"
/ 53 = "BMH3.jpg"
/ 54 = "BMH4.jpg"
/ 55 = "BMH5.jpg"
/ 56 = "BMH6.jpg"
/ 57 = "BMH7.jpg"
/ 58 = "BMH8.jpg"
/ 59 = "BMH9.jpg"
/ 60 = "BMH10.jpg"

/ 61 = "BFL1.jpg"
/ 62 = "BFL2.jpg"
/ 63 = "BFL3.jpg"
/ 64 = "BF4.jpg"
/ 65 = "BFL5.jpg"
/ 66 = "BFL6.jpg"
/ 67 = "BFL7.jpg"
/ 68 = "BFL8.jpg"
/ 69 = "BFL9.jpg"
/ 60 = "BFL10.jpg"
/ 71 = "BFH1.jpg"
/ 72 = "BFH2.jpg"
/ 73 = "BFH3.jpg"
/ 74 = "BFH4.jpg"
/ 75 = "BFH5.jpg"
/ 76 = "BFH6.jpg"
/ 77 = "BFH7.jpg"
/ 78 = "BFH8.jpg"
/ 79 = "BFH9.jpg"
/ 80 = "BFH10.jpg"
</item>

//variables to store item numbers and positions assigned to each "slot"
<values>
/ slot_01_item = 1
/ slot_01_x = 0%
/ slot_01_y = 0%

/ slot_02_item = 1
/ slot_02_x = 0%
/ slot_02_y = 0%

/ slot_03_item = 1
/ slot_03_x = 0%
/ slot_03_y = 0%

/ slot_04_item = 1
/ slot_04_x = 0%
/ slot_04_y = 0%

/ slot_05_item = 1
/ slot_05_x = 0%
/ slot_05_y = 0%

/ slot_06_item = 1
/ slot_06_x = 0%
/ slot_06_y = 0%

/ slot_07_item = 1
/ slot_07_x = 0%
/ slot_07_y = 0%

/ slot_08_item = 1
/ slot_08_x = 0%
/ slot_08_y = 0%

/ slot_09_item = 1
/ slot_09_x = 0%
/ slot_09_y = 0%

/ slot_10_item = 1
/ slot_10_x = 0%
/ slot_10_y = 0%

/ slot_11_item = 1
/ slot_11_x = 0%
/ slot_11_y = 0%

/ slot_12_item = 1
/ slot_12_x = 0%
/ slot_12_y = 0%

/ slot_13_item = 1
/ slot_13_x = 0%
/ slot_13_y = 0%

/ slot_14_item = 1
/ slot_14_x = 0%
/ slot_14_y = 0%
</values>

// the generic slot stimulus objects:
<text slot_01>
/ items = allitems
/ select = values.slot_01_item
/ hposition = values.slot_01_x
/ vposition = values.slot_01_y
</text>

<text slot_02>
/ items = allitems
/ select = values.slot_02_item
/ hposition = values.slot_02_x
/ vposition = values.slot_02_y
</text>

<text slot_03>
/ items = allitems
/ select = values.slot_03_item
/ hposition = values.slot_03_x
/ vposition = values.slot_03_y
</text>

<text slot_04>
/ items = allitems
/ select = values.slot_04_item
/ hposition = values.slot_04_x
/ vposition = values.slot_04_y
</text>

<text slot_05>
/ items = allitems
/ select = values.slot_05_item
/ hposition = values.slot_05_x
/ vposition = values.slot_05_y
</text>

<text slot_06>
/ items = allitems
/ select = values.slot_06_item
/ hposition = values.slot_06_x
/ vposition = values.slot_06_y
</text>

<text slot_07>
/ items = allitems
/ select = values.slot_07_item
/ hposition = values.slot_07_x
/ vposition = values.slot_07_y
</text>

<text slot_08>
/ items = allitems
/ select = values.slot_08_item
/ hposition = values.slot_08_x
/ vposition = values.slot_08_y
</text>

<text slot_09>
/ items = allitems
/ select = values.slot_09_item
/ hposition = values.slot_09_x
/ vposition = values.slot_09_y
</text>

<text slot_10>
/ items = allitems
/ select = values.slot_10_item
/ hposition = values.slot_10_x
/ vposition = values.slot_10_y
</text>

<text slot_11>
/ items = allitems
/ select = values.slot_11_item
/ hposition = values.slot_11_x
/ vposition = values.slot_11_y
</text>

<text slot_12>
/ items = allitems
/ select = values.slot_12_item
/ hposition = values.slot_12_x
/ vposition = values.slot_12_y
</text>

<text slot_13>
/ items = allitems
/ select = values.slot_13_item
/ hposition = values.slot_13_x
/ vposition = values.slot_13_y
</text>

<text slot_14>
/ items = allitems
/ select = values.slot_14_item
/ hposition = values.slot_14_x
/ vposition = values.slot_14_y
</text>


<text cross>
/items = ("cross.jpg")
/position = (50%, 50%)
</text>

<shape blank>
/shape = rectangle
/size = (100%,100%)
/color = white
</shape>

// the positions grid:
<list faceXpos_grid>
/items = (9.7%,10.8%,10.05%,9.6%,10.5%,10.7%,9.5%,10.4%,10.8%,19.8%,19.74%,20.3%,19.3%,19.4%,20.4%,19.8%,20.26%,19.7%,30.8%,30.3%,29.1%,29.7%,29.1%,30.3%,29.4%,30.4%,29.2%,40.5%,39.8%,39.1%,40.7%,39.8%,40.5%,39.8%,39.5%,40.7%,
50.6%,49.6%,50.4%,49.7%,50.6%,49.4%,50.3%,50.8%,50.7%,60.8%,59.7%,60.7%,59.4%,60.6%,60.8%,59.2%,59.1%,60.3%,70.5%,69.6%,69.7%,70.7%,70.6%,70.3%,70.4%,70.7%,69.1%,80.2%,80.5%,79.7%,80.2%,80.8%,80.7%,79.2%,79.6%,79.8%,90.2%,89.8%,90.9%,90.2%,89.3%,90.8%,89.8%,89.1%,89.5%)
/ selectionmode = random
/ replace = false
/selectionrate = always
</list>

<list faceYpos_grid>
/items = (9.8%, 20.5%, 30.8%, 39.2%, 50.9%, 60.3%, 69.1%, 80.6% 89.5%,10.6%, 20.2%, 30.9%, 40.6%, 49.2%, 59.2%, 70.6%, 79.5%, 89.6%, 9.5%, 19.1%, 29.7%, 40.4%, 50.2%, 59.7%, 70.8%, 80.5%, 90.3%, 9.2%, 19.5%, 29.1%, 39.8%, 50.2%, 60.2%, 70.3%, 79.3%, 89.1%,
9.2%, 19.7%, 30.1%, 40.8%, 49.93%, 60.7%, 70.3%, 79.4%, 89.1%, 9.1%, 20.6%, 30.2%, 39.8%, 50.2%, 59.2%, 70.6%, 79.2%, 90.3%, 10.4%, 20.4%, 30.8%, 39.8%, 50.4%, 60.2%, 70.2%, 79.5%, 89.3%, 10.2%, 20.8%, 30.8%, 40.2%, 49.3%, 59.7%, 70.2%, 79.7%, 89.2%, 9.5%, 20.7%, 29.4%, 39.5%, 49.8%, 59.2%, 70.2%, 80.2%, 90.8%)
/ selectionmode = list.faceXpos_grid.currentindex
/selectionrate = always
</list>

// populate the stimulus slots with item numbers and assign a random position to each slot:
<trial example>
/ ontrialbegin = [
    values.slot_01_item = list.firstfour.nextvalue;
    values.slot_01_x = list.faceXpos_grid.nextvalue;
    values.slot_01_y = list.faceYpos_grid.nextvalue;
    values.slot_02_item = list.firstfour.nextvalue;
    values.slot_02_x = list.faceXpos_grid.nextvalue;
    values.slot_02_y = list.faceYpos_grid.nextvalue;
    values.slot_03_item = list.firstfour.nextvalue;
    values.slot_03_x = list.faceXpos_grid.nextvalue;
    values.slot_03_y = list.faceYpos_grid.nextvalue;
    values.slot_04_item = list.firstfour.nextvalue;
    values.slot_04_x = list.faceXpos_grid.nextvalue;
    values.slot_04_y = list.faceYpos_grid.nextvalue;

    values.slot_05_item = list.remainingten.nextvalue;
    values.slot_05_x = list.faceXpos_grid.nextvalue;
    values.slot_05_y = list.faceYpos_grid.nextvalue;
    values.slot_06_item = list.remainingten.nextvalue;
    values.slot_06_x = list.faceXpos_grid.nextvalue;
    values.slot_06_y = list.faceYpos_grid.nextvalue;
    values.slot_07_item = list.remainingten.nextvalue;
    values.slot_07_x = list.faceXpos_grid.nextvalue;
    values.slot_07_y = list.faceYpos_grid.nextvalue;
    values.slot_08_item = list.remainingten.nextvalue;
    values.slot_08_x = list.faceXpos_grid.nextvalue;
    values.slot_08_y = list.faceYpos_grid.nextvalue;
    values.slot_09_item = list.remainingten.nextvalue;
    values.slot_09_x = list.faceXpos_grid.nextvalue;
    values.slot_09_y = list.faceYpos_grid.nextvalue;
    values.slot_10_item = list.remainingten.nextvalue;
    values.slot_10_x = list.faceXpos_grid.nextvalue;
    values.slot_10_y = list.faceYpos_grid.nextvalue;
    values.slot_11_item = list.remainingten.nextvalue;
    values.slot_11_x = list.faceXpos_grid.nextvalue;
    values.slot_11_y = list.faceYpos_grid.nextvalue;
    values.slot_12_item = list.remainingten.nextvalue;
    values.slot_12_x = list.faceXpos_grid.nextvalue;
    values.slot_12_y = list.faceYpos_grid.nextvalue;
    values.slot_13_item = list.remainingten.nextvalue;
    values.slot_13_x = list.faceXpos_grid.nextvalue;
    values.slot_13_y = list.faceYpos_grid.nextvalue;
    values.slot_14_item = list.remainingten.nextvalue;
    values.slot_14_x = list.faceXpos_grid.nextvalue;
    values.slot_14_y = list.faceYpos_grid.nextvalue;
]
/ ontrialend = [
    list.faceXpos_grid.reset();
    list.faceYpos_grid.reset();
]
/stimulustimes = [0=blank, cross; 1250=blank;
    2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
    slot_08, slot_09, slot_10, slot_11, slot_12, slot_13, slot_14]
/ validresponse = (57)
</trial>

<block myblock>
/ trials = [1-4 = example]
</block>

You can determine the number of items from a given category that were shown during a given trial by logging and/or further processing the values.slot_01_item to values.slot_14_item variables.

I hope the above gives you the general idea.


Kate61
Kate61
Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)
Group: Forum Members
Posts: 29, Visits: 56
Dave - Monday, November 20, 2017
Kate61 - Monday, November 20, 2017
Kate61 - Monday, November 20, 2017
Dave - Monday, November 20, 2017
Kate61 - Monday, November 20, 2017
Dave - Monday, November 20, 2017
Kate61 - Saturday, November 18, 2017
Hi,
We are trying to write the code for a study, but we don't know how to realize our design (see below) in an appropriate way (i.e., without having to manually write all possible combinations which could be numerous). Any suggestion/comment/help is very much appreciated!

The design:
We have 4 types of stimuli, say A, B, C, and D. Each type contains 20 different pictures;
We also generated lots of different random locations (x, y combinations) that we want these pictures to appear on;

For each trial, we want to display certain numbers of total pictures (like from 10 to 20; to simplify this, we can also fix it to 14)--but can Inquisit realize the former way?
So N (A) + N (B) + N (C) + N (D) = 14, but these 4 numbers can be any possible combination that adds up to 14
Also, pictures selected (in each type) should be different; locations selected (across all types) should be different from each other

We are wondering whether we can realize this design in Inquisit 5 and how to do it. Thank you very much!

Best,
Kate

Sure. Put your picture elements in a <list> in the desired numbers (or sample with replacement). E.g.

<list picturestims>
/ items = (picture.a, picture.b, picture.c, picture.d)
/ replace = true
/ selectionrate = always
</list>

Then just sample the amount of pictures you wish to display in the <trial> /ontrialbegin:

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
...
</trial>

The above will sample 14 random picture stimuli from the <list> -- it could be any number of "a", "b", "c", or "d" -- and the trial will display them.

Thank you for the answer, Dave! So with these codes we should be able to randomly select 14 pictures from the 4 types. But we are wondering how we can also control the parameters (e.g., if we want each display to have at least one picture from each type, and also record how many pictures from each type are selected in each trial). Also, where should we define location info so that those selected pictures don't collide with each other? (I ran an example file using the codes but it only showed me 4 pictures--seem like they are hiding beneath one another...)?

Thank you very much!

This depends entirely on how you wish to set things up. To be clear: If you want the trial to display X stimulus objects there need to be at least X distinct stimulus objects. You cannot, in essence, display the same stimulus object twice or more and have it inhabit different positions or display different items.

This is probably easier if you were able to give me a concrete example of what exactly the end result is supposed to be. If possible, please produce a minimal condensed example (fewer items, fewer trials, etc.) that _includes_ all necessary features (the various positions, etc.) instead of providing relatively high-level descriptions that ultimately lack various wrinkles that. For example, This 

> But we are wondering how we can also control the parameters (e.g., if we want each display to have at least one picture from each type,
> and also record how many pictures from each type are selected in each trial)."

is not something you had mentioned before. So please spell out what precisely you need to control and how; those details matter, and even what may seem like only a minor add-on can make a huge difference regarding whether a certain implementation approach is viable or not.

Sorry for the confusion!
We think the end result we are hoping to get is: (for each trial)
1. randomly selecting 14 different pictures from 4 types of stimuli (at least one from each type)
2. each picture has a different location (randomly selecting from a set of x and y)
3. also record how many pictures from each type are selected 
4. before displaying the 14 pictures, a fixation cross followed by a blank screen will be shown

Here's an example:

Four different types of stimuli, 20 each:

<picture WM>
/items = ("WML1.jpg","WML2.jpg","WML3.jpg","WML4.jpg","WML5.jpg","WML6.jpg","WML7.jpg","WML8.jpg","WML9.jpg","WML10.jpg",
"WMH1.jpg","WMH2.jpg","WMH3.jpg","WMH4.jpg","WMH5.jpg","WMH6.jpg","WMH7.jpg","WMH8.jpg","WMH9.jpg","WMH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture WF>
/items = ("WFL1.jpg","WFL2.jpg","WFL3.jpg","WFL4.jpg","WFL5.jpg","WFL6.jpg","WFL7.jpg","WFL8.jpg","WFL9.jpg","WFL10.jpg",
"WFH1.jpg","WFH2.jpg","WFH3.jpg","WFH4.jpg","WFH5.jpg","WFH6.jpg","WFH7.jpg","WFH8.jpg","WFH9.jpg","WFH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture BM>
/items = ("BML1.jpg","BML2.jpg","BML3.jpg","BML4.jpg","BML5.jpg","BML6.jpg","BML7.jpg","BML8.jpg","BML9.jpg","BML10.jpg",
"BMH1.jpg","BMH2.jpg","BMH3.jpg","BMH4.jpg","BMH5.jpg","BMH6.jpg","BMH7.jpg","BMH8.jpg","BMH9.jpg","BMH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

<picture BF>
/items = ("BFL1.jpg","BFL2.jpg","BFL3.jpg","BFL4.jpg","BFL5.jpg","BFL6.jpg","BFL7.jpg","BFL8.jpg","BFL9.jpg","BFL10.jpg",
"BFH1.jpg","BFH2.jpg","BFH3.jpg","BFH4.jpg","BFH5.jpg","BFH6.jpg","BFH7.jpg","BFH8.jpg","BFH9.jpg","BFH10.jpg")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</picture>

We also need to display a fixation "cross" sign and a blank screen before displaying the stimuli

<picture cross>
/items = ("cross.jpg")
/position = (50%, 50%)
</picture>

<shape blank>
/shape = rectangle
/size = (100%,100%)
/color = white
</shape>

Here are the random locations:

<counter faceXpos_grid>
/items = (9.7%,10.8%,10.05%,9.6%,10.5%,10.7%,9.5%,10.4%,10.8%,19.8%,19.74%,20.3%,19.3%,19.4%,20.4%,19.8%,20.26%,19.7%,30.8%,30.3%,29.1%,29.7%,29.1%,30.3%,29.4%,30.4%,29.2%,40.5%,39.8%,39.1%,40.7%,39.8%,40.5%,39.8%,39.5%,40.7%,
50.6%,49.6%,50.4%,49.7%,50.6%,49.4%,50.3%,50.8%,50.7%,60.8%,59.7%,60.7%,59.4%,60.6%,60.8%,59.2%,59.1%,60.3%,70.5%,69.6%,69.7%,70.7%,70.6%,70.3%,70.4%,70.7%,69.1%,80.2%,80.5%,79.7%,80.2%,80.8%,80.7%,79.2%,79.6%,79.8%,90.2%,89.8%,90.9%,90.2%,89.3%,90.8%,89.8%,89.1%,89.5%)
/select = noreplace
/selectionrate = always
</counter>

<counter faceYpos_grid>
/items = (9.8%, 20.5%, 30.8%, 39.2%, 50.9%, 60.3%, 69.1%, 80.6% 89.5%,10.6%, 20.2%, 30.9%, 40.6%, 49.2%, 59.2%, 70.6%, 79.5%, 89.6%, 9.5%, 19.1%, 29.7%, 40.4%, 50.2%, 59.7%, 70.8%, 80.5%, 90.3%, 9.2%, 19.5%, 29.1%, 39.8%, 50.2%, 60.2%, 70.3%, 79.3%, 89.1%,
9.2%, 19.7%, 30.1%, 40.8%, 49.93%, 60.7%, 70.3%, 79.4%, 89.1%, 9.1%, 20.6%, 30.2%, 39.8%, 50.2%, 59.2%, 70.6%, 79.2%, 90.3%, 10.4%, 20.4%, 30.8%, 39.8%, 50.4%, 60.2%, 70.2%, 79.5%, 89.3%, 10.2%, 20.8%, 30.8%, 40.2%, 49.3%, 59.7%, 70.2%, 79.7%, 89.2%, 9.5%, 20.7%, 29.4%, 39.5%, 49.8%, 59.2%, 70.2%, 80.2%, 90.8%)
/select = current(faceXpos_grid)
/selectionrate = always
</counter>

Here are the helpful codes you generated: (We added "stimulustimes" and other lines to match our design)

<list picturestims>
/ items = (picture.WM, picture.WF, picture.BM, picture.BF)
/ replace = true
/ selectionrate = always
</list>

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
/stimulustimes = [0=blank; 1=cross; 1250=blank; 2250=list.picturestims]
/ validresponse = (anyresponse)
/ ontrialend = [reset(counter.faceXpos_grid),reset(counter.faceYpos_grid)]
/timeout = 3250
</trial>

<block exampleblock>
/ trials = [1,2,3,4,5,6=example]

Hope these make sense! Thank you for the help!

This might be a better example (without pictures and more simplified)!

<text 1>
/items = ("1","2","3","4","5","6","7","8","9")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</text>

<text A>
/items = ("A","B","C"."D","E","F","G","H","I")
/size = (10%,10%)
/vposition = counter.faceYpos_grid.selectedvalue
/hposition = counter.faceXpos_grid.selectedvalue
</text>

<picture cross>
/items = ("cross.jpg")
/position = (50%, 50%)
</picture>


<shape blank>
/shape = rectangle
/size = (100%,100%)
/color = white
</shape>

<counter faceXpos_grid>
/items = (9.7%,10.8%,10.05%,9.6%,10.5%,10.7%,9.5%,10.4%,10.8%,19.8%,19.74%,20.3%,19.3%,19.4%,20.4%,19.8%,20.26%,19.7%,30.8%,30.3%,29.1%,29.7%,29.1%,30.3%,29.4%,30.4%,29.2%,40.5%,39.8%,39.1%,40.7%,39.8%,40.5%,39.8%,39.5%,40.7%,
50.6%,49.6%,50.4%,49.7%,50.6%,49.4%,50.3%,50.8%,50.7%,60.8%,59.7%,60.7%,59.4%,60.6%,60.8%,59.2%,59.1%,60.3%,70.5%,69.6%,69.7%,70.7%,70.6%,70.3%,70.4%,70.7%,69.1%,80.2%,80.5%,79.7%,80.2%,80.8%,80.7%,79.2%,79.6%,79.8%,90.2%,89.8%,90.9%,90.2%,89.3%,90.8%,89.8%,89.1%,89.5%)
/select = noreplace
/selectionrate = always
</counter>

<counter faceYpos_grid>
/items = (9.8%, 20.5%, 30.8%, 39.2%, 50.9%, 60.3%, 69.1%, 80.6% 89.5%,10.6%, 20.2%, 30.9%, 40.6%, 49.2%, 59.2%, 70.6%, 79.5%, 89.6%, 9.5%, 19.1%, 29.7%, 40.4%, 50.2%, 59.7%, 70.8%, 80.5%, 90.3%, 9.2%, 19.5%, 29.1%, 39.8%, 50.2%, 60.2%, 70.3%, 79.3%, 89.1%,
9.2%, 19.7%, 30.1%, 40.8%, 49.93%, 60.7%, 70.3%, 79.4%, 89.1%, 9.1%, 20.6%, 30.2%, 39.8%, 50.2%, 59.2%, 70.6%, 79.2%, 90.3%, 10.4%, 20.4%, 30.8%, 39.8%, 50.4%, 60.2%, 70.2%, 79.5%, 89.3%, 10.2%, 20.8%, 30.8%, 40.2%, 49.3%, 59.7%, 70.2%, 79.7%, 89.2%, 9.5%, 20.7%, 29.4%, 39.5%, 49.8%, 59.2%, 70.2%, 80.2%, 90.8%)
/select = current(faceXpos_grid)
/selectionrate = alwayss
</counter>

<list picturestims>
/ items = (text.1,text.A)
/ replace = true
/ selectionrate = always
</list>

<list locations>
/ items = (counter.faceXpos_grid,counter.faceYpos_grid)
/ replace = true
/ selectionrate = always
</list>

<trial example>
/ ontrialbegin = [
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
trial.example.insertstimulusframe(list.picturestims.nextvalue, 1);
]
/stimulustimes = [0=blank; 1=cross; 1250=blank; 2250=list.picturestims]
/ validresponse = (anyresponse)
/ ontrialend = [reset(counter.faceXpos_grid),reset(counter.faceYpos_grid)]
/timeout = 3250
</trial>

<block exampleblock>
/ trials = [1,2,3,4,5,6=example]



Thanks for the additional details -- in light of those details, I would advocate a different kind of approach. Ultimately, you need 14 <picture> elements if you want the trial to display 14 distinct objects on-screen. You can consider those 14 <picture> elements as neutral "slots" -- i.e. they are not tied to any particular stimulus category per se. You would use <list> elements to store the grid positions, and -- more importantly -- <list> elements holding the item numbers constituting the various stimulus "categories" "WM", WF", "BM", and "BF"). Then, in each trial you would assign (1) a grid position, and (2) an item number to each of the 14 neutral slots.

In a nutshell:


// items 1 to 20 are category WM
<list WM_itemnumbers>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20)
/ selectionrate = always
</list>

// items 21 to 40 are category WF
<list WF_itemnumbers>
/ items = (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40)
/ selectionrate = always
</list>

// items 41 to 60 are category BM
<list BM_itemnumbers>
/ items = (41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60)
/ selectionrate = always
</list>

// items 61 to 80 are category BF
<list BF_itemnumbers>
/ items = (61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80)
/ selectionrate = always
</list>

// fill the first four "slots" by sampling from this list
// to ensure that at least one item of each category is represented in each trial:
<list firstfour>
/ items = (list.WM_itemnumbers.nextvalue,list.WF_itemnumbers.nextvalue,list.BM_itemnumbers.nextvalue,list.BF_itemnumbers.nextvalue)
/ replace = false
/ selectionrate = always
</list>

// fill the remaining ten "slots" by sampling from this list
<list remainingten>
/ items = (list.WM_itemnumbers.nextvalue,list.WF_itemnumbers.nextvalue,list.BM_itemnumbers.nextvalue,list.BF_itemnumbers.nextvalue)
/ replace = true
/ selectionrate = always
</list>


<item allitems>
/ 1 = "WML1.jpg"
/ 2 = "WML2.jpg"
/ 3 = "WML3.jpg"
/ 4 = "WML4.jpg"
/ 5 = "WML5.jpg"
/ 6 = "WML6.jpg"
/ 7 = "WML7.jpg"
/ 8 = "WML8.jpg"
/ 9 = "WML9.jpg"
/ 10 = "WML10.jpg"
/ 11 = "WMH1.jpg"
/ 12 = "WMH2.jpg"
/ 13 = "WMH3.jpg"
/ 14 = "WMH4.jpg"
/ 15 = "WMH5.jpg"
/ 16 = "WMH6.jpg"
/ 17 = "WMH7.jpg"
/ 18 = "WMH8.jpg"
/ 19 = "WMH9.jpg"
/ 20 = "WMH10.jpg"

/ 21 = "WFL1.jpg"
/ 22 = "WFL2.jpg"
/ 23 = "WFL3.jpg"
/ 24 = "WFL4.jpg"
/ 25 = "WFL5.jpg"
/ 26 = "WFL6.jpg"
/ 27 = "WFL7.jpg"
/ 28 = "WFL8.jpg"
/ 29 = "WFL9.jpg"
/ 30 = "WFL10.jpg"
/ 31 = "WFH1.jpg"
/ 32 = "WFH2.jpg"
/ 33 = "WFH3.jpg"
/ 34 = "WFH4.jpg"
/ 35 = "WFH5.jpg"
/ 36 = "WFH6.jpg"
/ 37 = "WFH7.jpg"
/ 38 = "WFH8.jpg"
/ 39 = "WFH9.jpg"
/ 40 = "WFH10.jpg"

/ 41 = "BML1.jpg"
/ 42 = "BML2.jpg"
/ 43 = "BML3.jpg"
/ 44 = "BL4.jpg"
/ 45 = "BML5.jpg"
/ 46 = "BML6.jpg"
/ 47 = "BML7.jpg"
/ 48 = "BML8.jpg"
/ 49 = "BML9.jpg"
/ 50 = "BML10.jpg"
/ 51 = "BMH1.jpg"
/ 52 = "BMH2.jpg"
/ 53 = "BMH3.jpg"
/ 54 = "BMH4.jpg"
/ 55 = "BMH5.jpg"
/ 56 = "BMH6.jpg"
/ 57 = "BMH7.jpg"
/ 58 = "BMH8.jpg"
/ 59 = "BMH9.jpg"
/ 60 = "BMH10.jpg"

/ 61 = "BFL1.jpg"
/ 62 = "BFL2.jpg"
/ 63 = "BFL3.jpg"
/ 64 = "BF4.jpg"
/ 65 = "BFL5.jpg"
/ 66 = "BFL6.jpg"
/ 67 = "BFL7.jpg"
/ 68 = "BFL8.jpg"
/ 69 = "BFL9.jpg"
/ 60 = "BFL10.jpg"
/ 71 = "BFH1.jpg"
/ 72 = "BFH2.jpg"
/ 73 = "BFH3.jpg"
/ 74 = "BFH4.jpg"
/ 75 = "BFH5.jpg"
/ 76 = "BFH6.jpg"
/ 77 = "BFH7.jpg"
/ 78 = "BFH8.jpg"
/ 79 = "BFH9.jpg"
/ 80 = "BFH10.jpg"
</item>

//variables to store item numbers and positions assigned to each "slot"
<values>
/ slot_01_item = 1
/ slot_01_x = 0%
/ slot_01_y = 0%

/ slot_02_item = 1
/ slot_02_x = 0%
/ slot_02_y = 0%

/ slot_03_item = 1
/ slot_03_x = 0%
/ slot_03_y = 0%

/ slot_04_item = 1
/ slot_04_x = 0%
/ slot_04_y = 0%

/ slot_05_item = 1
/ slot_05_x = 0%
/ slot_05_y = 0%

/ slot_06_item = 1
/ slot_06_x = 0%
/ slot_06_y = 0%

/ slot_07_item = 1
/ slot_07_x = 0%
/ slot_07_y = 0%

/ slot_08_item = 1
/ slot_08_x = 0%
/ slot_08_y = 0%

/ slot_09_item = 1
/ slot_09_x = 0%
/ slot_09_y = 0%

/ slot_10_item = 1
/ slot_10_x = 0%
/ slot_10_y = 0%

/ slot_11_item = 1
/ slot_11_x = 0%
/ slot_11_y = 0%

/ slot_12_item = 1
/ slot_12_x = 0%
/ slot_12_y = 0%

/ slot_13_item = 1
/ slot_13_x = 0%
/ slot_13_y = 0%

/ slot_14_item = 1
/ slot_14_x = 0%
/ slot_14_y = 0%
</values>

// the generic slot stimulus objects:
<text slot_01>
/ items = allitems
/ select = values.slot_01_item
/ hposition = values.slot_01_x
/ vposition = values.slot_01_y
</text>

<text slot_02>
/ items = allitems
/ select = values.slot_02_item
/ hposition = values.slot_02_x
/ vposition = values.slot_02_y
</text>

<text slot_03>
/ items = allitems
/ select = values.slot_03_item
/ hposition = values.slot_03_x
/ vposition = values.slot_03_y
</text>

<text slot_04>
/ items = allitems
/ select = values.slot_04_item
/ hposition = values.slot_04_x
/ vposition = values.slot_04_y
</text>

<text slot_05>
/ items = allitems
/ select = values.slot_05_item
/ hposition = values.slot_05_x
/ vposition = values.slot_05_y
</text>

<text slot_06>
/ items = allitems
/ select = values.slot_06_item
/ hposition = values.slot_06_x
/ vposition = values.slot_06_y
</text>

<text slot_07>
/ items = allitems
/ select = values.slot_07_item
/ hposition = values.slot_07_x
/ vposition = values.slot_07_y
</text>

<text slot_08>
/ items = allitems
/ select = values.slot_08_item
/ hposition = values.slot_08_x
/ vposition = values.slot_08_y
</text>

<text slot_09>
/ items = allitems
/ select = values.slot_09_item
/ hposition = values.slot_09_x
/ vposition = values.slot_09_y
</text>

<text slot_10>
/ items = allitems
/ select = values.slot_10_item
/ hposition = values.slot_10_x
/ vposition = values.slot_10_y
</text>

<text slot_11>
/ items = allitems
/ select = values.slot_11_item
/ hposition = values.slot_11_x
/ vposition = values.slot_11_y
</text>

<text slot_12>
/ items = allitems
/ select = values.slot_12_item
/ hposition = values.slot_12_x
/ vposition = values.slot_12_y
</text>

<text slot_13>
/ items = allitems
/ select = values.slot_13_item
/ hposition = values.slot_13_x
/ vposition = values.slot_13_y
</text>

<text slot_14>
/ items = allitems
/ select = values.slot_14_item
/ hposition = values.slot_14_x
/ vposition = values.slot_14_y
</text>


<text cross>
/items = ("cross.jpg")
/position = (50%, 50%)
</text>

<shape blank>
/shape = rectangle
/size = (100%,100%)
/color = white
</shape>

// the positions grid:
<list faceXpos_grid>
/items = (9.7%,10.8%,10.05%,9.6%,10.5%,10.7%,9.5%,10.4%,10.8%,19.8%,19.74%,20.3%,19.3%,19.4%,20.4%,19.8%,20.26%,19.7%,30.8%,30.3%,29.1%,29.7%,29.1%,30.3%,29.4%,30.4%,29.2%,40.5%,39.8%,39.1%,40.7%,39.8%,40.5%,39.8%,39.5%,40.7%,
50.6%,49.6%,50.4%,49.7%,50.6%,49.4%,50.3%,50.8%,50.7%,60.8%,59.7%,60.7%,59.4%,60.6%,60.8%,59.2%,59.1%,60.3%,70.5%,69.6%,69.7%,70.7%,70.6%,70.3%,70.4%,70.7%,69.1%,80.2%,80.5%,79.7%,80.2%,80.8%,80.7%,79.2%,79.6%,79.8%,90.2%,89.8%,90.9%,90.2%,89.3%,90.8%,89.8%,89.1%,89.5%)
/ selectionmode = random
/ replace = false
/selectionrate = always
</list>

<list faceYpos_grid>
/items = (9.8%, 20.5%, 30.8%, 39.2%, 50.9%, 60.3%, 69.1%, 80.6% 89.5%,10.6%, 20.2%, 30.9%, 40.6%, 49.2%, 59.2%, 70.6%, 79.5%, 89.6%, 9.5%, 19.1%, 29.7%, 40.4%, 50.2%, 59.7%, 70.8%, 80.5%, 90.3%, 9.2%, 19.5%, 29.1%, 39.8%, 50.2%, 60.2%, 70.3%, 79.3%, 89.1%,
9.2%, 19.7%, 30.1%, 40.8%, 49.93%, 60.7%, 70.3%, 79.4%, 89.1%, 9.1%, 20.6%, 30.2%, 39.8%, 50.2%, 59.2%, 70.6%, 79.2%, 90.3%, 10.4%, 20.4%, 30.8%, 39.8%, 50.4%, 60.2%, 70.2%, 79.5%, 89.3%, 10.2%, 20.8%, 30.8%, 40.2%, 49.3%, 59.7%, 70.2%, 79.7%, 89.2%, 9.5%, 20.7%, 29.4%, 39.5%, 49.8%, 59.2%, 70.2%, 80.2%, 90.8%)
/ selectionmode = list.faceXpos_grid.currentindex
/selectionrate = always
</list>

// populate the stimulus slots with item numbers and assign a random position to each slot:
<trial example>
/ ontrialbegin = [
    values.slot_01_item = list.firstfour.nextvalue;
    values.slot_01_x = list.faceXpos_grid.nextvalue;
    values.slot_01_y = list.faceYpos_grid.nextvalue;
    values.slot_02_item = list.firstfour.nextvalue;
    values.slot_02_x = list.faceXpos_grid.nextvalue;
    values.slot_02_y = list.faceYpos_grid.nextvalue;
    values.slot_03_item = list.firstfour.nextvalue;
    values.slot_03_x = list.faceXpos_grid.nextvalue;
    values.slot_03_y = list.faceYpos_grid.nextvalue;
    values.slot_04_item = list.firstfour.nextvalue;
    values.slot_04_x = list.faceXpos_grid.nextvalue;
    values.slot_04_y = list.faceYpos_grid.nextvalue;

    values.slot_05_item = list.remainingten.nextvalue;
    values.slot_05_x = list.faceXpos_grid.nextvalue;
    values.slot_05_y = list.faceYpos_grid.nextvalue;
    values.slot_06_item = list.remainingten.nextvalue;
    values.slot_06_x = list.faceXpos_grid.nextvalue;
    values.slot_06_y = list.faceYpos_grid.nextvalue;
    values.slot_07_item = list.remainingten.nextvalue;
    values.slot_07_x = list.faceXpos_grid.nextvalue;
    values.slot_07_y = list.faceYpos_grid.nextvalue;
    values.slot_08_item = list.remainingten.nextvalue;
    values.slot_08_x = list.faceXpos_grid.nextvalue;
    values.slot_08_y = list.faceYpos_grid.nextvalue;
    values.slot_09_item = list.remainingten.nextvalue;
    values.slot_09_x = list.faceXpos_grid.nextvalue;
    values.slot_09_y = list.faceYpos_grid.nextvalue;
    values.slot_10_item = list.remainingten.nextvalue;
    values.slot_10_x = list.faceXpos_grid.nextvalue;
    values.slot_10_y = list.faceYpos_grid.nextvalue;
    values.slot_11_item = list.remainingten.nextvalue;
    values.slot_11_x = list.faceXpos_grid.nextvalue;
    values.slot_11_y = list.faceYpos_grid.nextvalue;
    values.slot_12_item = list.remainingten.nextvalue;
    values.slot_12_x = list.faceXpos_grid.nextvalue;
    values.slot_12_y = list.faceYpos_grid.nextvalue;
    values.slot_13_item = list.remainingten.nextvalue;
    values.slot_13_x = list.faceXpos_grid.nextvalue;
    values.slot_13_y = list.faceYpos_grid.nextvalue;
    values.slot_14_item = list.remainingten.nextvalue;
    values.slot_14_x = list.faceXpos_grid.nextvalue;
    values.slot_14_y = list.faceYpos_grid.nextvalue;
]
/ ontrialend = [
    list.faceXpos_grid.reset();
    list.faceYpos_grid.reset();
]
/stimulustimes = [0=blank, cross; 1250=blank;
    2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
    slot_08, slot_09, slot_10, slot_11, slot_12, slot_13, slot_14]
/ validresponse = (57)
</trial>

<block myblock>
/ trials = [1-4 = example]
</block>

You can determine the number of items from a given category that were shown during a given trial by logging and/or further processing the values.slot_01_item to values.slot_14_item variables.

I hope the above gives you the general idea.


Thank you so much, Dave! This is extremely helpful!!
I tried it and all worked wonderfully!
Thank you!!
Kate61
Kate61
Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)
Group: Forum Members
Posts: 29, Visits: 56
Hi,
Sorry to bother you again with this problem... but we found that we need to have codes that do something a bit differently--
Now with the above codes we can randomly select 1 stimuli from each of the 4 sets to make the first 4, and then randomly select another 10 from the 4 sets to make a total of 14.
But we later figured out that these codes generated more "middle number" combinations than "extreme" ones by nature: we actually want to have all possible combinations at a equal/similar chance--while now in the remaining 10 we have more 2+2+3+3 trials (2,2,3,3 stimuli from each set) than 0+0+0+10 trials (for example).
Put it another way, say we only have 2 sets of stimuli (A and B) and we want to randomly select 10 stimuli for each trial. We want to have all different combinations: 1A+9B, 2A+8B, 3A+7B,...,9A+1B and we want every combination happens at an equal chance. Since we have 4 sets of stimuli and eventually we want to have a continuous number of total stimuli instead of a fixed number (say we want to have 8-20 total stimuli trials, continuously), it is not possible to manually write all possible combinations...
We feel that there might be a way to have a list of numbers XX and later use them to select XX number of stimuli from each set. Or have some codes doing something like "stop selecting stimuli from this set if the number hits XX". How can we do this?
Here we uploaded the example file we gratefully got from Dave last time (we added these questions in the file too).
Thank you very much for helping us!
Attachments
try trial structure-text.iqx (565 views, 9.00 KB)
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
Kate61 - Monday, December 4, 2017
Hi,
Sorry to bother you again with this problem... but we found that we need to have codes that do something a bit differently--
Now with the above codes we can randomly select 1 stimuli from each of the 4 sets to make the first 4, and then randomly select another 10 from the 4 sets to make a total of 14.
But we later figured out that these codes generated more "middle number" combinations than "extreme" ones by nature: we actually want to have all possible combinations at a equal/similar chance--while now in the remaining 10 we have more 2+2+3+3 trials (2,2,3,3 stimuli from each set) than 0+0+0+10 trials (for example).
Put it another way, say we only have 2 sets of stimuli (A and B) and we want to randomly select 10 stimuli for each trial. We want to have all different combinations: 1A+9B, 2A+8B, 3A+7B,...,9A+1B and we want every combination happens at an equal chance. Since we have 4 sets of stimuli and eventually we want to have a continuous number of total stimuli instead of a fixed number (say we want to have 8-20 total stimuli trials, continuously), it is not possible to manually write all possible combinations...
We feel that there might be a way to have a list of numbers XX and later use them to select XX number of stimuli from each set. Or have some codes doing something like "stop selecting stimuli from this set if the number hits XX". How can we do this?
Here we uploaded the example file we gratefully got from Dave last time (we added these questions in the file too).
Thank you very much for helping us!

So, your second question is easier to answer: If you want the trial to have a variable number of "slots" (instead of a fixed number of 14), you
(1) you define those slots as usual -- i.e. set up as many <picture> elements and associated variable as there are maximum slots.
(2) insert the desired amount of slots into the trial's stimulus presentation sequence as needed.

This

<list nslots>
/ items = (8,9,10,11,12,13,14)
/ replace = true
</list>

<values>
/ nslots = 0
</values>

// populate the stimulus slots with item numbers and assign a random position to each slot:
<trial example>
/ ontrialbegin = [
    values.nslots = list.nslots.nextvalue;
]
/ ontrialbegin = [
    if(values.nslots >= 9) trial.example.insertstimulustime(text.slot_09, 2250);
    if(values.nslots >= 10) trial.example.insertstimulustime(text.slot_10, 2250);
    if(values.nslots >= 11) trial.example.insertstimulustime(text.slot_11, 2250);
    if(values.nslots >= 12) trial.example.insertstimulustime(text.slot_12, 2250);
    if(values.nslots >= 13) trial.example.insertstimulustime(text.slot_13, 2250);
    if(values.nslots >= 14) trial.example.insertstimulustime(text.slot_14, 2250);
]
/ ontrialbegin = [
    values.slot_01_item = list.firstfour.nextvalue;
    values.slot_01_x = list.faceXpos_grid.nextvalue;
    values.slot_01_y = list.faceYpos_grid.nextvalue;
    values.slot_02_item = list.firstfour.nextvalue;
    values.slot_02_x = list.faceXpos_grid.nextvalue;
    values.slot_02_y = list.faceYpos_grid.nextvalue;
    values.slot_03_item = list.firstfour.nextvalue;
    values.slot_03_x = list.faceXpos_grid.nextvalue;
    values.slot_03_y = list.faceYpos_grid.nextvalue;
    values.slot_04_item = list.firstfour.nextvalue;
    values.slot_04_x = list.faceXpos_grid.nextvalue;
    values.slot_04_y = list.faceYpos_grid.nextvalue;

    values.slot_05_item = list.remainingten.nextvalue;
    values.slot_05_x = list.faceXpos_grid.nextvalue;
    values.slot_05_y = list.faceYpos_grid.nextvalue;
    values.slot_06_item = list.remainingten.nextvalue;
    values.slot_06_x = list.faceXpos_grid.nextvalue;
    values.slot_06_y = list.faceYpos_grid.nextvalue;
    values.slot_07_item = list.remainingten.nextvalue;
    values.slot_07_x = list.faceXpos_grid.nextvalue;
    values.slot_07_y = list.faceYpos_grid.nextvalue;
    values.slot_08_item = list.remainingten.nextvalue;
    values.slot_08_x = list.faceXpos_grid.nextvalue;
    values.slot_08_y = list.faceYpos_grid.nextvalue;]

    / ontrialbegin = [
    if(values.nslots >= 9) {
    values.slot_09_item = list.remainingten.nextvalue;
    values.slot_09_x = list.faceXpos_grid.nextvalue;
    values.slot_09_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 10) {
    values.slot_10_item = list.remainingten.nextvalue;
    values.slot_10_x = list.faceXpos_grid.nextvalue;
    values.slot_10_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 11) {
    values.slot_11_item = list.remainingten.nextvalue;
    values.slot_11_x = list.faceXpos_grid.nextvalue;
    values.slot_11_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 12) {
    values.slot_12_item = list.remainingten.nextvalue;
    values.slot_12_x = list.faceXpos_grid.nextvalue;
    values.slot_12_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 13) {
    values.slot_13_item = list.remainingten.nextvalue;
    values.slot_13_x = list.faceXpos_grid.nextvalue;
    values.slot_13_y = list.faceYpos_grid.nextvalue;
    };
    if(values.nslots >= 14) {
    values.slot_14_item = list.remainingten.nextvalue;
    values.slot_14_x = list.faceXpos_grid.nextvalue;
    values.slot_14_y = list.faceYpos_grid.nextvalue;
    };
]
/ ontrialend = [
    list.faceXpos_grid.reset();
    list.faceYpos_grid.reset();
    trial.example.resetstimulusframes();
]
/stimulustimes = [0=blank, cross; 1250=blank;
    2250=slot_01, slot_02, slot_03, slot_04, slot_05, slot_06, slot_07,
    slot_08]
/ validresponse = (57)
</trial>

<block myblock>
/ trials = [1-10 = example]
</block>

will display anything between 8 to 14 stimuli on-screen per trial.


To your first question -- the distribution -- I frankly don't have an answer. As you correctly note, the "normal" distribution arises naturally from the sampling process you proposed. In other words, you'd have to come up with some sort of different sampling process that produces a "uniform" distribution of "splits" across trials -- I'm not sure how that would look like mathematically. If you can come up with a way to formalize that, i.e. mathematically describe a sampling process that yields the desired distribution, I'Il be happy to tell you whether that is implementable and how to express it in Inquisit syntax.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search