Millisecond Forums

Jumping to specified index in list

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

By AndrewPapale - 9/18/2023

Dear Inquisit Team,

I have a list:
<list rt_359>
/ items = ( 42, 41, 42, 39, 37, 38, 31, 35, 28, 25, 20, 17, 21, 29, 25, 28, 36, 39, 36, 37, 38, 38, 36, 36, 35, 26, 29, 24, 28, 28, 31, 32, 36, 38, 38, 42, 44, 52, 56, 58, 62, 54, 65, 78, 83, 90, 92, 105, 127, 126, 147, 163, 161, 149, 143, 139, 141, 143, 161, 161, 159, 160, 158, 136, 129, 116, 127, 126, 132, 119, 111, 112, 111, 104, 97, 90, 80, 70, 62, 48, 48, 47, 45, 42, 40, 37, 36, 37, 34, 39, 38, 34, 34, 30, 28, 25, 20, 18, 19, 19, 10, 11, 5, 8, 11, 14, 20, 25, 33, 39, 41, 42, 41, 41, 43, 64, 76, 89, 101, 113, 126, 135, 138, 149, 143, 156, 160, 159, 163, 162, 163, 163, 163, 157, 160, 162, 161, 162, 149, 151, 155, 161, 161, 156, 159, 155, 149, 131, 118, 103, 97, 89, 76, 48, 47, 46, 46, 45, 44, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 42, 42, 40, 34, 33, 37, 28, 28, 33, 35, 34, 30, 28, 33, 34, 35, 35, 36, 39, 42, 47, 46, 43, 41, 41, 41, 39, 37, 40, 39, 30, 20, 17, 11, 19, 21, 19, 10, 9, 5, 6, 3, 6, 4, 3, 3, 3, 4, 3, 7, 11, 16, 20, 24, 28, 32, 36, 40, 48, 47, 46, 45, 45, 44, 43, 42, 40, 40, 40, 41, 40, 36, 38, 39, 38, 36, 37, 33, 31, 33, 31, 32, 30, 28, 28, 30, 31, 37, 40, 39, 39, 44, 45, 46, 47, 52, 54, 54, 61, 62, 77, 89, 94, 81, 76, 84, 91, 86, 107, 84, 99, 110, 86, 81, 62, 67, 53, 47, 62, 68, 57, 43, 44, 44, 46, 44, 58, 50, 50, 45, 46, 44, 41, 38, 35, 35, 34, 32, 27, 23, 21, 22, 17, 16, 9, 8, 8, 5, 6, 4, 3, 3, 3, 3, 3, 4, 4, 9, 14, 18, 22, 27, 32, 37, 41, 44, 41, 38, 39, 37,35)
/ poolsize = 316
/ selectionmode = sequence
</list>

For each trial, I want the list to advance by one value.  This is working fine with the current code.

Now, for different groups in my experiment, I want to start the list at a different index.  e.g. group 1 starts at index 1 (42) group 2 starts at index 50 (105), etc.  Is this possible?  I could not find a way to do it.

Thanks,
Andrew
By Dave - 9/18/2023

Andrew Papale - 9/18/2023
Dear Inquisit Team,

I have a list:
<list rt_359>
/ items = ( 42, 41, 42, 39, 37, 38, 31, 35, 28, 25, 20, 17, 21, 29, 25, 28, 36, 39, 36, 37, 38, 38, 36, 36, 35, 26, 29, 24, 28, 28, 31, 32, 36, 38, 38, 42, 44, 52, 56, 58, 62, 54, 65, 78, 83, 90, 92, 105, 127, 126, 147, 163, 161, 149, 143, 139, 141, 143, 161, 161, 159, 160, 158, 136, 129, 116, 127, 126, 132, 119, 111, 112, 111, 104, 97, 90, 80, 70, 62, 48, 48, 47, 45, 42, 40, 37, 36, 37, 34, 39, 38, 34, 34, 30, 28, 25, 20, 18, 19, 19, 10, 11, 5, 8, 11, 14, 20, 25, 33, 39, 41, 42, 41, 41, 43, 64, 76, 89, 101, 113, 126, 135, 138, 149, 143, 156, 160, 159, 163, 162, 163, 163, 163, 157, 160, 162, 161, 162, 149, 151, 155, 161, 161, 156, 159, 155, 149, 131, 118, 103, 97, 89, 76, 48, 47, 46, 46, 45, 44, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 42, 42, 40, 34, 33, 37, 28, 28, 33, 35, 34, 30, 28, 33, 34, 35, 35, 36, 39, 42, 47, 46, 43, 41, 41, 41, 39, 37, 40, 39, 30, 20, 17, 11, 19, 21, 19, 10, 9, 5, 6, 3, 6, 4, 3, 3, 3, 4, 3, 7, 11, 16, 20, 24, 28, 32, 36, 40, 48, 47, 46, 45, 45, 44, 43, 42, 40, 40, 40, 41, 40, 36, 38, 39, 38, 36, 37, 33, 31, 33, 31, 32, 30, 28, 28, 30, 31, 37, 40, 39, 39, 44, 45, 46, 47, 52, 54, 54, 61, 62, 77, 89, 94, 81, 76, 84, 91, 86, 107, 84, 99, 110, 86, 81, 62, 67, 53, 47, 62, 68, 57, 43, 44, 44, 46, 44, 58, 50, 50, 45, 46, 44, 41, 38, 35, 35, 34, 32, 27, 23, 21, 22, 17, 16, 9, 8, 8, 5, 6, 4, 3, 3, 3, 3, 3, 4, 4, 9, 14, 18, 22, 27, 32, 37, 41, 44, 41, 38, 39, 37,35)
/ poolsize = 316
/ selectionmode = sequence
</list>

For each trial, I want the list to advance by one value.  This is working fine with the current code.

Now, for different groups in my experiment, I want to start the list at a different index.  e.g. group 1 starts at index 1 (42) group 2 starts at index 50 (105), etc.  Is this possible?  I could not find a way to do it.

Thanks,
Andrew

You can use a value to determine the list's selection, like you can do basically anywhere else.

I.e.

<values>
/ index = 0
</values>

with

<list rt_359>
...
/ selectionmode = values.index
</list>

Increment the value bye one in every trial, which does the same thing as selecting sequentially. Set the value to whatever start value you need for each group you have, be it 0, 49, or whatever else the case may be.
By Dave - 9/18/2023

Dave - 9/19/2023
Andrew Papale - 9/18/2023
Dear Inquisit Team,

I have a list:
<list rt_359>
/ items = ( 42, 41, 42, 39, 37, 38, 31, 35, 28, 25, 20, 17, 21, 29, 25, 28, 36, 39, 36, 37, 38, 38, 36, 36, 35, 26, 29, 24, 28, 28, 31, 32, 36, 38, 38, 42, 44, 52, 56, 58, 62, 54, 65, 78, 83, 90, 92, 105, 127, 126, 147, 163, 161, 149, 143, 139, 141, 143, 161, 161, 159, 160, 158, 136, 129, 116, 127, 126, 132, 119, 111, 112, 111, 104, 97, 90, 80, 70, 62, 48, 48, 47, 45, 42, 40, 37, 36, 37, 34, 39, 38, 34, 34, 30, 28, 25, 20, 18, 19, 19, 10, 11, 5, 8, 11, 14, 20, 25, 33, 39, 41, 42, 41, 41, 43, 64, 76, 89, 101, 113, 126, 135, 138, 149, 143, 156, 160, 159, 163, 162, 163, 163, 163, 157, 160, 162, 161, 162, 149, 151, 155, 161, 161, 156, 159, 155, 149, 131, 118, 103, 97, 89, 76, 48, 47, 46, 46, 45, 44, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 42, 42, 40, 34, 33, 37, 28, 28, 33, 35, 34, 30, 28, 33, 34, 35, 35, 36, 39, 42, 47, 46, 43, 41, 41, 41, 39, 37, 40, 39, 30, 20, 17, 11, 19, 21, 19, 10, 9, 5, 6, 3, 6, 4, 3, 3, 3, 4, 3, 7, 11, 16, 20, 24, 28, 32, 36, 40, 48, 47, 46, 45, 45, 44, 43, 42, 40, 40, 40, 41, 40, 36, 38, 39, 38, 36, 37, 33, 31, 33, 31, 32, 30, 28, 28, 30, 31, 37, 40, 39, 39, 44, 45, 46, 47, 52, 54, 54, 61, 62, 77, 89, 94, 81, 76, 84, 91, 86, 107, 84, 99, 110, 86, 81, 62, 67, 53, 47, 62, 68, 57, 43, 44, 44, 46, 44, 58, 50, 50, 45, 46, 44, 41, 38, 35, 35, 34, 32, 27, 23, 21, 22, 17, 16, 9, 8, 8, 5, 6, 4, 3, 3, 3, 3, 3, 4, 4, 9, 14, 18, 22, 27, 32, 37, 41, 44, 41, 38, 39, 37,35)
/ poolsize = 316
/ selectionmode = sequence
</list>

For each trial, I want the list to advance by one value.  This is working fine with the current code.

Now, for different groups in my experiment, I want to start the list at a different index.  e.g. group 1 starts at index 1 (42) group 2 starts at index 50 (105), etc.  Is this possible?  I could not find a way to do it.

Thanks,
Andrew

You can use a value to determine the list's selection, like you can do basically anywhere else.

I.e.

<values>
/ index = 0
</values>

with

<list rt_359>
...
/ selectionmode = values.index
</list>

Increment the value bye one in every trial, which does the same thing as selecting sequentially. Set the value to whatever start value you need for each group you have, be it 0, 49, or whatever else the case may be.

Here's a runnable example. First group gets index 1 in the first trial, second group gets inex 340 in the first trial, so you can see how things wrap around (the list has 345 items, so once you've shown item 345, you need to wrap around back to item 1).

<values>
/ index = 0
</values>

<list rt_359>
/ items = ( 42, 41, 42, 39, 37, 38, 31, 35, 28, 25, 20, 17, 21, 29, 25, 28, 36, 39, 36, 37, 38, 38, 36, 36, 35, 26, 29, 24, 28, 28, 31, 32, 36, 38, 38, 42, 44, 52, 56, 58, 62, 54, 65, 78, 83, 90, 92, 105, 127, 126, 147, 163, 161, 149, 143, 139, 141, 143, 161, 161, 159, 160, 158, 136, 129, 116, 127, 126, 132, 119, 111, 112, 111, 104, 97, 90, 80, 70, 62, 48, 48, 47, 45, 42, 40, 37, 36, 37, 34, 39, 38, 34, 34, 30, 28, 25, 20, 18, 19, 19, 10, 11, 5, 8, 11, 14, 20, 25, 33, 39, 41, 42, 41, 41, 43, 64, 76, 89, 101, 113, 126, 135, 138, 149, 143, 156, 160, 159, 163, 162, 163, 163, 163, 157, 160, 162, 161, 162, 149, 151, 155, 161, 161, 156, 159, 155, 149, 131, 118, 103, 97, 89, 76, 48, 47, 46, 46, 45, 44, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 42, 42, 40, 34, 33, 37, 28, 28, 33, 35, 34, 30, 28, 33, 34, 35, 35, 36, 39, 42, 47, 46, 43, 41, 41, 41, 39, 37, 40, 39, 30, 20, 17, 11, 19, 21, 19, 10, 9, 5, 6, 3, 6, 4, 3, 3, 3, 4, 3, 7, 11, 16, 20, 24, 28, 32, 36, 40, 48, 47, 46, 45, 45, 44, 43, 42, 40, 40, 40, 41, 40, 36, 38, 39, 38, 36, 37, 33, 31, 33, 31, 32, 30, 28, 28, 30, 31, 37, 40, 39, 39, 44, 45, 46, 47, 52, 54, 54, 61, 62, 77, 89, 94, 81, 76, 84, 91, 86, 107, 84, 99, 110, 86, 81, 62, 67, 53, 47, 62, 68, 57, 43, 44, 44, 46, 44, 58, 50, 50, 45, 46, 44, 41, 38, 35, 35, 34, 32, 27, 23, 21, 22, 17, 16, 9, 8, 8, 5, 6, 4, 3, 3, 3, 3, 3, 4, 4, 9, 14, 18, 22, 27, 32, 37, 41, 44, 41, 38, 39, 37,35)
/ selectionmode = values.index
</list>

<trial mytrial>
/ ontrialbegin = [
    values.index += 1; // increment index by 1
    values.index = mod(values.index - 1, list.rt_359.itemcount) + 1; // make sure we wrap around to index 1
]
/ stimulusframes = [1=text.mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("List value: <%list.rt_359.nextvalue%> | List index: <%list.rt_359.currentindex%> (<%values.index%>) | Group: <%script.groupid%>")
</text>

<block myblock>
/ trials = [1-345 = trial.mytrial]
</block>

<expt a>
/ onexptbegin = [
    values.index = 0;
]
/ blocks = [1 = block.myblock]
/ groups = (1 of 2)
</expt>

<expt b>
/ onexptbegin = [
    values.index = 339;
]
/ blocks = [1 = block.myblock]
/ groups = (2 of 2)
</expt>

By AndrewPapale - 9/19/2023

Dave - 9/19/2023
Dave - 9/19/2023
Andrew Papale - 9/18/2023
Dear Inquisit Team,

I have a list:
<list rt_359>
/ items = ( 42, 41, 42, 39, 37, 38, 31, 35, 28, 25, 20, 17, 21, 29, 25, 28, 36, 39, 36, 37, 38, 38, 36, 36, 35, 26, 29, 24, 28, 28, 31, 32, 36, 38, 38, 42, 44, 52, 56, 58, 62, 54, 65, 78, 83, 90, 92, 105, 127, 126, 147, 163, 161, 149, 143, 139, 141, 143, 161, 161, 159, 160, 158, 136, 129, 116, 127, 126, 132, 119, 111, 112, 111, 104, 97, 90, 80, 70, 62, 48, 48, 47, 45, 42, 40, 37, 36, 37, 34, 39, 38, 34, 34, 30, 28, 25, 20, 18, 19, 19, 10, 11, 5, 8, 11, 14, 20, 25, 33, 39, 41, 42, 41, 41, 43, 64, 76, 89, 101, 113, 126, 135, 138, 149, 143, 156, 160, 159, 163, 162, 163, 163, 163, 157, 160, 162, 161, 162, 149, 151, 155, 161, 161, 156, 159, 155, 149, 131, 118, 103, 97, 89, 76, 48, 47, 46, 46, 45, 44, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 42, 42, 40, 34, 33, 37, 28, 28, 33, 35, 34, 30, 28, 33, 34, 35, 35, 36, 39, 42, 47, 46, 43, 41, 41, 41, 39, 37, 40, 39, 30, 20, 17, 11, 19, 21, 19, 10, 9, 5, 6, 3, 6, 4, 3, 3, 3, 4, 3, 7, 11, 16, 20, 24, 28, 32, 36, 40, 48, 47, 46, 45, 45, 44, 43, 42, 40, 40, 40, 41, 40, 36, 38, 39, 38, 36, 37, 33, 31, 33, 31, 32, 30, 28, 28, 30, 31, 37, 40, 39, 39, 44, 45, 46, 47, 52, 54, 54, 61, 62, 77, 89, 94, 81, 76, 84, 91, 86, 107, 84, 99, 110, 86, 81, 62, 67, 53, 47, 62, 68, 57, 43, 44, 44, 46, 44, 58, 50, 50, 45, 46, 44, 41, 38, 35, 35, 34, 32, 27, 23, 21, 22, 17, 16, 9, 8, 8, 5, 6, 4, 3, 3, 3, 3, 3, 4, 4, 9, 14, 18, 22, 27, 32, 37, 41, 44, 41, 38, 39, 37,35)
/ poolsize = 316
/ selectionmode = sequence
</list>

For each trial, I want the list to advance by one value.  This is working fine with the current code.

Now, for different groups in my experiment, I want to start the list at a different index.  e.g. group 1 starts at index 1 (42) group 2 starts at index 50 (105), etc.  Is this possible?  I could not find a way to do it.

Thanks,
Andrew

You can use a value to determine the list's selection, like you can do basically anywhere else.

I.e.

<values>
/ index = 0
</values>

with

<list rt_359>
...
/ selectionmode = values.index
</list>

Increment the value bye one in every trial, which does the same thing as selecting sequentially. Set the value to whatever start value you need for each group you have, be it 0, 49, or whatever else the case may be.

Here's a runnable example. First group gets index 1 in the first trial, second group gets inex 340 in the first trial, so you can see how things wrap around (the list has 345 items, so once you've shown item 345, you need to wrap around back to item 1).

<values>
/ index = 0
</values>

<list rt_359>
/ items = ( 42, 41, 42, 39, 37, 38, 31, 35, 28, 25, 20, 17, 21, 29, 25, 28, 36, 39, 36, 37, 38, 38, 36, 36, 35, 26, 29, 24, 28, 28, 31, 32, 36, 38, 38, 42, 44, 52, 56, 58, 62, 54, 65, 78, 83, 90, 92, 105, 127, 126, 147, 163, 161, 149, 143, 139, 141, 143, 161, 161, 159, 160, 158, 136, 129, 116, 127, 126, 132, 119, 111, 112, 111, 104, 97, 90, 80, 70, 62, 48, 48, 47, 45, 42, 40, 37, 36, 37, 34, 39, 38, 34, 34, 30, 28, 25, 20, 18, 19, 19, 10, 11, 5, 8, 11, 14, 20, 25, 33, 39, 41, 42, 41, 41, 43, 64, 76, 89, 101, 113, 126, 135, 138, 149, 143, 156, 160, 159, 163, 162, 163, 163, 163, 157, 160, 162, 161, 162, 149, 151, 155, 161, 161, 156, 159, 155, 149, 131, 118, 103, 97, 89, 76, 48, 47, 46, 46, 45, 44, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 42, 42, 40, 34, 33, 37, 28, 28, 33, 35, 34, 30, 28, 33, 34, 35, 35, 36, 39, 42, 47, 46, 43, 41, 41, 41, 39, 37, 40, 39, 30, 20, 17, 11, 19, 21, 19, 10, 9, 5, 6, 3, 6, 4, 3, 3, 3, 4, 3, 7, 11, 16, 20, 24, 28, 32, 36, 40, 48, 47, 46, 45, 45, 44, 43, 42, 40, 40, 40, 41, 40, 36, 38, 39, 38, 36, 37, 33, 31, 33, 31, 32, 30, 28, 28, 30, 31, 37, 40, 39, 39, 44, 45, 46, 47, 52, 54, 54, 61, 62, 77, 89, 94, 81, 76, 84, 91, 86, 107, 84, 99, 110, 86, 81, 62, 67, 53, 47, 62, 68, 57, 43, 44, 44, 46, 44, 58, 50, 50, 45, 46, 44, 41, 38, 35, 35, 34, 32, 27, 23, 21, 22, 17, 16, 9, 8, 8, 5, 6, 4, 3, 3, 3, 3, 3, 4, 4, 9, 14, 18, 22, 27, 32, 37, 41, 44, 41, 38, 39, 37,35)
/ selectionmode = values.index
</list>

<trial mytrial>
/ ontrialbegin = [
    values.index += 1; // increment index by 1
    values.index = mod(values.index - 1, list.rt_359.itemcount) + 1; // make sure we wrap around to index 1
]
/ stimulusframes = [1=text.mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("List value: <%list.rt_359.nextvalue%> | List index: <%list.rt_359.currentindex%> (<%values.index%>) | Group: <%script.groupid%>")
</text>

<block myblock>
/ trials = [1-345 = trial.mytrial]
</block>

<expt a>
/ onexptbegin = [
    values.index = 0;
]
/ blocks = [1 = block.myblock]
/ groups = (1 of 2)
</expt>

<expt b>
/ onexptbegin = [
    values.index = 339;
]
/ blocks = [1 = block.myblock]
/ groups = (2 of 2)
</expt>


The example script works beautifully, thanks Dave!  However, when I try to apply this approach to my actual experiment the list.rt_359.currentindex never iterates.  The index iterates successfully where it is supposed to.  Any ideas?  Would you like to see my full script?  It's a bear.

Andrew
By AndrewPapale - 9/19/2023

Andrew Papale - 9/19/2023
Dave - 9/19/2023
Dave - 9/19/2023
Andrew Papale - 9/18/2023
Dear Inquisit Team,

I have a list:
<list rt_359>
/ items = ( 42, 41, 42, 39, 37, 38, 31, 35, 28, 25, 20, 17, 21, 29, 25, 28, 36, 39, 36, 37, 38, 38, 36, 36, 35, 26, 29, 24, 28, 28, 31, 32, 36, 38, 38, 42, 44, 52, 56, 58, 62, 54, 65, 78, 83, 90, 92, 105, 127, 126, 147, 163, 161, 149, 143, 139, 141, 143, 161, 161, 159, 160, 158, 136, 129, 116, 127, 126, 132, 119, 111, 112, 111, 104, 97, 90, 80, 70, 62, 48, 48, 47, 45, 42, 40, 37, 36, 37, 34, 39, 38, 34, 34, 30, 28, 25, 20, 18, 19, 19, 10, 11, 5, 8, 11, 14, 20, 25, 33, 39, 41, 42, 41, 41, 43, 64, 76, 89, 101, 113, 126, 135, 138, 149, 143, 156, 160, 159, 163, 162, 163, 163, 163, 157, 160, 162, 161, 162, 149, 151, 155, 161, 161, 156, 159, 155, 149, 131, 118, 103, 97, 89, 76, 48, 47, 46, 46, 45, 44, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 42, 42, 40, 34, 33, 37, 28, 28, 33, 35, 34, 30, 28, 33, 34, 35, 35, 36, 39, 42, 47, 46, 43, 41, 41, 41, 39, 37, 40, 39, 30, 20, 17, 11, 19, 21, 19, 10, 9, 5, 6, 3, 6, 4, 3, 3, 3, 4, 3, 7, 11, 16, 20, 24, 28, 32, 36, 40, 48, 47, 46, 45, 45, 44, 43, 42, 40, 40, 40, 41, 40, 36, 38, 39, 38, 36, 37, 33, 31, 33, 31, 32, 30, 28, 28, 30, 31, 37, 40, 39, 39, 44, 45, 46, 47, 52, 54, 54, 61, 62, 77, 89, 94, 81, 76, 84, 91, 86, 107, 84, 99, 110, 86, 81, 62, 67, 53, 47, 62, 68, 57, 43, 44, 44, 46, 44, 58, 50, 50, 45, 46, 44, 41, 38, 35, 35, 34, 32, 27, 23, 21, 22, 17, 16, 9, 8, 8, 5, 6, 4, 3, 3, 3, 3, 3, 4, 4, 9, 14, 18, 22, 27, 32, 37, 41, 44, 41, 38, 39, 37,35)
/ poolsize = 316
/ selectionmode = sequence
</list>

For each trial, I want the list to advance by one value.  This is working fine with the current code.

Now, for different groups in my experiment, I want to start the list at a different index.  e.g. group 1 starts at index 1 (42) group 2 starts at index 50 (105), etc.  Is this possible?  I could not find a way to do it.

Thanks,
Andrew

You can use a value to determine the list's selection, like you can do basically anywhere else.

I.e.

<values>
/ index = 0
</values>

with

<list rt_359>
...
/ selectionmode = values.index
</list>

Increment the value bye one in every trial, which does the same thing as selecting sequentially. Set the value to whatever start value you need for each group you have, be it 0, 49, or whatever else the case may be.

Here's a runnable example. First group gets index 1 in the first trial, second group gets inex 340 in the first trial, so you can see how things wrap around (the list has 345 items, so once you've shown item 345, you need to wrap around back to item 1).

<values>
/ index = 0
</values>

<list rt_359>
/ items = ( 42, 41, 42, 39, 37, 38, 31, 35, 28, 25, 20, 17, 21, 29, 25, 28, 36, 39, 36, 37, 38, 38, 36, 36, 35, 26, 29, 24, 28, 28, 31, 32, 36, 38, 38, 42, 44, 52, 56, 58, 62, 54, 65, 78, 83, 90, 92, 105, 127, 126, 147, 163, 161, 149, 143, 139, 141, 143, 161, 161, 159, 160, 158, 136, 129, 116, 127, 126, 132, 119, 111, 112, 111, 104, 97, 90, 80, 70, 62, 48, 48, 47, 45, 42, 40, 37, 36, 37, 34, 39, 38, 34, 34, 30, 28, 25, 20, 18, 19, 19, 10, 11, 5, 8, 11, 14, 20, 25, 33, 39, 41, 42, 41, 41, 43, 64, 76, 89, 101, 113, 126, 135, 138, 149, 143, 156, 160, 159, 163, 162, 163, 163, 163, 157, 160, 162, 161, 162, 149, 151, 155, 161, 161, 156, 159, 155, 149, 131, 118, 103, 97, 89, 76, 48, 47, 46, 46, 45, 44, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 42, 42, 40, 34, 33, 37, 28, 28, 33, 35, 34, 30, 28, 33, 34, 35, 35, 36, 39, 42, 47, 46, 43, 41, 41, 41, 39, 37, 40, 39, 30, 20, 17, 11, 19, 21, 19, 10, 9, 5, 6, 3, 6, 4, 3, 3, 3, 4, 3, 7, 11, 16, 20, 24, 28, 32, 36, 40, 48, 47, 46, 45, 45, 44, 43, 42, 40, 40, 40, 41, 40, 36, 38, 39, 38, 36, 37, 33, 31, 33, 31, 32, 30, 28, 28, 30, 31, 37, 40, 39, 39, 44, 45, 46, 47, 52, 54, 54, 61, 62, 77, 89, 94, 81, 76, 84, 91, 86, 107, 84, 99, 110, 86, 81, 62, 67, 53, 47, 62, 68, 57, 43, 44, 44, 46, 44, 58, 50, 50, 45, 46, 44, 41, 38, 35, 35, 34, 32, 27, 23, 21, 22, 17, 16, 9, 8, 8, 5, 6, 4, 3, 3, 3, 3, 3, 4, 4, 9, 14, 18, 22, 27, 32, 37, 41, 44, 41, 38, 39, 37,35)
/ selectionmode = values.index
</list>

<trial mytrial>
/ ontrialbegin = [
    values.index += 1; // increment index by 1
    values.index = mod(values.index - 1, list.rt_359.itemcount) + 1; // make sure we wrap around to index 1
]
/ stimulusframes = [1=text.mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("List value: <%list.rt_359.nextvalue%> | List index: <%list.rt_359.currentindex%> (<%values.index%>) | Group: <%script.groupid%>")
</text>

<block myblock>
/ trials = [1-345 = trial.mytrial]
</block>

<expt a>
/ onexptbegin = [
    values.index = 0;
]
/ blocks = [1 = block.myblock]
/ groups = (1 of 2)
</expt>

<expt b>
/ onexptbegin = [
    values.index = 339;
]
/ blocks = [1 = block.myblock]
/ groups = (2 of 2)
</expt>


The example script works beautifully, thanks Dave!  However, when I try to apply this approach to my actual experiment the list.rt_359.currentindex never iterates.  The index iterates successfully where it is supposed to.  Any ideas?  Would you like to see my full script?  It's a bear.

Andrew

https://github.com/andrewpapale/Clock_v2/blob/main/EEG_clock_v2_0_4.iqx
By Dave - 9/19/2023

Andrew Papale - 9/19/2023
Andrew Papale - 9/19/2023
Dave - 9/19/2023
Dave - 9/19/2023
Andrew Papale - 9/18/2023
Dear Inquisit Team,

I have a list:
<list rt_359>
/ items = ( 42, 41, 42, 39, 37, 38, 31, 35, 28, 25, 20, 17, 21, 29, 25, 28, 36, 39, 36, 37, 38, 38, 36, 36, 35, 26, 29, 24, 28, 28, 31, 32, 36, 38, 38, 42, 44, 52, 56, 58, 62, 54, 65, 78, 83, 90, 92, 105, 127, 126, 147, 163, 161, 149, 143, 139, 141, 143, 161, 161, 159, 160, 158, 136, 129, 116, 127, 126, 132, 119, 111, 112, 111, 104, 97, 90, 80, 70, 62, 48, 48, 47, 45, 42, 40, 37, 36, 37, 34, 39, 38, 34, 34, 30, 28, 25, 20, 18, 19, 19, 10, 11, 5, 8, 11, 14, 20, 25, 33, 39, 41, 42, 41, 41, 43, 64, 76, 89, 101, 113, 126, 135, 138, 149, 143, 156, 160, 159, 163, 162, 163, 163, 163, 157, 160, 162, 161, 162, 149, 151, 155, 161, 161, 156, 159, 155, 149, 131, 118, 103, 97, 89, 76, 48, 47, 46, 46, 45, 44, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 42, 42, 40, 34, 33, 37, 28, 28, 33, 35, 34, 30, 28, 33, 34, 35, 35, 36, 39, 42, 47, 46, 43, 41, 41, 41, 39, 37, 40, 39, 30, 20, 17, 11, 19, 21, 19, 10, 9, 5, 6, 3, 6, 4, 3, 3, 3, 4, 3, 7, 11, 16, 20, 24, 28, 32, 36, 40, 48, 47, 46, 45, 45, 44, 43, 42, 40, 40, 40, 41, 40, 36, 38, 39, 38, 36, 37, 33, 31, 33, 31, 32, 30, 28, 28, 30, 31, 37, 40, 39, 39, 44, 45, 46, 47, 52, 54, 54, 61, 62, 77, 89, 94, 81, 76, 84, 91, 86, 107, 84, 99, 110, 86, 81, 62, 67, 53, 47, 62, 68, 57, 43, 44, 44, 46, 44, 58, 50, 50, 45, 46, 44, 41, 38, 35, 35, 34, 32, 27, 23, 21, 22, 17, 16, 9, 8, 8, 5, 6, 4, 3, 3, 3, 3, 3, 4, 4, 9, 14, 18, 22, 27, 32, 37, 41, 44, 41, 38, 39, 37,35)
/ poolsize = 316
/ selectionmode = sequence
</list>

For each trial, I want the list to advance by one value.  This is working fine with the current code.

Now, for different groups in my experiment, I want to start the list at a different index.  e.g. group 1 starts at index 1 (42) group 2 starts at index 50 (105), etc.  Is this possible?  I could not find a way to do it.

Thanks,
Andrew

You can use a value to determine the list's selection, like you can do basically anywhere else.

I.e.

<values>
/ index = 0
</values>

with

<list rt_359>
...
/ selectionmode = values.index
</list>

Increment the value bye one in every trial, which does the same thing as selecting sequentially. Set the value to whatever start value you need for each group you have, be it 0, 49, or whatever else the case may be.

Here's a runnable example. First group gets index 1 in the first trial, second group gets inex 340 in the first trial, so you can see how things wrap around (the list has 345 items, so once you've shown item 345, you need to wrap around back to item 1).

<values>
/ index = 0
</values>

<list rt_359>
/ items = ( 42, 41, 42, 39, 37, 38, 31, 35, 28, 25, 20, 17, 21, 29, 25, 28, 36, 39, 36, 37, 38, 38, 36, 36, 35, 26, 29, 24, 28, 28, 31, 32, 36, 38, 38, 42, 44, 52, 56, 58, 62, 54, 65, 78, 83, 90, 92, 105, 127, 126, 147, 163, 161, 149, 143, 139, 141, 143, 161, 161, 159, 160, 158, 136, 129, 116, 127, 126, 132, 119, 111, 112, 111, 104, 97, 90, 80, 70, 62, 48, 48, 47, 45, 42, 40, 37, 36, 37, 34, 39, 38, 34, 34, 30, 28, 25, 20, 18, 19, 19, 10, 11, 5, 8, 11, 14, 20, 25, 33, 39, 41, 42, 41, 41, 43, 64, 76, 89, 101, 113, 126, 135, 138, 149, 143, 156, 160, 159, 163, 162, 163, 163, 163, 157, 160, 162, 161, 162, 149, 151, 155, 161, 161, 156, 159, 155, 149, 131, 118, 103, 97, 89, 76, 48, 47, 46, 46, 45, 44, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 42, 42, 40, 34, 33, 37, 28, 28, 33, 35, 34, 30, 28, 33, 34, 35, 35, 36, 39, 42, 47, 46, 43, 41, 41, 41, 39, 37, 40, 39, 30, 20, 17, 11, 19, 21, 19, 10, 9, 5, 6, 3, 6, 4, 3, 3, 3, 4, 3, 7, 11, 16, 20, 24, 28, 32, 36, 40, 48, 47, 46, 45, 45, 44, 43, 42, 40, 40, 40, 41, 40, 36, 38, 39, 38, 36, 37, 33, 31, 33, 31, 32, 30, 28, 28, 30, 31, 37, 40, 39, 39, 44, 45, 46, 47, 52, 54, 54, 61, 62, 77, 89, 94, 81, 76, 84, 91, 86, 107, 84, 99, 110, 86, 81, 62, 67, 53, 47, 62, 68, 57, 43, 44, 44, 46, 44, 58, 50, 50, 45, 46, 44, 41, 38, 35, 35, 34, 32, 27, 23, 21, 22, 17, 16, 9, 8, 8, 5, 6, 4, 3, 3, 3, 3, 3, 4, 4, 9, 14, 18, 22, 27, 32, 37, 41, 44, 41, 38, 39, 37,35)
/ selectionmode = values.index
</list>

<trial mytrial>
/ ontrialbegin = [
    values.index += 1; // increment index by 1
    values.index = mod(values.index - 1, list.rt_359.itemcount) + 1; // make sure we wrap around to index 1
]
/ stimulusframes = [1=text.mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("List value: <%list.rt_359.nextvalue%> | List index: <%list.rt_359.currentindex%> (<%values.index%>) | Group: <%script.groupid%>")
</text>

<block myblock>
/ trials = [1-345 = trial.mytrial]
</block>

<expt a>
/ onexptbegin = [
    values.index = 0;
]
/ blocks = [1 = block.myblock]
/ groups = (1 of 2)
</expt>

<expt b>
/ onexptbegin = [
    values.index = 339;
]
/ blocks = [1 = block.myblock]
/ groups = (2 of 2)
</expt>


The example script works beautifully, thanks Dave!  However, when I try to apply this approach to my actual experiment the list.rt_359.currentindex never iterates.  The index iterates successfully where it is supposed to.  Any ideas?  Would you like to see my full script?  It's a bear.

Andrew

https://github.com/andrewpapale/Clock_v2/blob/main/EEG_clock_v2_0_4.iqx

Maybe you could be so kind and point out the relevant parts of the code and show what exactly you implemented where and how. It would also be nice if you could provide some kind of packaged up version of the script that contains all files it needs to run. I'd rather not spend time trying to figure out what I would or would not need from the Github repo. Thanks.
By AndrewPapale - 9/19/2023

Dave - 9/19/2023
Andrew Papale - 9/19/2023
Andrew Papale - 9/19/2023
Dave - 9/19/2023
Dave - 9/19/2023
Andrew Papale - 9/18/2023
Dear Inquisit Team,

I have a list:
<list rt_359>
/ items = ( 42, 41, 42, 39, 37, 38, 31, 35, 28, 25, 20, 17, 21, 29, 25, 28, 36, 39, 36, 37, 38, 38, 36, 36, 35, 26, 29, 24, 28, 28, 31, 32, 36, 38, 38, 42, 44, 52, 56, 58, 62, 54, 65, 78, 83, 90, 92, 105, 127, 126, 147, 163, 161, 149, 143, 139, 141, 143, 161, 161, 159, 160, 158, 136, 129, 116, 127, 126, 132, 119, 111, 112, 111, 104, 97, 90, 80, 70, 62, 48, 48, 47, 45, 42, 40, 37, 36, 37, 34, 39, 38, 34, 34, 30, 28, 25, 20, 18, 19, 19, 10, 11, 5, 8, 11, 14, 20, 25, 33, 39, 41, 42, 41, 41, 43, 64, 76, 89, 101, 113, 126, 135, 138, 149, 143, 156, 160, 159, 163, 162, 163, 163, 163, 157, 160, 162, 161, 162, 149, 151, 155, 161, 161, 156, 159, 155, 149, 131, 118, 103, 97, 89, 76, 48, 47, 46, 46, 45, 44, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 42, 42, 40, 34, 33, 37, 28, 28, 33, 35, 34, 30, 28, 33, 34, 35, 35, 36, 39, 42, 47, 46, 43, 41, 41, 41, 39, 37, 40, 39, 30, 20, 17, 11, 19, 21, 19, 10, 9, 5, 6, 3, 6, 4, 3, 3, 3, 4, 3, 7, 11, 16, 20, 24, 28, 32, 36, 40, 48, 47, 46, 45, 45, 44, 43, 42, 40, 40, 40, 41, 40, 36, 38, 39, 38, 36, 37, 33, 31, 33, 31, 32, 30, 28, 28, 30, 31, 37, 40, 39, 39, 44, 45, 46, 47, 52, 54, 54, 61, 62, 77, 89, 94, 81, 76, 84, 91, 86, 107, 84, 99, 110, 86, 81, 62, 67, 53, 47, 62, 68, 57, 43, 44, 44, 46, 44, 58, 50, 50, 45, 46, 44, 41, 38, 35, 35, 34, 32, 27, 23, 21, 22, 17, 16, 9, 8, 8, 5, 6, 4, 3, 3, 3, 3, 3, 4, 4, 9, 14, 18, 22, 27, 32, 37, 41, 44, 41, 38, 39, 37,35)
/ poolsize = 316
/ selectionmode = sequence
</list>

For each trial, I want the list to advance by one value.  This is working fine with the current code.

Now, for different groups in my experiment, I want to start the list at a different index.  e.g. group 1 starts at index 1 (42) group 2 starts at index 50 (105), etc.  Is this possible?  I could not find a way to do it.

Thanks,
Andrew

You can use a value to determine the list's selection, like you can do basically anywhere else.

I.e.

<values>
/ index = 0
</values>

with

<list rt_359>
...
/ selectionmode = values.index
</list>

Increment the value bye one in every trial, which does the same thing as selecting sequentially. Set the value to whatever start value you need for each group you have, be it 0, 49, or whatever else the case may be.

Here's a runnable example. First group gets index 1 in the first trial, second group gets inex 340 in the first trial, so you can see how things wrap around (the list has 345 items, so once you've shown item 345, you need to wrap around back to item 1).

<values>
/ index = 0
</values>

<list rt_359>
/ items = ( 42, 41, 42, 39, 37, 38, 31, 35, 28, 25, 20, 17, 21, 29, 25, 28, 36, 39, 36, 37, 38, 38, 36, 36, 35, 26, 29, 24, 28, 28, 31, 32, 36, 38, 38, 42, 44, 52, 56, 58, 62, 54, 65, 78, 83, 90, 92, 105, 127, 126, 147, 163, 161, 149, 143, 139, 141, 143, 161, 161, 159, 160, 158, 136, 129, 116, 127, 126, 132, 119, 111, 112, 111, 104, 97, 90, 80, 70, 62, 48, 48, 47, 45, 42, 40, 37, 36, 37, 34, 39, 38, 34, 34, 30, 28, 25, 20, 18, 19, 19, 10, 11, 5, 8, 11, 14, 20, 25, 33, 39, 41, 42, 41, 41, 43, 64, 76, 89, 101, 113, 126, 135, 138, 149, 143, 156, 160, 159, 163, 162, 163, 163, 163, 157, 160, 162, 161, 162, 149, 151, 155, 161, 161, 156, 159, 155, 149, 131, 118, 103, 97, 89, 76, 48, 47, 46, 46, 45, 44, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 42, 42, 40, 34, 33, 37, 28, 28, 33, 35, 34, 30, 28, 33, 34, 35, 35, 36, 39, 42, 47, 46, 43, 41, 41, 41, 39, 37, 40, 39, 30, 20, 17, 11, 19, 21, 19, 10, 9, 5, 6, 3, 6, 4, 3, 3, 3, 4, 3, 7, 11, 16, 20, 24, 28, 32, 36, 40, 48, 47, 46, 45, 45, 44, 43, 42, 40, 40, 40, 41, 40, 36, 38, 39, 38, 36, 37, 33, 31, 33, 31, 32, 30, 28, 28, 30, 31, 37, 40, 39, 39, 44, 45, 46, 47, 52, 54, 54, 61, 62, 77, 89, 94, 81, 76, 84, 91, 86, 107, 84, 99, 110, 86, 81, 62, 67, 53, 47, 62, 68, 57, 43, 44, 44, 46, 44, 58, 50, 50, 45, 46, 44, 41, 38, 35, 35, 34, 32, 27, 23, 21, 22, 17, 16, 9, 8, 8, 5, 6, 4, 3, 3, 3, 3, 3, 4, 4, 9, 14, 18, 22, 27, 32, 37, 41, 44, 41, 38, 39, 37,35)
/ selectionmode = values.index
</list>

<trial mytrial>
/ ontrialbegin = [
    values.index += 1; // increment index by 1
    values.index = mod(values.index - 1, list.rt_359.itemcount) + 1; // make sure we wrap around to index 1
]
/ stimulusframes = [1=text.mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("List value: <%list.rt_359.nextvalue%> | List index: <%list.rt_359.currentindex%> (<%values.index%>) | Group: <%script.groupid%>")
</text>

<block myblock>
/ trials = [1-345 = trial.mytrial]
</block>

<expt a>
/ onexptbegin = [
    values.index = 0;
]
/ blocks = [1 = block.myblock]
/ groups = (1 of 2)
</expt>

<expt b>
/ onexptbegin = [
    values.index = 339;
]
/ blocks = [1 = block.myblock]
/ groups = (2 of 2)
</expt>


The example script works beautifully, thanks Dave!  However, when I try to apply this approach to my actual experiment the list.rt_359.currentindex never iterates.  The index iterates successfully where it is supposed to.  Any ideas?  Would you like to see my full script?  It's a bear.

Andrew

https://github.com/andrewpapale/Clock_v2/blob/main/EEG_clock_v2_0_4.iqx

Maybe you could be so kind and point out the relevant parts of the code and show what exactly you implemented where and how. It would also be nice if you could provide some kind of packaged up version of the script that contains all files it needs to run. I'd rather not spend time trying to figure out what I would or would not need from the Github repo. Thanks.

Thanks.  Understood.  I think I will break it down and try a simplified version and then build up and see at what point it breaks.  I think I can figure this out.
By Dave - 9/19/2023

Andrew Papale - 9/19/2023
Dave - 9/19/2023
Andrew Papale - 9/19/2023
Andrew Papale - 9/19/2023
Dave - 9/19/2023
Dave - 9/19/2023
Andrew Papale - 9/18/2023
Dear Inquisit Team,

I have a list:
<list rt_359>
/ items = ( 42, 41, 42, 39, 37, 38, 31, 35, 28, 25, 20, 17, 21, 29, 25, 28, 36, 39, 36, 37, 38, 38, 36, 36, 35, 26, 29, 24, 28, 28, 31, 32, 36, 38, 38, 42, 44, 52, 56, 58, 62, 54, 65, 78, 83, 90, 92, 105, 127, 126, 147, 163, 161, 149, 143, 139, 141, 143, 161, 161, 159, 160, 158, 136, 129, 116, 127, 126, 132, 119, 111, 112, 111, 104, 97, 90, 80, 70, 62, 48, 48, 47, 45, 42, 40, 37, 36, 37, 34, 39, 38, 34, 34, 30, 28, 25, 20, 18, 19, 19, 10, 11, 5, 8, 11, 14, 20, 25, 33, 39, 41, 42, 41, 41, 43, 64, 76, 89, 101, 113, 126, 135, 138, 149, 143, 156, 160, 159, 163, 162, 163, 163, 163, 157, 160, 162, 161, 162, 149, 151, 155, 161, 161, 156, 159, 155, 149, 131, 118, 103, 97, 89, 76, 48, 47, 46, 46, 45, 44, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 42, 42, 40, 34, 33, 37, 28, 28, 33, 35, 34, 30, 28, 33, 34, 35, 35, 36, 39, 42, 47, 46, 43, 41, 41, 41, 39, 37, 40, 39, 30, 20, 17, 11, 19, 21, 19, 10, 9, 5, 6, 3, 6, 4, 3, 3, 3, 4, 3, 7, 11, 16, 20, 24, 28, 32, 36, 40, 48, 47, 46, 45, 45, 44, 43, 42, 40, 40, 40, 41, 40, 36, 38, 39, 38, 36, 37, 33, 31, 33, 31, 32, 30, 28, 28, 30, 31, 37, 40, 39, 39, 44, 45, 46, 47, 52, 54, 54, 61, 62, 77, 89, 94, 81, 76, 84, 91, 86, 107, 84, 99, 110, 86, 81, 62, 67, 53, 47, 62, 68, 57, 43, 44, 44, 46, 44, 58, 50, 50, 45, 46, 44, 41, 38, 35, 35, 34, 32, 27, 23, 21, 22, 17, 16, 9, 8, 8, 5, 6, 4, 3, 3, 3, 3, 3, 4, 4, 9, 14, 18, 22, 27, 32, 37, 41, 44, 41, 38, 39, 37,35)
/ poolsize = 316
/ selectionmode = sequence
</list>

For each trial, I want the list to advance by one value.  This is working fine with the current code.

Now, for different groups in my experiment, I want to start the list at a different index.  e.g. group 1 starts at index 1 (42) group 2 starts at index 50 (105), etc.  Is this possible?  I could not find a way to do it.

Thanks,
Andrew

You can use a value to determine the list's selection, like you can do basically anywhere else.

I.e.

<values>
/ index = 0
</values>

with

<list rt_359>
...
/ selectionmode = values.index
</list>

Increment the value bye one in every trial, which does the same thing as selecting sequentially. Set the value to whatever start value you need for each group you have, be it 0, 49, or whatever else the case may be.

Here's a runnable example. First group gets index 1 in the first trial, second group gets inex 340 in the first trial, so you can see how things wrap around (the list has 345 items, so once you've shown item 345, you need to wrap around back to item 1).

<values>
/ index = 0
</values>

<list rt_359>
/ items = ( 42, 41, 42, 39, 37, 38, 31, 35, 28, 25, 20, 17, 21, 29, 25, 28, 36, 39, 36, 37, 38, 38, 36, 36, 35, 26, 29, 24, 28, 28, 31, 32, 36, 38, 38, 42, 44, 52, 56, 58, 62, 54, 65, 78, 83, 90, 92, 105, 127, 126, 147, 163, 161, 149, 143, 139, 141, 143, 161, 161, 159, 160, 158, 136, 129, 116, 127, 126, 132, 119, 111, 112, 111, 104, 97, 90, 80, 70, 62, 48, 48, 47, 45, 42, 40, 37, 36, 37, 34, 39, 38, 34, 34, 30, 28, 25, 20, 18, 19, 19, 10, 11, 5, 8, 11, 14, 20, 25, 33, 39, 41, 42, 41, 41, 43, 64, 76, 89, 101, 113, 126, 135, 138, 149, 143, 156, 160, 159, 163, 162, 163, 163, 163, 157, 160, 162, 161, 162, 149, 151, 155, 161, 161, 156, 159, 155, 149, 131, 118, 103, 97, 89, 76, 48, 47, 46, 46, 45, 44, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 42, 42, 40, 34, 33, 37, 28, 28, 33, 35, 34, 30, 28, 33, 34, 35, 35, 36, 39, 42, 47, 46, 43, 41, 41, 41, 39, 37, 40, 39, 30, 20, 17, 11, 19, 21, 19, 10, 9, 5, 6, 3, 6, 4, 3, 3, 3, 4, 3, 7, 11, 16, 20, 24, 28, 32, 36, 40, 48, 47, 46, 45, 45, 44, 43, 42, 40, 40, 40, 41, 40, 36, 38, 39, 38, 36, 37, 33, 31, 33, 31, 32, 30, 28, 28, 30, 31, 37, 40, 39, 39, 44, 45, 46, 47, 52, 54, 54, 61, 62, 77, 89, 94, 81, 76, 84, 91, 86, 107, 84, 99, 110, 86, 81, 62, 67, 53, 47, 62, 68, 57, 43, 44, 44, 46, 44, 58, 50, 50, 45, 46, 44, 41, 38, 35, 35, 34, 32, 27, 23, 21, 22, 17, 16, 9, 8, 8, 5, 6, 4, 3, 3, 3, 3, 3, 4, 4, 9, 14, 18, 22, 27, 32, 37, 41, 44, 41, 38, 39, 37,35)
/ selectionmode = values.index
</list>

<trial mytrial>
/ ontrialbegin = [
    values.index += 1; // increment index by 1
    values.index = mod(values.index - 1, list.rt_359.itemcount) + 1; // make sure we wrap around to index 1
]
/ stimulusframes = [1=text.mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("List value: <%list.rt_359.nextvalue%> | List index: <%list.rt_359.currentindex%> (<%values.index%>) | Group: <%script.groupid%>")
</text>

<block myblock>
/ trials = [1-345 = trial.mytrial]
</block>

<expt a>
/ onexptbegin = [
    values.index = 0;
]
/ blocks = [1 = block.myblock]
/ groups = (1 of 2)
</expt>

<expt b>
/ onexptbegin = [
    values.index = 339;
]
/ blocks = [1 = block.myblock]
/ groups = (2 of 2)
</expt>


The example script works beautifully, thanks Dave!  However, when I try to apply this approach to my actual experiment the list.rt_359.currentindex never iterates.  The index iterates successfully where it is supposed to.  Any ideas?  Would you like to see my full script?  It's a bear.

Andrew

https://github.com/andrewpapale/Clock_v2/blob/main/EEG_clock_v2_0_4.iqx

Maybe you could be so kind and point out the relevant parts of the code and show what exactly you implemented where and how. It would also be nice if you could provide some kind of packaged up version of the script that contains all files it needs to run. I'd rather not spend time trying to figure out what I would or would not need from the Github repo. Thanks.

Thanks.  Understood.  I think I will break it down and try a simplified version and then build up and see at what point it breaks.  I think I can figure this out.

Glancing at the script, I don't see any place where you actually sample a value from the respective lists (of which there appear to be many). You use currentvalue throughout



but currentvalue does not effectuate a sample from the list. nextvalue does.

By AndrewPapale - 9/19/2023

Dave - 9/19/2023
Andrew Papale - 9/19/2023
Dave - 9/19/2023
Andrew Papale - 9/19/2023
Andrew Papale - 9/19/2023
Dave - 9/19/2023
Dave - 9/19/2023
Andrew Papale - 9/18/2023
Dear Inquisit Team,

I have a list:
<list rt_359>
/ items = ( 42, 41, 42, 39, 37, 38, 31, 35, 28, 25, 20, 17, 21, 29, 25, 28, 36, 39, 36, 37, 38, 38, 36, 36, 35, 26, 29, 24, 28, 28, 31, 32, 36, 38, 38, 42, 44, 52, 56, 58, 62, 54, 65, 78, 83, 90, 92, 105, 127, 126, 147, 163, 161, 149, 143, 139, 141, 143, 161, 161, 159, 160, 158, 136, 129, 116, 127, 126, 132, 119, 111, 112, 111, 104, 97, 90, 80, 70, 62, 48, 48, 47, 45, 42, 40, 37, 36, 37, 34, 39, 38, 34, 34, 30, 28, 25, 20, 18, 19, 19, 10, 11, 5, 8, 11, 14, 20, 25, 33, 39, 41, 42, 41, 41, 43, 64, 76, 89, 101, 113, 126, 135, 138, 149, 143, 156, 160, 159, 163, 162, 163, 163, 163, 157, 160, 162, 161, 162, 149, 151, 155, 161, 161, 156, 159, 155, 149, 131, 118, 103, 97, 89, 76, 48, 47, 46, 46, 45, 44, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 42, 42, 40, 34, 33, 37, 28, 28, 33, 35, 34, 30, 28, 33, 34, 35, 35, 36, 39, 42, 47, 46, 43, 41, 41, 41, 39, 37, 40, 39, 30, 20, 17, 11, 19, 21, 19, 10, 9, 5, 6, 3, 6, 4, 3, 3, 3, 4, 3, 7, 11, 16, 20, 24, 28, 32, 36, 40, 48, 47, 46, 45, 45, 44, 43, 42, 40, 40, 40, 41, 40, 36, 38, 39, 38, 36, 37, 33, 31, 33, 31, 32, 30, 28, 28, 30, 31, 37, 40, 39, 39, 44, 45, 46, 47, 52, 54, 54, 61, 62, 77, 89, 94, 81, 76, 84, 91, 86, 107, 84, 99, 110, 86, 81, 62, 67, 53, 47, 62, 68, 57, 43, 44, 44, 46, 44, 58, 50, 50, 45, 46, 44, 41, 38, 35, 35, 34, 32, 27, 23, 21, 22, 17, 16, 9, 8, 8, 5, 6, 4, 3, 3, 3, 3, 3, 4, 4, 9, 14, 18, 22, 27, 32, 37, 41, 44, 41, 38, 39, 37,35)
/ poolsize = 316
/ selectionmode = sequence
</list>

For each trial, I want the list to advance by one value.  This is working fine with the current code.

Now, for different groups in my experiment, I want to start the list at a different index.  e.g. group 1 starts at index 1 (42) group 2 starts at index 50 (105), etc.  Is this possible?  I could not find a way to do it.

Thanks,
Andrew

You can use a value to determine the list's selection, like you can do basically anywhere else.

I.e.

<values>
/ index = 0
</values>

with

<list rt_359>
...
/ selectionmode = values.index
</list>

Increment the value bye one in every trial, which does the same thing as selecting sequentially. Set the value to whatever start value you need for each group you have, be it 0, 49, or whatever else the case may be.

Here's a runnable example. First group gets index 1 in the first trial, second group gets inex 340 in the first trial, so you can see how things wrap around (the list has 345 items, so once you've shown item 345, you need to wrap around back to item 1).

<values>
/ index = 0
</values>

<list rt_359>
/ items = ( 42, 41, 42, 39, 37, 38, 31, 35, 28, 25, 20, 17, 21, 29, 25, 28, 36, 39, 36, 37, 38, 38, 36, 36, 35, 26, 29, 24, 28, 28, 31, 32, 36, 38, 38, 42, 44, 52, 56, 58, 62, 54, 65, 78, 83, 90, 92, 105, 127, 126, 147, 163, 161, 149, 143, 139, 141, 143, 161, 161, 159, 160, 158, 136, 129, 116, 127, 126, 132, 119, 111, 112, 111, 104, 97, 90, 80, 70, 62, 48, 48, 47, 45, 42, 40, 37, 36, 37, 34, 39, 38, 34, 34, 30, 28, 25, 20, 18, 19, 19, 10, 11, 5, 8, 11, 14, 20, 25, 33, 39, 41, 42, 41, 41, 43, 64, 76, 89, 101, 113, 126, 135, 138, 149, 143, 156, 160, 159, 163, 162, 163, 163, 163, 157, 160, 162, 161, 162, 149, 151, 155, 161, 161, 156, 159, 155, 149, 131, 118, 103, 97, 89, 76, 48, 47, 46, 46, 45, 44, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 42, 42, 40, 34, 33, 37, 28, 28, 33, 35, 34, 30, 28, 33, 34, 35, 35, 36, 39, 42, 47, 46, 43, 41, 41, 41, 39, 37, 40, 39, 30, 20, 17, 11, 19, 21, 19, 10, 9, 5, 6, 3, 6, 4, 3, 3, 3, 4, 3, 7, 11, 16, 20, 24, 28, 32, 36, 40, 48, 47, 46, 45, 45, 44, 43, 42, 40, 40, 40, 41, 40, 36, 38, 39, 38, 36, 37, 33, 31, 33, 31, 32, 30, 28, 28, 30, 31, 37, 40, 39, 39, 44, 45, 46, 47, 52, 54, 54, 61, 62, 77, 89, 94, 81, 76, 84, 91, 86, 107, 84, 99, 110, 86, 81, 62, 67, 53, 47, 62, 68, 57, 43, 44, 44, 46, 44, 58, 50, 50, 45, 46, 44, 41, 38, 35, 35, 34, 32, 27, 23, 21, 22, 17, 16, 9, 8, 8, 5, 6, 4, 3, 3, 3, 3, 3, 4, 4, 9, 14, 18, 22, 27, 32, 37, 41, 44, 41, 38, 39, 37,35)
/ selectionmode = values.index
</list>

<trial mytrial>
/ ontrialbegin = [
    values.index += 1; // increment index by 1
    values.index = mod(values.index - 1, list.rt_359.itemcount) + 1; // make sure we wrap around to index 1
]
/ stimulusframes = [1=text.mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("List value: <%list.rt_359.nextvalue%> | List index: <%list.rt_359.currentindex%> (<%values.index%>) | Group: <%script.groupid%>")
</text>

<block myblock>
/ trials = [1-345 = trial.mytrial]
</block>

<expt a>
/ onexptbegin = [
    values.index = 0;
]
/ blocks = [1 = block.myblock]
/ groups = (1 of 2)
</expt>

<expt b>
/ onexptbegin = [
    values.index = 339;
]
/ blocks = [1 = block.myblock]
/ groups = (2 of 2)
</expt>


The example script works beautifully, thanks Dave!  However, when I try to apply this approach to my actual experiment the list.rt_359.currentindex never iterates.  The index iterates successfully where it is supposed to.  Any ideas?  Would you like to see my full script?  It's a bear.

Andrew

https://github.com/andrewpapale/Clock_v2/blob/main/EEG_clock_v2_0_4.iqx

Maybe you could be so kind and point out the relevant parts of the code and show what exactly you implemented where and how. It would also be nice if you could provide some kind of packaged up version of the script that contains all files it needs to run. I'd rather not spend time trying to figure out what I would or would not need from the Github repo. Thanks.

Thanks.  Understood.  I think I will break it down and try a simplified version and then build up and see at what point it breaks.  I think I can figure this out.

Glancing at the script, I don't see any place where you actually sample a value from the respective lists (of which there appear to be many). You use currentvalue throughout



but currentvalue does not effectuate a sample from the list. nextvalue does.


Thanks, wasn't really clear on the nextvalue vs currentvalue distinction.

That worked.  Thanks.  The list indices still aren't updating for some reason, but the list value matches values.index.
By AndrewPapale - 9/19/2023

Andrew Papale - 9/19/2023
Dave - 9/19/2023
Andrew Papale - 9/19/2023
Dave - 9/19/2023
Andrew Papale - 9/19/2023
Andrew Papale - 9/19/2023
Dave - 9/19/2023
Dave - 9/19/2023
Andrew Papale - 9/18/2023
Dear Inquisit Team,

I have a list:
<list rt_359>
/ items = ( 42, 41, 42, 39, 37, 38, 31, 35, 28, 25, 20, 17, 21, 29, 25, 28, 36, 39, 36, 37, 38, 38, 36, 36, 35, 26, 29, 24, 28, 28, 31, 32, 36, 38, 38, 42, 44, 52, 56, 58, 62, 54, 65, 78, 83, 90, 92, 105, 127, 126, 147, 163, 161, 149, 143, 139, 141, 143, 161, 161, 159, 160, 158, 136, 129, 116, 127, 126, 132, 119, 111, 112, 111, 104, 97, 90, 80, 70, 62, 48, 48, 47, 45, 42, 40, 37, 36, 37, 34, 39, 38, 34, 34, 30, 28, 25, 20, 18, 19, 19, 10, 11, 5, 8, 11, 14, 20, 25, 33, 39, 41, 42, 41, 41, 43, 64, 76, 89, 101, 113, 126, 135, 138, 149, 143, 156, 160, 159, 163, 162, 163, 163, 163, 157, 160, 162, 161, 162, 149, 151, 155, 161, 161, 156, 159, 155, 149, 131, 118, 103, 97, 89, 76, 48, 47, 46, 46, 45, 44, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 42, 42, 40, 34, 33, 37, 28, 28, 33, 35, 34, 30, 28, 33, 34, 35, 35, 36, 39, 42, 47, 46, 43, 41, 41, 41, 39, 37, 40, 39, 30, 20, 17, 11, 19, 21, 19, 10, 9, 5, 6, 3, 6, 4, 3, 3, 3, 4, 3, 7, 11, 16, 20, 24, 28, 32, 36, 40, 48, 47, 46, 45, 45, 44, 43, 42, 40, 40, 40, 41, 40, 36, 38, 39, 38, 36, 37, 33, 31, 33, 31, 32, 30, 28, 28, 30, 31, 37, 40, 39, 39, 44, 45, 46, 47, 52, 54, 54, 61, 62, 77, 89, 94, 81, 76, 84, 91, 86, 107, 84, 99, 110, 86, 81, 62, 67, 53, 47, 62, 68, 57, 43, 44, 44, 46, 44, 58, 50, 50, 45, 46, 44, 41, 38, 35, 35, 34, 32, 27, 23, 21, 22, 17, 16, 9, 8, 8, 5, 6, 4, 3, 3, 3, 3, 3, 4, 4, 9, 14, 18, 22, 27, 32, 37, 41, 44, 41, 38, 39, 37,35)
/ poolsize = 316
/ selectionmode = sequence
</list>

For each trial, I want the list to advance by one value.  This is working fine with the current code.

Now, for different groups in my experiment, I want to start the list at a different index.  e.g. group 1 starts at index 1 (42) group 2 starts at index 50 (105), etc.  Is this possible?  I could not find a way to do it.

Thanks,
Andrew

You can use a value to determine the list's selection, like you can do basically anywhere else.

I.e.

<values>
/ index = 0
</values>

with

<list rt_359>
...
/ selectionmode = values.index
</list>

Increment the value bye one in every trial, which does the same thing as selecting sequentially. Set the value to whatever start value you need for each group you have, be it 0, 49, or whatever else the case may be.

Here's a runnable example. First group gets index 1 in the first trial, second group gets inex 340 in the first trial, so you can see how things wrap around (the list has 345 items, so once you've shown item 345, you need to wrap around back to item 1).

<values>
/ index = 0
</values>

<list rt_359>
/ items = ( 42, 41, 42, 39, 37, 38, 31, 35, 28, 25, 20, 17, 21, 29, 25, 28, 36, 39, 36, 37, 38, 38, 36, 36, 35, 26, 29, 24, 28, 28, 31, 32, 36, 38, 38, 42, 44, 52, 56, 58, 62, 54, 65, 78, 83, 90, 92, 105, 127, 126, 147, 163, 161, 149, 143, 139, 141, 143, 161, 161, 159, 160, 158, 136, 129, 116, 127, 126, 132, 119, 111, 112, 111, 104, 97, 90, 80, 70, 62, 48, 48, 47, 45, 42, 40, 37, 36, 37, 34, 39, 38, 34, 34, 30, 28, 25, 20, 18, 19, 19, 10, 11, 5, 8, 11, 14, 20, 25, 33, 39, 41, 42, 41, 41, 43, 64, 76, 89, 101, 113, 126, 135, 138, 149, 143, 156, 160, 159, 163, 162, 163, 163, 163, 157, 160, 162, 161, 162, 149, 151, 155, 161, 161, 156, 159, 155, 149, 131, 118, 103, 97, 89, 76, 48, 47, 46, 46, 45, 44, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 42, 42, 40, 34, 33, 37, 28, 28, 33, 35, 34, 30, 28, 33, 34, 35, 35, 36, 39, 42, 47, 46, 43, 41, 41, 41, 39, 37, 40, 39, 30, 20, 17, 11, 19, 21, 19, 10, 9, 5, 6, 3, 6, 4, 3, 3, 3, 4, 3, 7, 11, 16, 20, 24, 28, 32, 36, 40, 48, 47, 46, 45, 45, 44, 43, 42, 40, 40, 40, 41, 40, 36, 38, 39, 38, 36, 37, 33, 31, 33, 31, 32, 30, 28, 28, 30, 31, 37, 40, 39, 39, 44, 45, 46, 47, 52, 54, 54, 61, 62, 77, 89, 94, 81, 76, 84, 91, 86, 107, 84, 99, 110, 86, 81, 62, 67, 53, 47, 62, 68, 57, 43, 44, 44, 46, 44, 58, 50, 50, 45, 46, 44, 41, 38, 35, 35, 34, 32, 27, 23, 21, 22, 17, 16, 9, 8, 8, 5, 6, 4, 3, 3, 3, 3, 3, 4, 4, 9, 14, 18, 22, 27, 32, 37, 41, 44, 41, 38, 39, 37,35)
/ selectionmode = values.index
</list>

<trial mytrial>
/ ontrialbegin = [
    values.index += 1; // increment index by 1
    values.index = mod(values.index - 1, list.rt_359.itemcount) + 1; // make sure we wrap around to index 1
]
/ stimulusframes = [1=text.mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("List value: <%list.rt_359.nextvalue%> | List index: <%list.rt_359.currentindex%> (<%values.index%>) | Group: <%script.groupid%>")
</text>

<block myblock>
/ trials = [1-345 = trial.mytrial]
</block>

<expt a>
/ onexptbegin = [
    values.index = 0;
]
/ blocks = [1 = block.myblock]
/ groups = (1 of 2)
</expt>

<expt b>
/ onexptbegin = [
    values.index = 339;
]
/ blocks = [1 = block.myblock]
/ groups = (2 of 2)
</expt>


The example script works beautifully, thanks Dave!  However, when I try to apply this approach to my actual experiment the list.rt_359.currentindex never iterates.  The index iterates successfully where it is supposed to.  Any ideas?  Would you like to see my full script?  It's a bear.

Andrew

https://github.com/andrewpapale/Clock_v2/blob/main/EEG_clock_v2_0_4.iqx

Maybe you could be so kind and point out the relevant parts of the code and show what exactly you implemented where and how. It would also be nice if you could provide some kind of packaged up version of the script that contains all files it needs to run. I'd rather not spend time trying to figure out what I would or would not need from the Github repo. Thanks.

Thanks.  Understood.  I think I will break it down and try a simplified version and then build up and see at what point it breaks.  I think I can figure this out.

Glancing at the script, I don't see any place where you actually sample a value from the respective lists (of which there appear to be many). You use currentvalue throughout



but currentvalue does not effectuate a sample from the list. nextvalue does.


Thanks, wasn't really clear on the nextvalue vs currentvalue distinction.

That worked.  Thanks.  The list indices still aren't updating for some reason, but the list value matches values.index.

Adding in :

    list.rt_0.nextindex;
    list.rt_1.nextindex;
    list.rt_2.nextindex;
    .....


to <trial ITI>

after updating values.index

fixes it.  Thanks so much.