Millisecond Forums

Saving randomly selected sequence of items from list element in summarydata

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

By Tahwan - 2/12/2021

My experiment uses a list of 20 items from 1 to 20, from which numbers are randomly selected. How can I store the randomly seleected sequence. I simply want to know, whether the selected sequence was 3, 5, 17, ... or 1, 2, 8, 19 etc.

I did not find anything regarding this in the forum, which suprises me. Can someone help?

<list trial_sequence>
/items = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)
/selectionmode = random
</list>

I unsuccessfully tried things like:
<summarydata>
/columns = [list.trial_sequence, list.trial_sequence.items]
</summarydata>

Optimal solution: A column, which simply saves the order in summary data, for example: "1, 3, 16, 17,...". Or must I do a workaround, e. g. by defining 20 values and saving the corresponding position, e. g. by an additional counter?

Background: My experiment runs through the same block 20 times, each time with different stimuli. I have accomplished doing this by creating lists and to call the correct element with a value that I have called current_list. Most likely I can achieve the same thing with the counter element, but I also don't know how to save the sequence there, too.
By Dave - 2/12/2021

Jakob - 2/12/2021
My experiment uses a list of 20 items from 1 to 20, from which numbers are randomly selected. How can I store the randomly seleected sequence. I simply want to know, whether the selected sequence was 3, 5, 17, ... or 1, 2, 8, 19 etc.

I did not find anything regarding this in the forum, which suprises me. Can someone help?

<list trial_sequence>
/items = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)
/selectionmode = random
</list>

I unsuccessfully tried things like:
<summarydata>
/columns = [list.trial_sequence, list.trial_sequence.items]
</summarydata>

Optimal solution: A column, which simply saves the order in summary data, for example: "1, 3, 16, 17,...". Or must I do a workaround, e. g. by defining 20 values and saving the corresponding position, e. g. by an additional counter?

Background: My experiment runs through the same block 20 times, each time with different stimuli. I have accomplished doing this by creating lists and to call the correct element with a value that I have called current_list. Most likely I can achieve the same thing with the counter element, but I also don't know how to save the sequence there, too.

This question is not answerable without further information about how the rest of your code actually looks.
By Tahwan - 2/12/2021

I created a short version of the script. The entire script is quite complicated, but this version has all the important elements. Also, I have reduced the number of trials to 3. All I want is to elegantly save the order of the sequence 

<list trial_sequence>
/items = (1, 2, 3)
/selectionmode = random
</list>

If there is no elegenat way, I would be able to do a workaround with values and an additional counter (e. g. counter that counts from 1 to 3 in sequence when each block starts again and three values (each for each list) that change to the value of the counter. That way I would have the position of each list). However, as Inquisit can calculate the variance (list.listname.variance) I was wondering if it is possible to simple save the order. Anyway, here is the skript shortened:

*Defining three lists for each block
<list colors_unique_trial01>
/ items = (yellow, blue)
/ selectionrate = block
</list>

<list colors_unique_trial02>
/ items = (green, red)
/ selectionrate = block
</list>

<list colors_unique_trial03>
/ items = (orange, pink)
/ selectionrate = block
</list>

*creating list of list for left color. The value of this list is selected via the value current_list
<list list_uniquecolor_left>
/ items = (list.colors_unique_trial01.items.1,
list.colors_unique_trial02.items.1,
list.colors_unique_trial03.items.1)
/ selectionmode = (values.current_list)
</list>

*creating list of list for right color. The value of this list is selected via the value current_list
<list list_uniquecolor_right>
/ items = (list.colors_unique_trial01.items.2,
list.colors_unique_trial02.items.2,
list.colors_unique_trial03.items.2)
/ selectionmode = (values.current_list)
</list>

*** Defining shapes and texts
*Defining black colored ciclre. The color is changed to the correct one later.
<shape responseoption_trialdecide_color1>
/shape = circle
/color = black
/size = (6.5%, 11.555%)
/position = (30%, 50%)
/ erase = false
</shape>

*Defining black colored ciclre. The color is changed to the correct one later.
<shape responseoption_trialdecide_color2>
/shape = circle
/color = black
/size = (6.5%, 11.555%)
/position = (70%, 50%)
/ erase = false
</shape>

*White background
<shape white_BG>
/shape = rectangle
/color = white
/size = (99%, 99%)
</shape>

<text decision_color>
/items = ("Which color do you decide on?")
/ position = (50%, 20%)
/ fontstyle = ("Calibri", 2.6%)
/ erase = false
</text>

*Defining trial. Here, the color is being changed according to the currently called list
<trial trial_decision>
/stimulusframes = [1= white_BG, decision_color, responseoption_trialdecide_color1, responseoption_trialdecide_color2]
/ontrialbegin = [shape.responseoption_trialdecide_color1.color = list.list_uniquecolor_left.item(values.current_list);
                shape.responseoption_trialdecide_color2.color = list.list_uniquecolor_right.item(values.current_list)]
/inputdevice = mouse
/validresponse = (responseoption_trialdecide_color1, responseoption_trialdecide_color2)
</trial>

*Defining value
<values>
/current_list =0
</values>

*This block is reapeated 3 times, each with different color, as the value current_list is changed at the beginning of each block.
<block boxtask>
/trials = [1=trial_decision]
/onblockbegin = [values.current_list = list.trial_sequence.nextvalue]
</block>

*This runs the experiment. Here is defined, how many trials/sequences the participant should do. This is defined by the number of blocks (default: 1-20; this means 20 trials/sequences)
<expt>
/ blocks = [1-3=boxtask]
</expt>

<list trial_sequence>
/items = (1, 2, 3)
/selectionmode = random
</list>

<summarydata>
/ columns = [list.trial_sequence, list.trial_sequence.items]
</summarydata>
By Dave - 2/12/2021

Jakob - 2/12/2021
I created a short version of the script. The entire script is quite complicated, but this version has all the important elements. Also, I have reduced the number of trials to 3. All I want is to elegantly save the order of the sequence 

<list trial_sequence>
/items = (1, 2, 3)
/selectionmode = random
</list>

If there is no elegenat way, I would be able to do a workaround with values and an additional counter (e. g. counter that counts from 1 to 3 in sequence when each block starts again and three values (each for each list) that change to the value of the counter. That way I would have the position of each list). However, as Inquisit can calculate the variance (list.listname.variance) I was wondering if it is possible to simple save the order. Anyway, here is the skript shortened:

*Defining three lists for each block
<list colors_unique_trial01>
/ items = (yellow, blue)
/ selectionrate = block
</list>

<list colors_unique_trial02>
/ items = (green, red)
/ selectionrate = block
</list>

<list colors_unique_trial03>
/ items = (orange, pink)
/ selectionrate = block
</list>

*creating list of list for left color. The value of this list is selected via the value current_list
<list list_uniquecolor_left>
/ items = (list.colors_unique_trial01.items.1,
list.colors_unique_trial02.items.1,
list.colors_unique_trial03.items.1)
/ selectionmode = (values.current_list)
</list>

*creating list of list for right color. The value of this list is selected via the value current_list
<list list_uniquecolor_right>
/ items = (list.colors_unique_trial01.items.2,
list.colors_unique_trial02.items.2,
list.colors_unique_trial03.items.2)
/ selectionmode = (values.current_list)
</list>

*** Defining shapes and texts
*Defining black colored ciclre. The color is changed to the correct one later.
<shape responseoption_trialdecide_color1>
/shape = circle
/color = black
/size = (6.5%, 11.555%)
/position = (30%, 50%)
/ erase = false
</shape>

*Defining black colored ciclre. The color is changed to the correct one later.
<shape responseoption_trialdecide_color2>
/shape = circle
/color = black
/size = (6.5%, 11.555%)
/position = (70%, 50%)
/ erase = false
</shape>

*White background
<shape white_BG>
/shape = rectangle
/color = white
/size = (99%, 99%)
</shape>

<text decision_color>
/items = ("Which color do you decide on?")
/ position = (50%, 20%)
/ fontstyle = ("Calibri", 2.6%)
/ erase = false
</text>

*Defining trial. Here, the color is being changed according to the currently called list
<trial trial_decision>
/stimulusframes = [1= white_BG, decision_color, responseoption_trialdecide_color1, responseoption_trialdecide_color2]
/ontrialbegin = [shape.responseoption_trialdecide_color1.color = list.list_uniquecolor_left.item(values.current_list);
                shape.responseoption_trialdecide_color2.color = list.list_uniquecolor_right.item(values.current_list)]
/inputdevice = mouse
/validresponse = (responseoption_trialdecide_color1, responseoption_trialdecide_color2)
</trial>

*Defining value
<values>
/current_list =0
</values>

*This block is reapeated 3 times, each with different color, as the value current_list is changed at the beginning of each block.
<block boxtask>
/trials = [1=trial_decision]
/onblockbegin = [values.current_list = list.trial_sequence.nextvalue]
</block>

*This runs the experiment. Here is defined, how many trials/sequences the participant should do. This is defined by the number of blocks (default: 1-20; this means 20 trials/sequences)
<expt>
/ blocks = [1-3=boxtask]
</expt>

<list trial_sequence>
/items = (1, 2, 3)
/selectionmode = random
</list>

<summarydata>
/ columns = [list.trial_sequence, list.trial_sequence.items]
</summarydata>

*Defining three lists for each block
<list colors_unique_trial01>
/ items = (yellow, blue)
/ selectionrate = block
</list>

<list colors_unique_trial02>
/ items = (green, red)
/ selectionrate = block
</list>

<list colors_unique_trial03>
/ items = (orange, pink)
/ selectionrate = block
</list>

*creating list of list for left color. The value of this list is selected via the value current_list
<list list_uniquecolor_left>
/ items = (list.colors_unique_trial01.items.1,
list.colors_unique_trial02.items.1,
list.colors_unique_trial03.items.1)
/ selectionmode = (values.current_list)
</list>

*creating list of list for right color. The value of this list is selected via the value current_list
<list list_uniquecolor_right>
/ items = (list.colors_unique_trial01.items.2,
list.colors_unique_trial02.items.2,
list.colors_unique_trial03.items.2)
/ selectionmode = (values.current_list)
</list>

*** Defining shapes and texts
*Defining black colored ciclre. The color is changed to the correct one later.
<shape responseoption_trialdecide_color1>
/shape = circle
/color = black
/size = (6.5%, 11.555%)
/position = (30%, 50%)
/ erase = false
</shape>

*Defining black colored ciclre. The color is changed to the correct one later.
<shape responseoption_trialdecide_color2>
/shape = circle
/color = black
/size = (6.5%, 11.555%)
/position = (70%, 50%)
/ erase = false
</shape>

*White background
<shape white_BG>
/shape = rectangle
/color = white
/size = (99%, 99%)
</shape>

<text decision_color>
/items = ("Which color do you decide on?")
/ position = (50%, 20%)
/ fontstyle = ("Calibri", 2.6%)
/ erase = false
</text>

*Defining trial. Here, the color is being changed according to the currently called list
<trial trial_decision>
/stimulusframes = [1= white_BG, decision_color, responseoption_trialdecide_color1, responseoption_trialdecide_color2]
/ontrialbegin = [shape.responseoption_trialdecide_color1.color = list.list_uniquecolor_left.item(values.current_list);
      shape.responseoption_trialdecide_color2.color = list.list_uniquecolor_right.item(values.current_list)]
/inputdevice = mouse
/validresponse = (responseoption_trialdecide_color1, responseoption_trialdecide_color2)
</trial>

*Defining value
<values>
/current_list =0
/ sequence = ""
</values>

*This block is reapeated 3 times, each with different color, as the value current_list is changed at the beginning of each block.
<block boxtask>
/trials = [1=trial_decision]
/onblockbegin = [values.current_list = list.trial_sequence.nextvalue;
    values.sequence = concat(concat(values.sequence,values.current_list), ",");]
</block>

*This runs the experiment. Here is defined, how many trials/sequences the participant should do. This is defined by the number of blocks (default: 1-20; this means 20 trials/sequences)
<expt>
/ blocks = [1-3=boxtask]
</expt>

<list trial_sequence>
/items = (1, 2, 3)
/selectionmode = random
</list>

<summarydata>
/ columns = [values.sequence]
</summarydata>
By Tahwan - 2/12/2021

Wow! Thank you Dave for this very useful function "concat". And of course again for your fast reply. This works well, also in my other original skript!