Linking items across lists


Author
Message
Greeny
Greeny
Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)
Group: Forum Members
Posts: 14, Visits: 51
Hi Dave,

In the following script I am attempting to present a series of pictures where the 'USPx' picture always pulls the same number within a trial. The sequence is CS1-CS1USPx-USPx-CS2USPx-CS2, where x should be the same number each time within a trial. The current script pulls CS1USPx and then any of the 4 USP pictures (so USP1, USP2 etc.) instead of pulling USP1 if the previous picture was CS1USP1, or USP2 if the previous picture was CS1USP2. The USPx-CS2USPx part is working as desired as whatever USPx is CS2USPx pulls the same number. It is just the first CS1USPx-USPx part that is not linking properly. Are you able to spot my error? 

" <values>
/pleasantitemnumber = 0
/unpleasantitemnumber = 0
/Fpleasantoverlapitemnumber = 0
/Funpleasantoverlapitemnumber = 0
/Bpleasantoverlapitemnumber = 0
/Bunpleasantoverlapitemnumber = 0
</values>

<item FCSP>
/1 = "CS1.jpg"
</item>

<picture FCSP>
/items = FCSP
/select = replace
</picture>

<item FCSU>
/1 = "CS2.jpg"
</item>

<picture FCSU>
/items = FCSU
/select = replace
</picture>

<item BCSP>
/1 = "CS3.jpg"
</item>

<picture BCSP>
/items = BCSP
/select = replace
</picture>

<item BCSU>
/1 = "CS4.jpg"
</item>

<picture BCSU>
/items = BCSU
/select = replace
</picture>

######################### USs #########################

<item pleasant>
/1 = "USP1.jpg"
/2 = "USP2.jpg"
/3 = "USP3.jpg"
/4 = "USP4.jpg"
</item>

<picture pleasant>
/items = pleasant
/select = values.pleasantitemnumber
</picture>

<item unpleasant>
/1 = "USU1.jpg"
/2 = "USU2.jpg"
/3 = "USU3.jpg"
/4 = "USU4.jpg"
</item>

<picture unpleasant>
/items = unpleasant
/select = values.unpleasantitemnumber
</picture>

######################### OVERLAPS #########################

<item Fpleasantoverlap>
/1 = "CS1USP1.jpg"
/2 = "CS1USP2.jpg"
/3 = "CS1USP3.jpg"
/4 = "CS1USP4.jpg"
</item>

<picture Fpleasantoverlap>
/items = Fpleasantoverlap
/select = values.Fpleasantoverlapitemnumber
</picture>

<item Funpleasantoverlap>
/1 = "CS2USU1.jpg"
/2 = "CS2USU2.jpg"
/3 = "CS2USU3.jpg"
/4 = "CS2USU4.jpg"
</item>

<picture Funpleasantoverlap>
/items = Funpleasantoverlap
/select = values.Funpleasantoverlapitemnumber
</picture>

<item Bpleasantoverlap>
/1 = "CS3USP1.jpg"
/2 = "CS3USP2.jpg"
/3 = "CS3USP3.jpg"
/4 = "CS3USP4.jpg"
</item>

<picture Bpleasantoverlap>
/items = Bpleasantoverlap
/select = values.Bpleasantoverlapitemnumber
</picture>

<item Bunpleasantoverlap>
/1 = "CS4USU1.jpg"
/2 = "CS4USU2.jpg"
/3 = "CS4USU3.jpg"
/4 = "CS4USU4.jpg"
</item>

<picture Bunpleasantoverlap>
/items = Bunpleasantoverlap
/select = values.Bunpleasantoverlapitemnumber
</picture>

######################### LISTS #########################

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

<list FpleasantoverlapCSUS>
/ items = (1, 2, 3, 4)
/ selectionmode = list.Fpleasantoverlapus.currentindex
</list>

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

<list FunpleasantoverlapCSUS>
/ items = (1, 2, 3, 4)
/ selectionmode = list.Funpleasantoverlapus.currentindex
</list>

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

<list BpleasantoverlapCSUS>
/ items = (1, 2, 3, 4)
/ selectionmode = list.Bpleasantoverlapus.currentindex
</list>

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

<list BunpleasantoverlapCSUS>
/ items = (1, 2, 3, 4)
/ selectionmode = list.Bunpleasantoverlapus.currentindex
</list>

######################### Eraser for flashing pictures #########################

<shape eraser>
/shape = rectangle
/size = (100%, 100%)
/erase = false
/color = (220, 220, 220)
</shape>


######################### Trials #########################

<trial CSPpleasant>
/stimulustimes = [0=FCSP; 4000=Fpleasantoverlap; 5000=eraser; 5200=pleasant; 6200=eraser; 6400=pleasant; 7400=eraser; 7600=pleasant;
8600=eraser; 8800=Bpleasantoverlap; 9800=eraser, BCSP]
/ontrialbegin = [
values.pleasantitemnumber = list.FpleasantoverlapUS.nextvalue;
values.pleasantitemnumber = list.BpleasantoverlapUS.nextvalue;
values.Fpleasantoverlapitemnumber = list.Fpleasantoverlapcsus.nextvalue;
values.Bpleasantoverlapitemnumber = list.Bpleasantoverlapcsus.nextvalue]
/timeout = 13800
/posttrialpause = expressions.randposttrialpause
</trial>

<trial CSUunpleasant>
/stimulustimes = [0=FCSU; 4000=Funpleasantoverlap; 5000=eraser; 5200=unpleasant; 6200=eraser; 6400=unpleasant; 7400=eraser; 7600=unpleasant;
8600=eraser; 8800=Bunpleasantoverlap; 9800=eraser, BCSU]
/ontrialbegin = [
values.unpleasantitemnumber = list.FunpleasantoverlapUS.nextvalue;
values.unpleasantitemnumber = list.BunpleasantoverlapUS.nextvalue;
values.Funpleasantoverlapitemnumber = list.Funpleasantoverlapcsus.nextvalue;
values.Bunpleasantoverlapitemnumber = list.Bunpleasantoverlapcsus.nextvalue]
/timeout = 13800
/posttrialpause = expressions.randposttrialpause
</trial>

<expressions>
/randposttrialpause = replace(4000, 5000, 6000)
</expressions> "

Thanks,
Luke
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: 13K, Visits: 104K
Greeny - 7/29/2019
Hi Dave,

In the following script I am attempting to present a series of pictures where the 'USPx' picture always pulls the same number within a trial. The sequence is CS1-CS1USPx-USPx-CS2USPx-CS2, where x should be the same number each time within a trial. The current script pulls CS1USPx and then any of the 4 USP pictures (so USP1, USP2 etc.) instead of pulling USP1 if the previous picture was CS1USP1, or USP2 if the previous picture was CS1USP2. The USPx-CS2USPx part is working as desired as whatever USPx is CS2USPx pulls the same number. It is just the first CS1USPx-USPx part that is not linking properly. Are you able to spot my error? 

" <values>
/pleasantitemnumber = 0
/unpleasantitemnumber = 0
/Fpleasantoverlapitemnumber = 0
/Funpleasantoverlapitemnumber = 0
/Bpleasantoverlapitemnumber = 0
/Bunpleasantoverlapitemnumber = 0
</values>

<item FCSP>
/1 = "CS1.jpg"
</item>

<picture FCSP>
/items = FCSP
/select = replace
</picture>

<item FCSU>
/1 = "CS2.jpg"
</item>

<picture FCSU>
/items = FCSU
/select = replace
</picture>

<item BCSP>
/1 = "CS3.jpg"
</item>

<picture BCSP>
/items = BCSP
/select = replace
</picture>

<item BCSU>
/1 = "CS4.jpg"
</item>

<picture BCSU>
/items = BCSU
/select = replace
</picture>

######################### USs #########################

<item pleasant>
/1 = "USP1.jpg"
/2 = "USP2.jpg"
/3 = "USP3.jpg"
/4 = "USP4.jpg"
</item>

<picture pleasant>
/items = pleasant
/select = values.pleasantitemnumber
</picture>

<item unpleasant>
/1 = "USU1.jpg"
/2 = "USU2.jpg"
/3 = "USU3.jpg"
/4 = "USU4.jpg"
</item>

<picture unpleasant>
/items = unpleasant
/select = values.unpleasantitemnumber
</picture>

######################### OVERLAPS #########################

<item Fpleasantoverlap>
/1 = "CS1USP1.jpg"
/2 = "CS1USP2.jpg"
/3 = "CS1USP3.jpg"
/4 = "CS1USP4.jpg"
</item>

<picture Fpleasantoverlap>
/items = Fpleasantoverlap
/select = values.Fpleasantoverlapitemnumber
</picture>

<item Funpleasantoverlap>
/1 = "CS2USU1.jpg"
/2 = "CS2USU2.jpg"
/3 = "CS2USU3.jpg"
/4 = "CS2USU4.jpg"
</item>

<picture Funpleasantoverlap>
/items = Funpleasantoverlap
/select = values.Funpleasantoverlapitemnumber
</picture>

<item Bpleasantoverlap>
/1 = "CS3USP1.jpg"
/2 = "CS3USP2.jpg"
/3 = "CS3USP3.jpg"
/4 = "CS3USP4.jpg"
</item>

<picture Bpleasantoverlap>
/items = Bpleasantoverlap
/select = values.Bpleasantoverlapitemnumber
</picture>

<item Bunpleasantoverlap>
/1 = "CS4USU1.jpg"
/2 = "CS4USU2.jpg"
/3 = "CS4USU3.jpg"
/4 = "CS4USU4.jpg"
</item>

<picture Bunpleasantoverlap>
/items = Bunpleasantoverlap
/select = values.Bunpleasantoverlapitemnumber
</picture>

######################### LISTS #########################

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

<list FpleasantoverlapCSUS>
/ items = (1, 2, 3, 4)
/ selectionmode = list.Fpleasantoverlapus.currentindex
</list>

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

<list FunpleasantoverlapCSUS>
/ items = (1, 2, 3, 4)
/ selectionmode = list.Funpleasantoverlapus.currentindex
</list>

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

<list BpleasantoverlapCSUS>
/ items = (1, 2, 3, 4)
/ selectionmode = list.Bpleasantoverlapus.currentindex
</list>

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

<list BunpleasantoverlapCSUS>
/ items = (1, 2, 3, 4)
/ selectionmode = list.Bunpleasantoverlapus.currentindex
</list>

######################### Eraser for flashing pictures #########################

<shape eraser>
/shape = rectangle
/size = (100%, 100%)
/erase = false
/color = (220, 220, 220)
</shape>


######################### Trials #########################

<trial CSPpleasant>
/stimulustimes = [0=FCSP; 4000=Fpleasantoverlap; 5000=eraser; 5200=pleasant; 6200=eraser; 6400=pleasant; 7400=eraser; 7600=pleasant;
8600=eraser; 8800=Bpleasantoverlap; 9800=eraser, BCSP]
/ontrialbegin = [
values.pleasantitemnumber = list.FpleasantoverlapUS.nextvalue;
values.pleasantitemnumber = list.BpleasantoverlapUS.nextvalue;
values.Fpleasantoverlapitemnumber = list.Fpleasantoverlapcsus.nextvalue;
values.Bpleasantoverlapitemnumber = list.Bpleasantoverlapcsus.nextvalue]
/timeout = 13800
/posttrialpause = expressions.randposttrialpause
</trial>

<trial CSUunpleasant>
/stimulustimes = [0=FCSU; 4000=Funpleasantoverlap; 5000=eraser; 5200=unpleasant; 6200=eraser; 6400=unpleasant; 7400=eraser; 7600=unpleasant;
8600=eraser; 8800=Bunpleasantoverlap; 9800=eraser, BCSU]
/ontrialbegin = [
values.unpleasantitemnumber = list.FunpleasantoverlapUS.nextvalue;
values.unpleasantitemnumber = list.BunpleasantoverlapUS.nextvalue;
values.Funpleasantoverlapitemnumber = list.Funpleasantoverlapcsus.nextvalue;
values.Bunpleasantoverlapitemnumber = list.Bunpleasantoverlapcsus.nextvalue]
/timeout = 13800
/posttrialpause = expressions.randposttrialpause
</trial>

<expressions>
/randposttrialpause = replace(4000, 5000, 6000)
</expressions> "

Thanks,
Luke

I don't understand what you're doing here:

<trial CSPpleasant>
/stimulustimes = [0=FCSP; 4000=Fpleasantoverlap; 5000=eraser; 5200=pleasant; 6200=eraser; 6400=pleasant; 7400=eraser; 7600=pleasant;
8600=eraser; 8800=Bpleasantoverlap; 9800=eraser, BCSP]
/ontrialbegin = [
values.pleasantitemnumber = list.FpleasantoverlapUS.nextvalue;
values.pleasantitemnumber = list.BpleasantoverlapUS.nextvalue;

values.Fpleasantoverlapitemnumber = list.Fpleasantoverlapcsus.nextvalue;
values.Bpleasantoverlapitemnumber = list.Bpleasantoverlapcsus.nextvalue]
/timeout = 13800
/posttrialpause = expressions.randposttrialpause
</trial>

Why are you first setting values.pleasantitemnumber to a value sampled from

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

and then immediately to a different value sampled from a different list

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

?

The same is true for the unpleasant trial:

<trial CSUunpleasant>
/stimulustimes = [0=FCSU; 4000=Funpleasantoverlap; 5000=eraser; 5200=unpleasant; 6200=eraser; 6400=unpleasant; 7400=eraser; 7600=unpleasant;
8600=eraser; 8800=Bunpleasantoverlap; 9800=eraser, BCSU]
/ontrialbegin = [
values.unpleasantitemnumber = list.FunpleasantoverlapUS.nextvalue;
values.unpleasantitemnumber = list.BunpleasantoverlapUS.nextvalue;

values.Funpleasantoverlapitemnumber = list.Funpleasantoverlapcsus.nextvalue;
values.Bunpleasantoverlapitemnumber = list.Bunpleasantoverlapcsus.nextvalue]
/timeout = 13800
/posttrialpause = expressions.randposttrialpause
</trial>

Also, if you want to simply select the same item number across multiple <picture> elements, I don't understand why you need multiple lists. Why is one list not sufficient, i.e. why not set a values.itemnumber to a value sampled from that single list and use values.itemnumber in all the <picture> elements' /select attributes?

Greeny
Greeny
Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)
Group: Forum Members
Posts: 14, Visits: 51
I thought I had to specify both FpleasantoverlapUS and BpleasantoverlapUS in order to pull from these on each trial. My understanding of how values and lists work is not very good.  I don't understand how I could do it all from one list and keep the pleasant and unpleasant trials separate while still presenting the right items together randomised across trials? Are you able to provide an example of how this would look please?



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: 13K, Visits: 104K
Greeny - 7/30/2019
I thought I had to specify both FpleasantoverlapUS and BpleasantoverlapUS in order to pull from these on each trial. My understanding of how values and lists work is not very good.  I don't understand how I could do it all from one list and keep the pleasant and unpleasant trials separate while still presenting the right items together randomised across trials? Are you able to provide an example of how this would look please?



A <values> entry like values.pleasantitemnumber is just a global variable.

Here you first set that variable to a number sampled from list.FpleasantoverlapUS

values.pleasantitemnumber = list.FpleasantoverlapUS.nextvalue;

and then you immediately set the variable to a different value sampled from a different list:

values.pleasantitemnumber = list.BpleasantoverlapUS.nextvalue;

Again, please, what is this supposed to achieve? I don't understand what "I thought I had to specify both FpleasantoverlapUS and BpleasantoverlapUS in order to pull from these on each trial." is supposed to mean.
 

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: 13K, Visits: 104K
Dave - 7/30/2019
Greeny - 7/30/2019
I thought I had to specify both FpleasantoverlapUS and BpleasantoverlapUS in order to pull from these on each trial. My understanding of how values and lists work is not very good.  I don't understand how I could do it all from one list and keep the pleasant and unpleasant trials separate while still presenting the right items together randomised across trials? Are you able to provide an example of how this would look please?



A <values> entry like values.pleasantitemnumber is just a global variable.

Here you first set that variable to a number sampled from list.FpleasantoverlapUS

values.pleasantitemnumber = list.FpleasantoverlapUS.nextvalue;

and then you immediately set the variable to a different value sampled from a different list:

values.pleasantitemnumber = list.BpleasantoverlapUS.nextvalue;

Again, please, what is this supposed to achieve? I don't understand what "I thought I had to specify both FpleasantoverlapUS and BpleasantoverlapUS in order to pull from these on each trial." is supposed to mean.
 

Let's go back to your original description: "The sequence is CS1-CS1USPx-USPx-CS2USPx-CS2, where x should be the same number each time within a trial."

That is: All you need to determine (i.e. randomly sample) is x, and you only need to do that once in a trial.

<values>
/ x = 1
</values>

<item FCSP>
/1 = "CS1.jpg"
</item>

<picture FCSP>
/items = FCSP
</picture>

<item FCSU>
/1 = "CS2.jpg"
</item>

<picture FCSU>
/items = FCSU
</picture>

<item BCSP>
/1 = "CS3.jpg"
</item>

<picture BCSP>
/items = BCSP
</picture>

<item BCSU>
/1 = "CS4.jpg"
</item>

<picture BCSU>
/items = BCSU
</picture>

######################### USs #########################

<item pleasant>
/1 = "USP1.jpg"
/2 = "USP2.jpg"
/3 = "USP3.jpg"
/4 = "USP4.jpg"
</item>

<picture pleasant>
/items = pleasant
/select = values.x
</picture>

<item unpleasant>
/1 = "USU1.jpg"
/2 = "USU2.jpg"
/3 = "USU3.jpg"
/4 = "USU4.jpg"
</item>

<picture unpleasant>
/items = unpleasant
/select = values.x
</picture>

######################### OVERLAPS #########################

<item Fpleasantoverlap>
/1 = "CS1USP1.jpg"
/2 = "CS1USP2.jpg"
/3 = "CS1USP3.jpg"
/4 = "CS1USP4.jpg"
</item>

<picture Fpleasantoverlap>
/items = Fpleasantoverlap
/select = values.x
</picture>

<item Funpleasantoverlap>
/1 = "CS2USU1.jpg"
/2 = "CS2USU2.jpg"
/3 = "CS2USU3.jpg"
/4 = "CS2USU4.jpg"
</item>

<picture Funpleasantoverlap>
/items = Funpleasantoverlap
/select = values.x
</picture>

<item Bpleasantoverlap>
/1 = "CS3USP1.jpg"
/2 = "CS3USP2.jpg"
/3 = "CS3USP3.jpg"
/4 = "CS3USP4.jpg"
</item>

<picture Bpleasantoverlap>
/items = Bpleasantoverlap
/select = values.x
</picture>

<item Bunpleasantoverlap>
/1 = "CS4USU1.jpg"
/2 = "CS4USU2.jpg"
/3 = "CS4USU3.jpg"
/4 = "CS4USU4.jpg"
</item>

<picture Bunpleasantoverlap>
/items = Bunpleasantoverlap
/select = values.x
</picture>

######################### LISTS #########################

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

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


######################### Eraser for flashing pictures #########################

<shape eraser>
/shape = rectangle
/size = (100%, 100%)
/erase = false
/color = (220, 220, 220)
</shape>


######################### Trials #########################

<trial CSPpleasant>
/stimulustimes = [0=FCSP; 4000=Fpleasantoverlap; 5000=eraser; 5200=pleasant; 6200=eraser; 6400=pleasant; 7400=eraser; 7600=pleasant;
8600=eraser; 8800=Bpleasantoverlap; 9800=eraser, BCSP]
/ontrialbegin = [values.x = list.pleasantx.nextvalue;]
/timeout = 13800
/posttrialpause = expressions.randposttrialpause
</trial>

<trial CSUunpleasant>
/stimulustimes = [0=FCSU; 4000=Funpleasantoverlap; 5000=eraser; 5200=unpleasant; 6200=eraser; 6400=unpleasant; 7400=eraser; 7600=unpleasant;
8600=eraser; 8800=Bunpleasantoverlap; 9800=eraser, BCSU]
/ontrialbegin = [values.x = list.unpleasantx.nextvalue;]
/timeout = 13800
/posttrialpause = expressions.randposttrialpause
</trial>

<expressions>
/randposttrialpause = replace(4000, 5000, 6000)
</expressions> "

Greeny
Greeny
Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)Expert (1.5K reputation)
Group: Forum Members
Posts: 14, Visits: 51
Thanks Dave - that does what I was wanting to do. I was adapting from another script and over-complicated things due to a lack of understanding how the values work.


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search