Horizontal position and image selection from group


Author
Message
wuaham
wuaham
Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)
Group: Forum Members
Posts: 38, Visits: 170
I have four groups of images (e.g., A, B, C, D), each group has eight images (currently I put them as text for testing). I want to display two images side by side selected randomly, a text in-between ("Positive" or "Negative" in randomize order) and run trials of equal number of each text.
(Script below)
Questions:
1. Horizontal position:
    How to set horizontal position (/hposition)) values for leftImage and rightImage?
    (Implemented in the script but having issues, sometimes displays horizontal position at zero (as initialized))
2. How to avoid selection of same group on both sides? (e.g., if leftImage comes from group C,
rightImage should be from remaining groups A, B, D but not from group C)
(Tried to branch conditionally but not working - please help)

3. How to avoid selection of same image type on both sides? (e.g., if C5.jpg selected for leftIamge, rightImage can't be A5.jpg, B5.jpg, or D5.jpg, please note I am managing image group by alphabet and type by number)?
(Not sure how to implement)

Would appreciate your kind help.
Thanks

Here is the script in Inquisit-6:
<values>
/ lftimg = ""
/ rgtimg = ""
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<text minus>
/ items = ("Negative")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list leftImage>
/ items = (text.A,text.B, text.C, text.D)
/ replace = true
/ selectionrate = always
</list>

<list rightImage>
/ items = (text.A,text.B, text.C, text.D)
/ replace = true
/ selectionrate = always
</list>

<trial plus>
/ ontrialbegin = [trial.plus.insertstimulusframe(list.leftImage.nextvalue, 1);
                 trial.plus.insertstimulusframe(list.rightImage.nextvalue, 1);]
/ branch = [if (substring(list.leftImage.currentvalue, 5, 1) == substring(list.rightImage.currentvalue, 5, 1)) trial.plus]
                
/ ontrialbegin = [if (substring(list.leftImage.currentvalue, 5, 1) == "A") {text.A.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "B") {text.B.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "C") {text.C.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "D") {text.D.hposition = 30%};]

/ ontrialbegin = [if (substring(list.rightImage.currentvalue, 5, 1) == "A") {text.A.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "B") {text.B.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "C") {text.C.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "D") {text.D.hposition = 70%};]

/ stimulusframes = [1=clearScreen; 2=text.plus; 3=list.leftImage, list.rightImage;]
/ validresponse = ("a", "b")
</trial>

<trial minus>
/ ontrialbegin = [trial.minus.insertstimulusframe(list.leftImage.nextvalue, 1);
                 trial.minus.insertstimulusframe(list.rightImage.nextvalue, 1);]
/ branch = [if (substring(list.leftImage.currentvalue, 5, 1) == substring(list.rightImage.currentvalue, 5, 1)) trial.minus]

/ ontrialbegin = [if (substring(list.leftImage.currentvalue, 5, 1) == "A") {text.A.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "B") {text.B.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "C") {text.C.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "D") {text.D.hposition = 30%};]

/ ontrialbegin = [if (substring(list.rightImage.currentvalue, 5, 1) == "A") {text.A.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "B") {text.B.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "C") {text.C.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "D") {text.D.hposition = 70%};]                
                
/ stimulusframes = [1=clearScreen; 2=text.minus; 3=list.leftImage, list.rightImage;]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-10=noreplace(plus,minus)]
/ recorddata = true
</block>


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: 97K
wuaham - 12/1/2023
I have four groups of images (e.g., A, B, C, D), each group has eight images (currently I put them as text for testing). I want to display two images side by side selected randomly, a text in-between ("Positive" or "Negative" in randomize order) and run trials of equal number of each text.
(Script below)
Questions:
1. Horizontal position:
    How to set horizontal position (/hposition)) values for leftImage and rightImage?
    (Implemented in the script but having issues, sometimes displays horizontal position at zero (as initialized))
2. How to avoid selection of same group on both sides? (e.g., if leftImage comes from group C,
rightImage should be from remaining groups A, B, D but not from group C)
(Tried to branch conditionally but not working - please help)

3. How to avoid selection of same image type on both sides? (e.g., if C5.jpg selected for leftIamge, rightImage can't be A5.jpg, B5.jpg, or D5.jpg, please note I am managing image group by alphabet and type by number)?
(Not sure how to implement)

Would appreciate your kind help.
Thanks

Here is the script in Inquisit-6:
<values>
/ lftimg = ""
/ rgtimg = ""
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<text minus>
/ items = ("Negative")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list leftImage>
/ items = (text.A,text.B, text.C, text.D)
/ replace = true
/ selectionrate = always
</list>

<list rightImage>
/ items = (text.A,text.B, text.C, text.D)
/ replace = true
/ selectionrate = always
</list>

<trial plus>
/ ontrialbegin = [trial.plus.insertstimulusframe(list.leftImage.nextvalue, 1);
                 trial.plus.insertstimulusframe(list.rightImage.nextvalue, 1);]
/ branch = [if (substring(list.leftImage.currentvalue, 5, 1) == substring(list.rightImage.currentvalue, 5, 1)) trial.plus]
                
/ ontrialbegin = [if (substring(list.leftImage.currentvalue, 5, 1) == "A") {text.A.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "B") {text.B.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "C") {text.C.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "D") {text.D.hposition = 30%};]

/ ontrialbegin = [if (substring(list.rightImage.currentvalue, 5, 1) == "A") {text.A.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "B") {text.B.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "C") {text.C.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "D") {text.D.hposition = 70%};]

/ stimulusframes = [1=clearScreen; 2=text.plus; 3=list.leftImage, list.rightImage;]
/ validresponse = ("a", "b")
</trial>

<trial minus>
/ ontrialbegin = [trial.minus.insertstimulusframe(list.leftImage.nextvalue, 1);
                 trial.minus.insertstimulusframe(list.rightImage.nextvalue, 1);]
/ branch = [if (substring(list.leftImage.currentvalue, 5, 1) == substring(list.rightImage.currentvalue, 5, 1)) trial.minus]

/ ontrialbegin = [if (substring(list.leftImage.currentvalue, 5, 1) == "A") {text.A.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "B") {text.B.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "C") {text.C.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "D") {text.D.hposition = 30%};]

/ ontrialbegin = [if (substring(list.rightImage.currentvalue, 5, 1) == "A") {text.A.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "B") {text.B.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "C") {text.C.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "D") {text.D.hposition = 70%};]                
                
/ stimulusframes = [1=clearScreen; 2=text.minus; 3=list.leftImage, list.rightImage;]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-10=noreplace(plus,minus)]
/ recorddata = true
</block>


Why do you need two lists (list.leftimage list.rightimage), i.e. why don't you sample the two images to be presented from the same list? The same for left / right positions.

What do you understand "run[ning] trials of equal number of each text" to mean?

As for
> How to avoid selection of same image type on both sides?

use lists and values and set a /not constraint on the list(s), or sample item numbers from a single list.


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: 97K
Dave - 12/1/2023
wuaham - 12/1/2023
I have four groups of images (e.g., A, B, C, D), each group has eight images (currently I put them as text for testing). I want to display two images side by side selected randomly, a text in-between ("Positive" or "Negative" in randomize order) and run trials of equal number of each text.
(Script below)
Questions:
1. Horizontal position:
    How to set horizontal position (/hposition)) values for leftImage and rightImage?
    (Implemented in the script but having issues, sometimes displays horizontal position at zero (as initialized))
2. How to avoid selection of same group on both sides? (e.g., if leftImage comes from group C,
rightImage should be from remaining groups A, B, D but not from group C)
(Tried to branch conditionally but not working - please help)

3. How to avoid selection of same image type on both sides? (e.g., if C5.jpg selected for leftIamge, rightImage can't be A5.jpg, B5.jpg, or D5.jpg, please note I am managing image group by alphabet and type by number)?
(Not sure how to implement)

Would appreciate your kind help.
Thanks

Here is the script in Inquisit-6:
<values>
/ lftimg = ""
/ rgtimg = ""
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<text minus>
/ items = ("Negative")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list leftImage>
/ items = (text.A,text.B, text.C, text.D)
/ replace = true
/ selectionrate = always
</list>

<list rightImage>
/ items = (text.A,text.B, text.C, text.D)
/ replace = true
/ selectionrate = always
</list>

<trial plus>
/ ontrialbegin = [trial.plus.insertstimulusframe(list.leftImage.nextvalue, 1);
                 trial.plus.insertstimulusframe(list.rightImage.nextvalue, 1);]
/ branch = [if (substring(list.leftImage.currentvalue, 5, 1) == substring(list.rightImage.currentvalue, 5, 1)) trial.plus]
                
/ ontrialbegin = [if (substring(list.leftImage.currentvalue, 5, 1) == "A") {text.A.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "B") {text.B.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "C") {text.C.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "D") {text.D.hposition = 30%};]

/ ontrialbegin = [if (substring(list.rightImage.currentvalue, 5, 1) == "A") {text.A.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "B") {text.B.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "C") {text.C.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "D") {text.D.hposition = 70%};]

/ stimulusframes = [1=clearScreen; 2=text.plus; 3=list.leftImage, list.rightImage;]
/ validresponse = ("a", "b")
</trial>

<trial minus>
/ ontrialbegin = [trial.minus.insertstimulusframe(list.leftImage.nextvalue, 1);
                 trial.minus.insertstimulusframe(list.rightImage.nextvalue, 1);]
/ branch = [if (substring(list.leftImage.currentvalue, 5, 1) == substring(list.rightImage.currentvalue, 5, 1)) trial.minus]

/ ontrialbegin = [if (substring(list.leftImage.currentvalue, 5, 1) == "A") {text.A.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "B") {text.B.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "C") {text.C.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "D") {text.D.hposition = 30%};]

/ ontrialbegin = [if (substring(list.rightImage.currentvalue, 5, 1) == "A") {text.A.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "B") {text.B.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "C") {text.C.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "D") {text.D.hposition = 70%};]                
                
/ stimulusframes = [1=clearScreen; 2=text.minus; 3=list.leftImage, list.rightImage;]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-10=noreplace(plus,minus)]
/ recorddata = true
</block>


Why do you need two lists (list.leftimage list.rightimage), i.e. why don't you sample the two images to be presented from the same list? The same for left / right positions.

What do you understand "run[ning] trials of equal number of each text" to mean?

As for
> How to avoid selection of same image type on both sides?

use lists and values and set a /not constraint on the list(s), or sample item numbers from a single list.


Here's something you can work through and modify as needed.

<values>
/ lftimg = ""
/ rgtimg = ""
/ lftitemnumber = 0
/ rgtitemnumber = 0

/ aitem = 0
/ bitem = 0
/ citem = 0
/ ditem = 0
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.aitem
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.bitem
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.citem
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.ditem
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<text minus>
/ items = ("Negative")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list image>
/ items = (text.A, text.B, text.C, text.D)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list itemnumbers>
/ poolsize = 8
/ selectionrate = always
</list>

<trial plus>
/ ontrialbegin = [
    trial.plus.resetstimulusframes();
    list.image.reset();
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.lftimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on left side
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.rgtimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on right side
    
    if (values.lftimg == text.A) {
        text.A.hposition = 30%;
        values.aitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.aitem;
    } else if (values.lftimg == text.B) {
        text.B.hposition = 30%;
    values.bitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.bitem;
    } else if (values.lftimg == text.C) {
        text.C.hposition = 30%;
        values.citem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.citem;
    } else if (values.lftimg == text.D) {
        text.D.hposition = 30%;
        values.ditem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.ditem;
    };
        if (values.rgtimg == text.A) {
        text.A.hposition = 70%;
        values.aitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.aitem;
    } else if (values.rgtimg == text.B) {
        text.B.hposition = 70%;
        values.bitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.bitem;
    } else if (values.rgtimg == text.C) {
        text.C.hposition = 70%;
        values.citem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.citem;
    } else if (values.rgtimg == text.D) {
        text.D.hposition = 70%;
        values.ditem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.ditem;
    };
]
/ stimulusframes = [1=clearScreen, text.plus]
/ validresponse = ("a", "b")
</trial>

<trial minus>
/ ontrialbegin = [
    trial.minus.resetstimulusframes();
    list.image.reset();
    trial.minus.insertstimulusframe(list.image.nextvalue, 1);
    values.lftimg = list.image.currentvalue;
    trial.minus.insertstimulusframe(list.image.nextvalue, 1);
    values.rgtimg = list.image.currentvalue;
    
    if (values.lftimg == text.A) {
        text.A.hposition = 30%;
        values.aitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.aitem;
    } else if (values.lftimg == text.B) {
        text.B.hposition = 30%;
    values.bitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.bitem;
    } else if (values.lftimg == text.C) {
        text.C.hposition = 30%;
        values.citem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.citem;
    } else if (values.lftimg == text.D) {
        text.D.hposition = 30%;
        values.ditem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.ditem;
    };
        if (values.rgtimg == text.A) {
        text.A.hposition = 70%;
        values.aitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.aitem;
    } else if (values.rgtimg == text.B) {
        text.B.hposition = 70%;
        values.bitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.bitem;
    } else if (values.rgtimg == text.C) {
        text.C.hposition = 70%;
        values.citem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.citem;
    } else if (values.rgtimg == text.D) {
        text.D.hposition = 70%;
        values.ditem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.ditem;
    };
]
/ stimulusframes = [1=clearScreen, text.minus]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-10=noreplace(plus,minus)]
/ recorddata = true
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency correct
    values.lftimg values.rgtimg values.lftitemnumber values.rgtitemnumber)
</data>

Edited 2 Months Ago by Dave
wuaham
wuaham
Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)
Group: Forum Members
Posts: 38, Visits: 170
Dave - 12/1/2023
Dave - 12/1/2023
wuaham - 12/1/2023
I have four groups of images (e.g., A, B, C, D), each group has eight images (currently I put them as text for testing). I want to display two images side by side selected randomly, a text in-between ("Positive" or "Negative" in randomize order) and run trials of equal number of each text.
(Script below)
Questions:
1. Horizontal position:
    How to set horizontal position (/hposition)) values for leftImage and rightImage?
    (Implemented in the script but having issues, sometimes displays horizontal position at zero (as initialized))
2. How to avoid selection of same group on both sides? (e.g., if leftImage comes from group C,
rightImage should be from remaining groups A, B, D but not from group C)
(Tried to branch conditionally but not working - please help)

3. How to avoid selection of same image type on both sides? (e.g., if C5.jpg selected for leftIamge, rightImage can't be A5.jpg, B5.jpg, or D5.jpg, please note I am managing image group by alphabet and type by number)?
(Not sure how to implement)

Would appreciate your kind help.
Thanks

Here is the script in Inquisit-6:
<values>
/ lftimg = ""
/ rgtimg = ""
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<text minus>
/ items = ("Negative")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list leftImage>
/ items = (text.A,text.B, text.C, text.D)
/ replace = true
/ selectionrate = always
</list>

<list rightImage>
/ items = (text.A,text.B, text.C, text.D)
/ replace = true
/ selectionrate = always
</list>

<trial plus>
/ ontrialbegin = [trial.plus.insertstimulusframe(list.leftImage.nextvalue, 1);
                 trial.plus.insertstimulusframe(list.rightImage.nextvalue, 1);]
/ branch = [if (substring(list.leftImage.currentvalue, 5, 1) == substring(list.rightImage.currentvalue, 5, 1)) trial.plus]
                
/ ontrialbegin = [if (substring(list.leftImage.currentvalue, 5, 1) == "A") {text.A.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "B") {text.B.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "C") {text.C.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "D") {text.D.hposition = 30%};]

/ ontrialbegin = [if (substring(list.rightImage.currentvalue, 5, 1) == "A") {text.A.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "B") {text.B.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "C") {text.C.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "D") {text.D.hposition = 70%};]

/ stimulusframes = [1=clearScreen; 2=text.plus; 3=list.leftImage, list.rightImage;]
/ validresponse = ("a", "b")
</trial>

<trial minus>
/ ontrialbegin = [trial.minus.insertstimulusframe(list.leftImage.nextvalue, 1);
                 trial.minus.insertstimulusframe(list.rightImage.nextvalue, 1);]
/ branch = [if (substring(list.leftImage.currentvalue, 5, 1) == substring(list.rightImage.currentvalue, 5, 1)) trial.minus]

/ ontrialbegin = [if (substring(list.leftImage.currentvalue, 5, 1) == "A") {text.A.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "B") {text.B.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "C") {text.C.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "D") {text.D.hposition = 30%};]

/ ontrialbegin = [if (substring(list.rightImage.currentvalue, 5, 1) == "A") {text.A.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "B") {text.B.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "C") {text.C.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "D") {text.D.hposition = 70%};]                
                
/ stimulusframes = [1=clearScreen; 2=text.minus; 3=list.leftImage, list.rightImage;]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-10=noreplace(plus,minus)]
/ recorddata = true
</block>


Why do you need two lists (list.leftimage list.rightimage), i.e. why don't you sample the two images to be presented from the same list? The same for left / right positions.

What do you understand "run[ning] trials of equal number of each text" to mean?

As for
> How to avoid selection of same image type on both sides?

use lists and values and set a /not constraint on the list(s), or sample item numbers from a single list.


Here's something you can work through and modify as needed.

<values>
/ lftimg = ""
/ rgtimg = ""
/ lftitemnumber = 0
/ rgtitemnumber = 0

/ aitem = 0
/ bitem = 0
/ citem = 0
/ ditem = 0
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.aitem
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.bitem
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.citem
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.ditem
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<text minus>
/ items = ("Negative")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list image>
/ items = (text.A, text.B, text.C, text.D)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list itemnumbers>
/ poolsize = 8
/ selectionrate = always
</list>

<trial plus>
/ ontrialbegin = [
    trial.plus.resetstimulusframes();
    list.image.reset();
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.lftimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on left side
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.rgtimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on right side
    
    if (values.lftimg == text.A) {
        text.A.hposition = 30%;
        values.aitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.aitem;
    } else if (values.lftimg == text.B) {
        text.B.hposition = 30%;
    values.bitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.bitem;
    } else if (values.lftimg == text.C) {
        text.C.hposition = 30%;
        values.citem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.citem;
    } else if (values.lftimg == text.D) {
        text.D.hposition = 30%;
        values.ditem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.ditem;
    };
        if (values.rgtimg == text.A) {
        text.A.hposition = 70%;
        values.aitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.aitem;
    } else if (values.rgtimg == text.B) {
        text.B.hposition = 70%;
        values.bitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.bitem;
    } else if (values.rgtimg == text.C) {
        text.C.hposition = 70%;
        values.citem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.citem;
    } else if (values.rgtimg == text.D) {
        text.D.hposition = 70%;
        values.ditem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.ditem;
    };
]
/ stimulusframes = [1=clearScreen, text.plus]
/ validresponse = ("a", "b")
</trial>

<trial minus>
/ ontrialbegin = [
    trial.minus.resetstimulusframes();
    list.image.reset();
    trial.minus.insertstimulusframe(list.image.nextvalue, 1);
    values.lftimg = list.image.currentvalue;
    trial.minus.insertstimulusframe(list.image.nextvalue, 1);
    values.rgtimg = list.image.currentvalue;
    
    if (values.lftimg == text.A) {
        text.A.hposition = 30%;
        values.aitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.aitem;
    } else if (values.lftimg == text.B) {
        text.B.hposition = 30%;
    values.bitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.bitem;
    } else if (values.lftimg == text.C) {
        text.C.hposition = 30%;
        values.citem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.citem;
    } else if (values.lftimg == text.D) {
        text.D.hposition = 30%;
        values.ditem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.ditem;
    };
        if (values.rgtimg == text.A) {
        text.A.hposition = 70%;
        values.aitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.aitem;
    } else if (values.rgtimg == text.B) {
        text.B.hposition = 70%;
        values.bitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.bitem;
    } else if (values.rgtimg == text.C) {
        text.C.hposition = 70%;
        values.citem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.citem;
    } else if (values.rgtimg == text.D) {
        text.D.hposition = 70%;
        values.ditem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.ditem;
    };
]
/ stimulusframes = [1=clearScreen, text.minus]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-10=noreplace(plus,minus)]
/ recorddata = true
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency correct
    values.lftimg values.rgtimg values.lftitemnumber values.rgtitemnumber)
</data>

Thank you very much Dave for your kind assistance. I have adjusted the code and it's working fine for one of my experiment.

I have another experiment (same as previous one - four groups of images (e.g., A, B, C, D), each group has eight images) but I have to select some specific pair of images such as:

For "plus" trial, I want to display
- two pairs of even (or odd) numbered images (i.e., if left image "C2.jpg" then right image "D4.jpg" or any other even or odd numbered pairs)
- two pairs of distinct numbered (i.e., one odd one even) images (i.e., if left image "A2.jpg" then right image "B7.jpg" or any other combinations of distinct numbers)

Same for "minus" trial. These two trials are in randomized order (total eight trials would be fine). How would I set this experiment please?

Would appreciate your help - thanks.

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: 97K
wuaham - 12/6/2023
Dave - 12/1/2023
Dave - 12/1/2023
wuaham - 12/1/2023
I have four groups of images (e.g., A, B, C, D), each group has eight images (currently I put them as text for testing). I want to display two images side by side selected randomly, a text in-between ("Positive" or "Negative" in randomize order) and run trials of equal number of each text.
(Script below)
Questions:
1. Horizontal position:
    How to set horizontal position (/hposition)) values for leftImage and rightImage?
    (Implemented in the script but having issues, sometimes displays horizontal position at zero (as initialized))
2. How to avoid selection of same group on both sides? (e.g., if leftImage comes from group C,
rightImage should be from remaining groups A, B, D but not from group C)
(Tried to branch conditionally but not working - please help)

3. How to avoid selection of same image type on both sides? (e.g., if C5.jpg selected for leftIamge, rightImage can't be A5.jpg, B5.jpg, or D5.jpg, please note I am managing image group by alphabet and type by number)?
(Not sure how to implement)

Would appreciate your kind help.
Thanks

Here is the script in Inquisit-6:
<values>
/ lftimg = ""
/ rgtimg = ""
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<text minus>
/ items = ("Negative")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list leftImage>
/ items = (text.A,text.B, text.C, text.D)
/ replace = true
/ selectionrate = always
</list>

<list rightImage>
/ items = (text.A,text.B, text.C, text.D)
/ replace = true
/ selectionrate = always
</list>

<trial plus>
/ ontrialbegin = [trial.plus.insertstimulusframe(list.leftImage.nextvalue, 1);
                 trial.plus.insertstimulusframe(list.rightImage.nextvalue, 1);]
/ branch = [if (substring(list.leftImage.currentvalue, 5, 1) == substring(list.rightImage.currentvalue, 5, 1)) trial.plus]
                
/ ontrialbegin = [if (substring(list.leftImage.currentvalue, 5, 1) == "A") {text.A.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "B") {text.B.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "C") {text.C.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "D") {text.D.hposition = 30%};]

/ ontrialbegin = [if (substring(list.rightImage.currentvalue, 5, 1) == "A") {text.A.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "B") {text.B.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "C") {text.C.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "D") {text.D.hposition = 70%};]

/ stimulusframes = [1=clearScreen; 2=text.plus; 3=list.leftImage, list.rightImage;]
/ validresponse = ("a", "b")
</trial>

<trial minus>
/ ontrialbegin = [trial.minus.insertstimulusframe(list.leftImage.nextvalue, 1);
                 trial.minus.insertstimulusframe(list.rightImage.nextvalue, 1);]
/ branch = [if (substring(list.leftImage.currentvalue, 5, 1) == substring(list.rightImage.currentvalue, 5, 1)) trial.minus]

/ ontrialbegin = [if (substring(list.leftImage.currentvalue, 5, 1) == "A") {text.A.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "B") {text.B.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "C") {text.C.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "D") {text.D.hposition = 30%};]

/ ontrialbegin = [if (substring(list.rightImage.currentvalue, 5, 1) == "A") {text.A.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "B") {text.B.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "C") {text.C.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "D") {text.D.hposition = 70%};]                
                
/ stimulusframes = [1=clearScreen; 2=text.minus; 3=list.leftImage, list.rightImage;]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-10=noreplace(plus,minus)]
/ recorddata = true
</block>


Why do you need two lists (list.leftimage list.rightimage), i.e. why don't you sample the two images to be presented from the same list? The same for left / right positions.

What do you understand "run[ning] trials of equal number of each text" to mean?

As for
> How to avoid selection of same image type on both sides?

use lists and values and set a /not constraint on the list(s), or sample item numbers from a single list.


Here's something you can work through and modify as needed.

<values>
/ lftimg = ""
/ rgtimg = ""
/ lftitemnumber = 0
/ rgtitemnumber = 0

/ aitem = 0
/ bitem = 0
/ citem = 0
/ ditem = 0
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.aitem
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.bitem
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.citem
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.ditem
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<text minus>
/ items = ("Negative")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list image>
/ items = (text.A, text.B, text.C, text.D)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list itemnumbers>
/ poolsize = 8
/ selectionrate = always
</list>

<trial plus>
/ ontrialbegin = [
    trial.plus.resetstimulusframes();
    list.image.reset();
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.lftimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on left side
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.rgtimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on right side
    
    if (values.lftimg == text.A) {
        text.A.hposition = 30%;
        values.aitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.aitem;
    } else if (values.lftimg == text.B) {
        text.B.hposition = 30%;
    values.bitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.bitem;
    } else if (values.lftimg == text.C) {
        text.C.hposition = 30%;
        values.citem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.citem;
    } else if (values.lftimg == text.D) {
        text.D.hposition = 30%;
        values.ditem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.ditem;
    };
        if (values.rgtimg == text.A) {
        text.A.hposition = 70%;
        values.aitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.aitem;
    } else if (values.rgtimg == text.B) {
        text.B.hposition = 70%;
        values.bitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.bitem;
    } else if (values.rgtimg == text.C) {
        text.C.hposition = 70%;
        values.citem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.citem;
    } else if (values.rgtimg == text.D) {
        text.D.hposition = 70%;
        values.ditem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.ditem;
    };
]
/ stimulusframes = [1=clearScreen, text.plus]
/ validresponse = ("a", "b")
</trial>

<trial minus>
/ ontrialbegin = [
    trial.minus.resetstimulusframes();
    list.image.reset();
    trial.minus.insertstimulusframe(list.image.nextvalue, 1);
    values.lftimg = list.image.currentvalue;
    trial.minus.insertstimulusframe(list.image.nextvalue, 1);
    values.rgtimg = list.image.currentvalue;
    
    if (values.lftimg == text.A) {
        text.A.hposition = 30%;
        values.aitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.aitem;
    } else if (values.lftimg == text.B) {
        text.B.hposition = 30%;
    values.bitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.bitem;
    } else if (values.lftimg == text.C) {
        text.C.hposition = 30%;
        values.citem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.citem;
    } else if (values.lftimg == text.D) {
        text.D.hposition = 30%;
        values.ditem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.ditem;
    };
        if (values.rgtimg == text.A) {
        text.A.hposition = 70%;
        values.aitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.aitem;
    } else if (values.rgtimg == text.B) {
        text.B.hposition = 70%;
        values.bitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.bitem;
    } else if (values.rgtimg == text.C) {
        text.C.hposition = 70%;
        values.citem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.citem;
    } else if (values.rgtimg == text.D) {
        text.D.hposition = 70%;
        values.ditem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.ditem;
    };
]
/ stimulusframes = [1=clearScreen, text.minus]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-10=noreplace(plus,minus)]
/ recorddata = true
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency correct
    values.lftimg values.rgtimg values.lftitemnumber values.rgtitemnumber)
</data>

Thank you very much Dave for your kind assistance. I have adjusted the code and it's working fine for one of my experiment.

I have another experiment (same as previous one - four groups of images (e.g., A, B, C, D), each group has eight images) but I have to select some specific pair of images such as:

For "plus" trial, I want to display
- two pairs of even (or odd) numbered images (i.e., if left image "C2.jpg" then right image "D4.jpg" or any other even or odd numbered pairs)
- two pairs of distinct numbered (i.e., one odd one even) images (i.e., if left image "A2.jpg" then right image "B7.jpg" or any other combinations of distinct numbers)

Same for "minus" trial. These two trials are in randomized order (total eight trials would be fine). How would I set this experiment please?

Would appreciate your help - thanks.

Set up separate lists containing odd and even item nunbers, pull the item number for the right image (2nd member of the pair) from the applicable list.
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: 97K
Dave - 12/6/2023
wuaham - 12/6/2023
Dave - 12/1/2023
Dave - 12/1/2023
wuaham - 12/1/2023
I have four groups of images (e.g., A, B, C, D), each group has eight images (currently I put them as text for testing). I want to display two images side by side selected randomly, a text in-between ("Positive" or "Negative" in randomize order) and run trials of equal number of each text.
(Script below)
Questions:
1. Horizontal position:
    How to set horizontal position (/hposition)) values for leftImage and rightImage?
    (Implemented in the script but having issues, sometimes displays horizontal position at zero (as initialized))
2. How to avoid selection of same group on both sides? (e.g., if leftImage comes from group C,
rightImage should be from remaining groups A, B, D but not from group C)
(Tried to branch conditionally but not working - please help)

3. How to avoid selection of same image type on both sides? (e.g., if C5.jpg selected for leftIamge, rightImage can't be A5.jpg, B5.jpg, or D5.jpg, please note I am managing image group by alphabet and type by number)?
(Not sure how to implement)

Would appreciate your kind help.
Thanks

Here is the script in Inquisit-6:
<values>
/ lftimg = ""
/ rgtimg = ""
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<text minus>
/ items = ("Negative")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list leftImage>
/ items = (text.A,text.B, text.C, text.D)
/ replace = true
/ selectionrate = always
</list>

<list rightImage>
/ items = (text.A,text.B, text.C, text.D)
/ replace = true
/ selectionrate = always
</list>

<trial plus>
/ ontrialbegin = [trial.plus.insertstimulusframe(list.leftImage.nextvalue, 1);
                 trial.plus.insertstimulusframe(list.rightImage.nextvalue, 1);]
/ branch = [if (substring(list.leftImage.currentvalue, 5, 1) == substring(list.rightImage.currentvalue, 5, 1)) trial.plus]
                
/ ontrialbegin = [if (substring(list.leftImage.currentvalue, 5, 1) == "A") {text.A.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "B") {text.B.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "C") {text.C.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "D") {text.D.hposition = 30%};]

/ ontrialbegin = [if (substring(list.rightImage.currentvalue, 5, 1) == "A") {text.A.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "B") {text.B.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "C") {text.C.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "D") {text.D.hposition = 70%};]

/ stimulusframes = [1=clearScreen; 2=text.plus; 3=list.leftImage, list.rightImage;]
/ validresponse = ("a", "b")
</trial>

<trial minus>
/ ontrialbegin = [trial.minus.insertstimulusframe(list.leftImage.nextvalue, 1);
                 trial.minus.insertstimulusframe(list.rightImage.nextvalue, 1);]
/ branch = [if (substring(list.leftImage.currentvalue, 5, 1) == substring(list.rightImage.currentvalue, 5, 1)) trial.minus]

/ ontrialbegin = [if (substring(list.leftImage.currentvalue, 5, 1) == "A") {text.A.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "B") {text.B.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "C") {text.C.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "D") {text.D.hposition = 30%};]

/ ontrialbegin = [if (substring(list.rightImage.currentvalue, 5, 1) == "A") {text.A.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "B") {text.B.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "C") {text.C.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "D") {text.D.hposition = 70%};]                
                
/ stimulusframes = [1=clearScreen; 2=text.minus; 3=list.leftImage, list.rightImage;]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-10=noreplace(plus,minus)]
/ recorddata = true
</block>


Why do you need two lists (list.leftimage list.rightimage), i.e. why don't you sample the two images to be presented from the same list? The same for left / right positions.

What do you understand "run[ning] trials of equal number of each text" to mean?

As for
> How to avoid selection of same image type on both sides?

use lists and values and set a /not constraint on the list(s), or sample item numbers from a single list.


Here's something you can work through and modify as needed.

<values>
/ lftimg = ""
/ rgtimg = ""
/ lftitemnumber = 0
/ rgtitemnumber = 0

/ aitem = 0
/ bitem = 0
/ citem = 0
/ ditem = 0
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.aitem
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.bitem
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.citem
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.ditem
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<text minus>
/ items = ("Negative")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list image>
/ items = (text.A, text.B, text.C, text.D)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list itemnumbers>
/ poolsize = 8
/ selectionrate = always
</list>

<trial plus>
/ ontrialbegin = [
    trial.plus.resetstimulusframes();
    list.image.reset();
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.lftimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on left side
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.rgtimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on right side
    
    if (values.lftimg == text.A) {
        text.A.hposition = 30%;
        values.aitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.aitem;
    } else if (values.lftimg == text.B) {
        text.B.hposition = 30%;
    values.bitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.bitem;
    } else if (values.lftimg == text.C) {
        text.C.hposition = 30%;
        values.citem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.citem;
    } else if (values.lftimg == text.D) {
        text.D.hposition = 30%;
        values.ditem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.ditem;
    };
        if (values.rgtimg == text.A) {
        text.A.hposition = 70%;
        values.aitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.aitem;
    } else if (values.rgtimg == text.B) {
        text.B.hposition = 70%;
        values.bitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.bitem;
    } else if (values.rgtimg == text.C) {
        text.C.hposition = 70%;
        values.citem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.citem;
    } else if (values.rgtimg == text.D) {
        text.D.hposition = 70%;
        values.ditem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.ditem;
    };
]
/ stimulusframes = [1=clearScreen, text.plus]
/ validresponse = ("a", "b")
</trial>

<trial minus>
/ ontrialbegin = [
    trial.minus.resetstimulusframes();
    list.image.reset();
    trial.minus.insertstimulusframe(list.image.nextvalue, 1);
    values.lftimg = list.image.currentvalue;
    trial.minus.insertstimulusframe(list.image.nextvalue, 1);
    values.rgtimg = list.image.currentvalue;
    
    if (values.lftimg == text.A) {
        text.A.hposition = 30%;
        values.aitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.aitem;
    } else if (values.lftimg == text.B) {
        text.B.hposition = 30%;
    values.bitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.bitem;
    } else if (values.lftimg == text.C) {
        text.C.hposition = 30%;
        values.citem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.citem;
    } else if (values.lftimg == text.D) {
        text.D.hposition = 30%;
        values.ditem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.ditem;
    };
        if (values.rgtimg == text.A) {
        text.A.hposition = 70%;
        values.aitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.aitem;
    } else if (values.rgtimg == text.B) {
        text.B.hposition = 70%;
        values.bitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.bitem;
    } else if (values.rgtimg == text.C) {
        text.C.hposition = 70%;
        values.citem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.citem;
    } else if (values.rgtimg == text.D) {
        text.D.hposition = 70%;
        values.ditem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.ditem;
    };
]
/ stimulusframes = [1=clearScreen, text.minus]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-10=noreplace(plus,minus)]
/ recorddata = true
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency correct
    values.lftimg values.rgtimg values.lftitemnumber values.rgtitemnumber)
</data>

Thank you very much Dave for your kind assistance. I have adjusted the code and it's working fine for one of my experiment.

I have another experiment (same as previous one - four groups of images (e.g., A, B, C, D), each group has eight images) but I have to select some specific pair of images such as:

For "plus" trial, I want to display
- two pairs of even (or odd) numbered images (i.e., if left image "C2.jpg" then right image "D4.jpg" or any other even or odd numbered pairs)
- two pairs of distinct numbered (i.e., one odd one even) images (i.e., if left image "A2.jpg" then right image "B7.jpg" or any other combinations of distinct numbers)

Same for "minus" trial. These two trials are in randomized order (total eight trials would be fine). How would I set this experiment please?

Would appreciate your help - thanks.

Set up separate lists containing odd and even item nunbers, pull the item number for the right image (2nd member of the pair) from the applicable list.

Here's the whole thing for the four plus trials. Minus trials ought to be implemented in the same way.

<values>
/ lftimg = ""
/ rgtimg = ""
/ lftitemnumber = 0
/ rgtitemnumber = 0

/ aitem = 0
/ bitem = 0
/ citem = 0
/ ditem = 0

/ trialtype = ""
/ rightlist = 1

/ lfttype = ""
/ rgttype = ""
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.aitem
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.bitem
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.citem
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.ditem
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list image>
/ items = (text.A, text.B, text.C, text.D)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list hpos>
/ items = (30%, 70%)
/ selectionrate = always
</list>

<list itemnumbers>
/ poolsize = 8
/ selectionrate = always
</list>

<list odditemnumbers>
/ items = (1,3,5,7)
/ not = (values.lftitemnumber)
/ selectionrate = always
/ replace = true
</list>

<list evenitemnumbers>
/ items = (2,4,6,8)
/ not = (values.lftitemnumber)
/ selectionrate = always
/ replace = true
</list>

<list rightitemnumber>
/ items = (list.odditemnumbers.nextvalue, list.evenitemnumbers.nextvalue)
/ selectionmode = values.rightlist
</list>

<list plustype>
/ items = ("same", "same", "distinct", "distinct")
</list>

<trial plus>
/ ontrialbegin = [
    values.trialtype = list.plustype.nextvalue; // determine trial type
    trial.plus.resetstimulusframes();
    list.image.reset();
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.lftimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on left side
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.rgtimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on right side
    
    if (values.lftimg == text.A) {
        text.A.hposition = 30%;
        values.aitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.aitem;
    } else if (values.lftimg == text.B) {
        text.B.hposition = 30%;
    values.bitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.bitem;
    } else if (values.lftimg == text.C) {
        text.C.hposition = 30%;
        values.citem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.citem;
    } else if (values.lftimg == text.D) {
        text.D.hposition = 30%;
        values.ditem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.ditem;
    };
    
    if (mod(values.lftitemnumber, 2) == 1) { // left item is odd
        values.lfttype = "odd";
        if (values.trialtype == "same") { // if trial type is same
            values.rgttype = "odd";
            values.rightlist = 1; // we use odd item numbers for the right image
        } else { // otherwise
            values.rgttype = "even";
            values.rightlist = 2; // we use even item numbers for the right image
        }
    } else if (mod(values.lftitemnumber, 2) == 0) { // left item is even
        values.lfttype = "even";
        if (values.trialtype == "same") { // if trial type is same
            values.rgttype = "even";
            values.rightlist = 2; // we use even item numbers for the right image
        } else { // otherwise
            values.rgttype = "odd";
            values.rightlist = 1; // we use odd item numbers for the right image
        }
    };
        if (values.rgtimg == text.A) {
        text.A.hposition = 70%;
        values.aitem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.aitem;
    } else if (values.rgtimg == text.B) {
        text.B.hposition = 70%;
        values.bitem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.bitem;
    } else if (values.rgtimg == text.C) {
        text.C.hposition = 70%;
        values.citem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.citem;
    } else if (values.rgtimg == text.D) {
        text.D.hposition = 70%;
        values.ditem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.ditem;
    };
]
/ stimulusframes = [1=clearScreen, text.plus]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-4 = trial.plus]
/ recorddata = true
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency correct
    values.lftimg values.rgtimg values.lftitemnumber values.rgtitemnumber values.trialtype values.lfttype values.rgttype)
</data>


Or you can do

<values>
/ lftimg = ""
/ rgtimg = ""
/ lftitemnumber = 0
/ rgtitemnumber = 0

/ aitem = 0
/ bitem = 0
/ citem = 0
/ ditem = 0

/ trialtype = ""
/ rightlist = 1
/ leftlist = 1
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.aitem
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.bitem
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.citem
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.ditem
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list image>
/ items = (text.A, text.B, text.C, text.D)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list hpos>
/ items = (30%, 70%)
/ selectionrate = always
</list>

<list odditemnumbers>
/ items = (1,3,5,7)
/ selectionrate = always
</list>

<list evenitemnumbers>
/ items = (2,4,6,8)
/ selectionrate = always
</list>

<list leftitemnumber>
/ items = (list.odditemnumbers.nextvalue, list.evenitemnumbers.nextvalue)
/ selectionmode = values.leftlist
</list>

<list rightitemnumber>
/ items = (list.odditemnumbers.nextvalue, list.evenitemnumbers.nextvalue)
/ selectionmode = values.rightlist
</list>

<list plustype>
/ items = ("odd/odd", "even/even", "odd/even", "even/odd")
</list>

<list plus_lft>
/ items = (1, 2, 1, 2)
/ selectionmode = list.plustype.currentindex
</list>

<list plus_rgt>
/ items = (1, 2, 2, 1)
/ selectionmode = list.plustype.currentindex
</list>



<trial plus>
/ ontrialbegin = [
    values.trialtype = list.plustype.nextvalue; // determine trial type
    values.leftlist = list.plus_lft.nextvalue;
    values.rightlist = list.plus_rgt.nextvalue;
    trial.plus.resetstimulusframes();
    list.image.reset();
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.lftimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on left side
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.rgtimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on right side
    
    if (values.lftimg == text.A) {
        text.A.hposition = 30%;
        values.aitem = list.leftitemnumber.nextvalue;
        values.lftitemnumber = values.aitem;
    } else if (values.lftimg == text.B) {
        text.B.hposition = 30%;
        values.bitem = list.leftitemnumber.nextvalue;
        values.lftitemnumber = values.bitem;
    } else if (values.lftimg == text.C) {
        text.C.hposition = 30%;
        values.citem = list.leftitemnumber.nextvalue;
        values.lftitemnumber = values.citem;
    } else if (values.lftimg == text.D) {
        text.D.hposition = 30%;
        values.ditem = list.leftitemnumber.nextvalue;
        values.lftitemnumber = values.ditem;
    };
        if (values.rgtimg == text.A) {
        text.A.hposition = 70%;
        values.aitem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.aitem;
    } else if (values.rgtimg == text.B) {
        text.B.hposition = 70%;
        values.bitem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.bitem;
    } else if (values.rgtimg == text.C) {
        text.C.hposition = 70%;
        values.citem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.citem;
    } else if (values.rgtimg == text.D) {
        text.D.hposition = 70%;
        values.ditem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.ditem;
    };
]
/ stimulusframes = [1=clearScreen, text.plus]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-4 = trial.plus]
/ recorddata = true
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency correct
    values.lftimg values.rgtimg values.lftitemnumber values.rgtitemnumber values.trialtype values.leftlist values.rightlist)
</data>


if you want one instance of each specific combination (odd/odd, even/even, odd/even, even/odd). These are all just variations on the same theme. If you understand how one works, you can implement any other.
Edited 2 Months Ago by Dave
wuaham
wuaham
Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)
Group: Forum Members
Posts: 38, Visits: 170
Dave - 12/6/2023
Dave - 12/6/2023
wuaham - 12/6/2023
Dave - 12/1/2023
Dave - 12/1/2023
wuaham - 12/1/2023
I have four groups of images (e.g., A, B, C, D), each group has eight images (currently I put them as text for testing). I want to display two images side by side selected randomly, a text in-between ("Positive" or "Negative" in randomize order) and run trials of equal number of each text.
(Script below)
Questions:
1. Horizontal position:
    How to set horizontal position (/hposition)) values for leftImage and rightImage?
    (Implemented in the script but having issues, sometimes displays horizontal position at zero (as initialized))
2. How to avoid selection of same group on both sides? (e.g., if leftImage comes from group C,
rightImage should be from remaining groups A, B, D but not from group C)
(Tried to branch conditionally but not working - please help)

3. How to avoid selection of same image type on both sides? (e.g., if C5.jpg selected for leftIamge, rightImage can't be A5.jpg, B5.jpg, or D5.jpg, please note I am managing image group by alphabet and type by number)?
(Not sure how to implement)

Would appreciate your kind help.
Thanks

Here is the script in Inquisit-6:
<values>
/ lftimg = ""
/ rgtimg = ""
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<text minus>
/ items = ("Negative")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list leftImage>
/ items = (text.A,text.B, text.C, text.D)
/ replace = true
/ selectionrate = always
</list>

<list rightImage>
/ items = (text.A,text.B, text.C, text.D)
/ replace = true
/ selectionrate = always
</list>

<trial plus>
/ ontrialbegin = [trial.plus.insertstimulusframe(list.leftImage.nextvalue, 1);
                 trial.plus.insertstimulusframe(list.rightImage.nextvalue, 1);]
/ branch = [if (substring(list.leftImage.currentvalue, 5, 1) == substring(list.rightImage.currentvalue, 5, 1)) trial.plus]
                
/ ontrialbegin = [if (substring(list.leftImage.currentvalue, 5, 1) == "A") {text.A.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "B") {text.B.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "C") {text.C.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "D") {text.D.hposition = 30%};]

/ ontrialbegin = [if (substring(list.rightImage.currentvalue, 5, 1) == "A") {text.A.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "B") {text.B.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "C") {text.C.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "D") {text.D.hposition = 70%};]

/ stimulusframes = [1=clearScreen; 2=text.plus; 3=list.leftImage, list.rightImage;]
/ validresponse = ("a", "b")
</trial>

<trial minus>
/ ontrialbegin = [trial.minus.insertstimulusframe(list.leftImage.nextvalue, 1);
                 trial.minus.insertstimulusframe(list.rightImage.nextvalue, 1);]
/ branch = [if (substring(list.leftImage.currentvalue, 5, 1) == substring(list.rightImage.currentvalue, 5, 1)) trial.minus]

/ ontrialbegin = [if (substring(list.leftImage.currentvalue, 5, 1) == "A") {text.A.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "B") {text.B.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "C") {text.C.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "D") {text.D.hposition = 30%};]

/ ontrialbegin = [if (substring(list.rightImage.currentvalue, 5, 1) == "A") {text.A.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "B") {text.B.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "C") {text.C.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "D") {text.D.hposition = 70%};]                
                
/ stimulusframes = [1=clearScreen; 2=text.minus; 3=list.leftImage, list.rightImage;]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-10=noreplace(plus,minus)]
/ recorddata = true
</block>


Why do you need two lists (list.leftimage list.rightimage), i.e. why don't you sample the two images to be presented from the same list? The same for left / right positions.

What do you understand "run[ning] trials of equal number of each text" to mean?

As for
> How to avoid selection of same image type on both sides?

use lists and values and set a /not constraint on the list(s), or sample item numbers from a single list.


Here's something you can work through and modify as needed.

<values>
/ lftimg = ""
/ rgtimg = ""
/ lftitemnumber = 0
/ rgtitemnumber = 0

/ aitem = 0
/ bitem = 0
/ citem = 0
/ ditem = 0
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.aitem
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.bitem
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.citem
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.ditem
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<text minus>
/ items = ("Negative")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list image>
/ items = (text.A, text.B, text.C, text.D)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list itemnumbers>
/ poolsize = 8
/ selectionrate = always
</list>

<trial plus>
/ ontrialbegin = [
    trial.plus.resetstimulusframes();
    list.image.reset();
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.lftimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on left side
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.rgtimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on right side
    
    if (values.lftimg == text.A) {
        text.A.hposition = 30%;
        values.aitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.aitem;
    } else if (values.lftimg == text.B) {
        text.B.hposition = 30%;
    values.bitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.bitem;
    } else if (values.lftimg == text.C) {
        text.C.hposition = 30%;
        values.citem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.citem;
    } else if (values.lftimg == text.D) {
        text.D.hposition = 30%;
        values.ditem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.ditem;
    };
        if (values.rgtimg == text.A) {
        text.A.hposition = 70%;
        values.aitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.aitem;
    } else if (values.rgtimg == text.B) {
        text.B.hposition = 70%;
        values.bitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.bitem;
    } else if (values.rgtimg == text.C) {
        text.C.hposition = 70%;
        values.citem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.citem;
    } else if (values.rgtimg == text.D) {
        text.D.hposition = 70%;
        values.ditem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.ditem;
    };
]
/ stimulusframes = [1=clearScreen, text.plus]
/ validresponse = ("a", "b")
</trial>

<trial minus>
/ ontrialbegin = [
    trial.minus.resetstimulusframes();
    list.image.reset();
    trial.minus.insertstimulusframe(list.image.nextvalue, 1);
    values.lftimg = list.image.currentvalue;
    trial.minus.insertstimulusframe(list.image.nextvalue, 1);
    values.rgtimg = list.image.currentvalue;
    
    if (values.lftimg == text.A) {
        text.A.hposition = 30%;
        values.aitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.aitem;
    } else if (values.lftimg == text.B) {
        text.B.hposition = 30%;
    values.bitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.bitem;
    } else if (values.lftimg == text.C) {
        text.C.hposition = 30%;
        values.citem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.citem;
    } else if (values.lftimg == text.D) {
        text.D.hposition = 30%;
        values.ditem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.ditem;
    };
        if (values.rgtimg == text.A) {
        text.A.hposition = 70%;
        values.aitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.aitem;
    } else if (values.rgtimg == text.B) {
        text.B.hposition = 70%;
        values.bitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.bitem;
    } else if (values.rgtimg == text.C) {
        text.C.hposition = 70%;
        values.citem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.citem;
    } else if (values.rgtimg == text.D) {
        text.D.hposition = 70%;
        values.ditem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.ditem;
    };
]
/ stimulusframes = [1=clearScreen, text.minus]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-10=noreplace(plus,minus)]
/ recorddata = true
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency correct
    values.lftimg values.rgtimg values.lftitemnumber values.rgtitemnumber)
</data>

Thank you very much Dave for your kind assistance. I have adjusted the code and it's working fine for one of my experiment.

I have another experiment (same as previous one - four groups of images (e.g., A, B, C, D), each group has eight images) but I have to select some specific pair of images such as:

For "plus" trial, I want to display
- two pairs of even (or odd) numbered images (i.e., if left image "C2.jpg" then right image "D4.jpg" or any other even or odd numbered pairs)
- two pairs of distinct numbered (i.e., one odd one even) images (i.e., if left image "A2.jpg" then right image "B7.jpg" or any other combinations of distinct numbers)

Same for "minus" trial. These two trials are in randomized order (total eight trials would be fine). How would I set this experiment please?

Would appreciate your help - thanks.

Set up separate lists containing odd and even item nunbers, pull the item number for the right image (2nd member of the pair) from the applicable list.

Here's the whole thing for the four plus trials. Minus trials ought to be implemented in the same way.

<values>
/ lftimg = ""
/ rgtimg = ""
/ lftitemnumber = 0
/ rgtitemnumber = 0

/ aitem = 0
/ bitem = 0
/ citem = 0
/ ditem = 0

/ trialtype = ""
/ rightlist = 1

/ lfttype = ""
/ rgttype = ""
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.aitem
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.bitem
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.citem
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.ditem
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list image>
/ items = (text.A, text.B, text.C, text.D)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list hpos>
/ items = (30%, 70%)
/ selectionrate = always
</list>

<list itemnumbers>
/ poolsize = 8
/ selectionrate = always
</list>

<list odditemnumbers>
/ items = (1,3,5,7)
/ not = (values.lftitemnumber)
/ selectionrate = always
/ replace = true
</list>

<list evenitemnumbers>
/ items = (2,4,6,8)
/ not = (values.lftitemnumber)
/ selectionrate = always
/ replace = true
</list>

<list rightitemnumber>
/ items = (list.odditemnumbers.nextvalue, list.evenitemnumbers.nextvalue)
/ selectionmode = values.rightlist
</list>

<list plustype>
/ items = ("same", "same", "distinct", "distinct")
</list>

<trial plus>
/ ontrialbegin = [
    values.trialtype = list.plustype.nextvalue; // determine trial type
    trial.plus.resetstimulusframes();
    list.image.reset();
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.lftimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on left side
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.rgtimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on right side
    
    if (values.lftimg == text.A) {
        text.A.hposition = 30%;
        values.aitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.aitem;
    } else if (values.lftimg == text.B) {
        text.B.hposition = 30%;
    values.bitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.bitem;
    } else if (values.lftimg == text.C) {
        text.C.hposition = 30%;
        values.citem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.citem;
    } else if (values.lftimg == text.D) {
        text.D.hposition = 30%;
        values.ditem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.ditem;
    };
    
    if (mod(values.lftitemnumber, 2) == 1) { // left item is odd
        values.lfttype = "odd";
        if (values.trialtype == "same") { // if trial type is same
            values.rgttype = "odd";
            values.rightlist = 1; // we use odd item numbers for the right image
        } else { // otherwise
            values.rgttype = "even";
            values.rightlist = 2; // we use even item numbers for the right image
        }
    } else if (mod(values.lftitemnumber, 2) == 0) { // left item is even
        values.lfttype = "even";
        if (values.trialtype == "same") { // if trial type is same
            values.rgttype = "even";
            values.rightlist = 2; // we use even item numbers for the right image
        } else { // otherwise
            values.rgttype = "odd";
            values.rightlist = 1; // we use odd item numbers for the right image
        }
    };
        if (values.rgtimg == text.A) {
        text.A.hposition = 70%;
        values.aitem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.aitem;
    } else if (values.rgtimg == text.B) {
        text.B.hposition = 70%;
        values.bitem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.bitem;
    } else if (values.rgtimg == text.C) {
        text.C.hposition = 70%;
        values.citem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.citem;
    } else if (values.rgtimg == text.D) {
        text.D.hposition = 70%;
        values.ditem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.ditem;
    };
]
/ stimulusframes = [1=clearScreen, text.plus]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-4 = trial.plus]
/ recorddata = true
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency correct
    values.lftimg values.rgtimg values.lftitemnumber values.rgtitemnumber values.trialtype values.lfttype values.rgttype)
</data>


Or you can do

<values>
/ lftimg = ""
/ rgtimg = ""
/ lftitemnumber = 0
/ rgtitemnumber = 0

/ aitem = 0
/ bitem = 0
/ citem = 0
/ ditem = 0

/ trialtype = ""
/ rightlist = 1
/ leftlist = 1
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.aitem
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.bitem
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.citem
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.ditem
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list image>
/ items = (text.A, text.B, text.C, text.D)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list hpos>
/ items = (30%, 70%)
/ selectionrate = always
</list>

<list odditemnumbers>
/ items = (1,3,5,7)
/ selectionrate = always
</list>

<list evenitemnumbers>
/ items = (2,4,6,8)
/ selectionrate = always
</list>

<list leftitemnumber>
/ items = (list.odditemnumbers.nextvalue, list.evenitemnumbers.nextvalue)
/ selectionmode = values.leftlist
</list>

<list rightitemnumber>
/ items = (list.odditemnumbers.nextvalue, list.evenitemnumbers.nextvalue)
/ selectionmode = values.rightlist
</list>

<list plustype>
/ items = ("odd/odd", "even/even", "odd/even", "even/odd")
</list>

<list plus_lft>
/ items = (1, 2, 1, 2)
/ selectionmode = list.plustype.currentindex
</list>

<list plus_rgt>
/ items = (1, 2, 2, 1)
/ selectionmode = list.plustype.currentindex
</list>



<trial plus>
/ ontrialbegin = [
    values.trialtype = list.plustype.nextvalue; // determine trial type
    values.leftlist = list.plus_lft.nextvalue;
    values.rightlist = list.plus_rgt.nextvalue;
    trial.plus.resetstimulusframes();
    list.image.reset();
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.lftimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on left side
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.rgtimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on right side
    
    if (values.lftimg == text.A) {
        text.A.hposition = 30%;
        values.aitem = list.leftitemnumber.nextvalue;
        values.lftitemnumber = values.aitem;
    } else if (values.lftimg == text.B) {
        text.B.hposition = 30%;
        values.bitem = list.leftitemnumber.nextvalue;
        values.lftitemnumber = values.bitem;
    } else if (values.lftimg == text.C) {
        text.C.hposition = 30%;
        values.citem = list.leftitemnumber.nextvalue;
        values.lftitemnumber = values.citem;
    } else if (values.lftimg == text.D) {
        text.D.hposition = 30%;
        values.ditem = list.leftitemnumber.nextvalue;
        values.lftitemnumber = values.ditem;
    };
        if (values.rgtimg == text.A) {
        text.A.hposition = 70%;
        values.aitem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.aitem;
    } else if (values.rgtimg == text.B) {
        text.B.hposition = 70%;
        values.bitem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.bitem;
    } else if (values.rgtimg == text.C) {
        text.C.hposition = 70%;
        values.citem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.citem;
    } else if (values.rgtimg == text.D) {
        text.D.hposition = 70%;
        values.ditem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.ditem;
    };
]
/ stimulusframes = [1=clearScreen, text.plus]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-4 = trial.plus]
/ recorddata = true
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency correct
    values.lftimg values.rgtimg values.lftitemnumber values.rgtitemnumber values.trialtype values.leftlist values.rightlist)
</data>


if you want one instance of each specific combination (odd/odd, even/even, odd/even, even/odd). These are all just variations on the same theme. If you understand how one works, you can implement any other.

Thank you Dave for your excellent help and that worked.

Now I have another question - apologies for so many...

I want to extend this to eight groups of images (e.g., A, B, C, D, E, F, G, H) where each group has eight images with a twist that now odd group consists of: text.A, text.C, text.E, text.G
and even group: text.B, text.D, text.F, text.H.

Is there a way we can select right image (values.rgtimg) based on whether left (values.lftimg) is from odd or even groups (considering text.A, text.C, text.E, text.G are in odd group and text.B, text.D, text.F, text.H are in even group) and then we target an item within that group.

Since there are 8 groups of images with 8 images in each group, so we can have 64 trials [i.e., (left, right) images pair as (1,1), (1,2), ..., (8,8) in randomised order]. Discarding the same pairs [such as (1,1), (2,2)..., (8,8)] we will have only 56 pairs.

If we have a 32 "plus" trials, I would like to have 16 "distinct", and 16 "same" (with 8 "odd" and 8 "even") trials.

How do I modify this script please?

Would appreciate your help.

Thanks.

Here is the code (just put all stimulus):

<values>
/ lftimg = ""
/ rgtimg = ""
/ lftitemnumber = 0
/ rgtitemnumber = 0

/ aitem = 0
/ bitem = 0
/ citem = 0
/ ditem = 0
/ eitem = 0
/ fitem = 0
/ gitem = 0
/ hitem = 0

/ trialtype = ""
/ rightlist = 1

/ lfttype = ""
/ rgttype = ""
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.aitem
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.bitem
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.citem
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.ditem
</text>

<text E>
/items = ("E1.jpg","E2.jpg","E3.jpg","E4.jpg","E5.jpg","E6.jpg","E7.jpg","E8.jpg")
/size = (20%,20%)
/fontstyle = ("Erial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.eitem
</text>

<text F>
/items = ("F1.jpg","F2.jpg","F3.jpg","F4.jpg","F5.jpg","F6.jpg","F7.jpg","F8.jpg")
/size = (20%,20%)
/fontstyle = ("Frial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.fitem
</text>

<text G>
/items = ("G1.jpg","G2.jpg","G3.jpg","G4.jpg","G5.jpg","G6.jpg","G7.jpg","G8.jpg")
/size = (20%,20%)
/fontstyle = ("Grial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.gitem
</text>

<text H>
/items = ("H1.jpg","H2.jpg","H3.jpg","H4.jpg","H5.jpg","H6.jpg","H7.jpg","H8.jpg")
/size = (20%,20%)
/fontstyle = ("Hrial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.hitem
</text>


<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list image>
/ items = (text.A, text.B, text.C, text.D, text.E, text.F, text.G, text.H)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list hpos>
/ items = (30%, 70%)
/ selectionrate = always
</list>

<list itemnumbers>
/ poolsize = 8
/ selectionrate = always
</list>

<list odditemnumbers>
/ items = (1,3,5,7)
/ not = (values.lftitemnumber)
/ selectionrate = always
/ replace = true
</list>

<list evenitemnumbers>
/ items = (2,4,6,8)
/ not = (values.lftitemnumber)
/ selectionrate = always
/ replace = true
</list>

<list rightitemnumber>
/ items = (list.odditemnumbers.nextvalue, list.evenitemnumbers.nextvalue)
/ selectionmode = values.rightlist
</list>

<list plustype>
/ items = ("same", "same", "distinct", "distinct")
</list>

<trial plus>
/ ontrialbegin = [
  values.trialtype = list.plustype.nextvalue; // determine trial type
  trial.plus.resetstimulusframes();
  list.image.reset();
  trial.plus.insertstimulusframe(list.image.nextvalue, 1);
  values.lftimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on left side
  trial.plus.insertstimulusframe(list.image.nextvalue, 1);
  values.rgtimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on right side
 
  if (values.lftimg == text.A) {
   text.A.hposition = 30%;
   values.aitem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.aitem;

  } else if (values.lftimg == text.B) {
   text.B.hposition = 30%;
  values.bitem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.bitem;

  } else if (values.lftimg == text.C) {
   text.C.hposition = 30%;
   values.citem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.citem;

  } else if (values.lftimg == text.D) {
   text.D.hposition = 30%;
   values.ditem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.ditem;

  } else if (values.lftimg == text.E) {
   text.E.hposition = 30%;
   values.eitem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.eitem;

  } else if (values.lftimg == text.F) {
   text.F.hposition = 30%;
   values.fitem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.fitem;

  } else if (values.lftimg == text.G) {
   text.E.hposition = 30%;
   values.gitem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.gitem;

  } else if (values.lftimg == text.H) {
   text.F.hposition = 30%;
   values.hitem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.hitem;
  };
 
  if (mod(values.lftitemnumber, 2) == 1) { // left item is odd
   values.lfttype = "odd";
   if (values.trialtype == "same") { // if trial type is same
    values.rgttype = "odd";
    values.rightlist = 1; // we use odd item numbers for the right image
   } else { // otherwise
    values.rgttype = "even";
    values.rightlist = 2; // we use even item numbers for the right image
   }
  } else if (mod(values.lftitemnumber, 2) == 0) { // left item is even
   values.lfttype = "even";
   if (values.trialtype == "same") { // if trial type is same
    values.rgttype = "even";
    values.rightlist = 2; // we use even item numbers for the right image
   } else { // otherwise
    values.rgttype = "odd";
    values.rightlist = 1; // we use odd item numbers for the right image
   }
  };
   if (values.rgtimg == text.A) {
   text.A.hposition = 70%;
   values.aitem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.aitem;

  } else if (values.rgtimg == text.B) {
   text.B.hposition = 70%;
   values.bitem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.bitem;

  } else if (values.rgtimg == text.C) {
   text.C.hposition = 70%;
   values.citem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.citem;

  } else if (values.rgtimg == text.D) {
   text.D.hposition = 70%;
   values.ditem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.ditem;

  } else if (values.rgtimg == text.E) {
   text.C.hposition = 70%;
   values.eitem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.eitem;

  } else if (values.rgtimg == text.F) {
   text.D.hposition = 70%;
   values.fitem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.fitem;

  } else if (values.rgtimg == text.G) {
   text.C.hposition = 70%;
   values.gitem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.gitem;

  } else if (values.rgtimg == text.H) {
   text.D.hposition = 70%;
   values.hitem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.hitem;
  };
]
/ stimulusframes = [1=clearScreen, text.plus]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-64 = trial.plus]
/ recorddata = true
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency correct
  values.lftimg values.rgtimg values.lftitemnumber values.rgtitemnumber values.trialtype values.lfttype values.rgttype)
</data>

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: 97K
wuaham - 12/8/2023
Dave - 12/6/2023
Dave - 12/6/2023
wuaham - 12/6/2023
Dave - 12/1/2023
Dave - 12/1/2023
wuaham - 12/1/2023
I have four groups of images (e.g., A, B, C, D), each group has eight images (currently I put them as text for testing). I want to display two images side by side selected randomly, a text in-between ("Positive" or "Negative" in randomize order) and run trials of equal number of each text.
(Script below)
Questions:
1. Horizontal position:
    How to set horizontal position (/hposition)) values for leftImage and rightImage?
    (Implemented in the script but having issues, sometimes displays horizontal position at zero (as initialized))
2. How to avoid selection of same group on both sides? (e.g., if leftImage comes from group C,
rightImage should be from remaining groups A, B, D but not from group C)
(Tried to branch conditionally but not working - please help)

3. How to avoid selection of same image type on both sides? (e.g., if C5.jpg selected for leftIamge, rightImage can't be A5.jpg, B5.jpg, or D5.jpg, please note I am managing image group by alphabet and type by number)?
(Not sure how to implement)

Would appreciate your kind help.
Thanks

Here is the script in Inquisit-6:
<values>
/ lftimg = ""
/ rgtimg = ""
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<text minus>
/ items = ("Negative")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list leftImage>
/ items = (text.A,text.B, text.C, text.D)
/ replace = true
/ selectionrate = always
</list>

<list rightImage>
/ items = (text.A,text.B, text.C, text.D)
/ replace = true
/ selectionrate = always
</list>

<trial plus>
/ ontrialbegin = [trial.plus.insertstimulusframe(list.leftImage.nextvalue, 1);
                 trial.plus.insertstimulusframe(list.rightImage.nextvalue, 1);]
/ branch = [if (substring(list.leftImage.currentvalue, 5, 1) == substring(list.rightImage.currentvalue, 5, 1)) trial.plus]
                
/ ontrialbegin = [if (substring(list.leftImage.currentvalue, 5, 1) == "A") {text.A.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "B") {text.B.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "C") {text.C.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "D") {text.D.hposition = 30%};]

/ ontrialbegin = [if (substring(list.rightImage.currentvalue, 5, 1) == "A") {text.A.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "B") {text.B.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "C") {text.C.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "D") {text.D.hposition = 70%};]

/ stimulusframes = [1=clearScreen; 2=text.plus; 3=list.leftImage, list.rightImage;]
/ validresponse = ("a", "b")
</trial>

<trial minus>
/ ontrialbegin = [trial.minus.insertstimulusframe(list.leftImage.nextvalue, 1);
                 trial.minus.insertstimulusframe(list.rightImage.nextvalue, 1);]
/ branch = [if (substring(list.leftImage.currentvalue, 5, 1) == substring(list.rightImage.currentvalue, 5, 1)) trial.minus]

/ ontrialbegin = [if (substring(list.leftImage.currentvalue, 5, 1) == "A") {text.A.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "B") {text.B.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "C") {text.C.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "D") {text.D.hposition = 30%};]

/ ontrialbegin = [if (substring(list.rightImage.currentvalue, 5, 1) == "A") {text.A.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "B") {text.B.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "C") {text.C.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "D") {text.D.hposition = 70%};]                
                
/ stimulusframes = [1=clearScreen; 2=text.minus; 3=list.leftImage, list.rightImage;]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-10=noreplace(plus,minus)]
/ recorddata = true
</block>


Why do you need two lists (list.leftimage list.rightimage), i.e. why don't you sample the two images to be presented from the same list? The same for left / right positions.

What do you understand "run[ning] trials of equal number of each text" to mean?

As for
> How to avoid selection of same image type on both sides?

use lists and values and set a /not constraint on the list(s), or sample item numbers from a single list.


Here's something you can work through and modify as needed.

<values>
/ lftimg = ""
/ rgtimg = ""
/ lftitemnumber = 0
/ rgtitemnumber = 0

/ aitem = 0
/ bitem = 0
/ citem = 0
/ ditem = 0
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.aitem
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.bitem
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.citem
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.ditem
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<text minus>
/ items = ("Negative")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list image>
/ items = (text.A, text.B, text.C, text.D)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list itemnumbers>
/ poolsize = 8
/ selectionrate = always
</list>

<trial plus>
/ ontrialbegin = [
    trial.plus.resetstimulusframes();
    list.image.reset();
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.lftimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on left side
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.rgtimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on right side
    
    if (values.lftimg == text.A) {
        text.A.hposition = 30%;
        values.aitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.aitem;
    } else if (values.lftimg == text.B) {
        text.B.hposition = 30%;
    values.bitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.bitem;
    } else if (values.lftimg == text.C) {
        text.C.hposition = 30%;
        values.citem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.citem;
    } else if (values.lftimg == text.D) {
        text.D.hposition = 30%;
        values.ditem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.ditem;
    };
        if (values.rgtimg == text.A) {
        text.A.hposition = 70%;
        values.aitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.aitem;
    } else if (values.rgtimg == text.B) {
        text.B.hposition = 70%;
        values.bitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.bitem;
    } else if (values.rgtimg == text.C) {
        text.C.hposition = 70%;
        values.citem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.citem;
    } else if (values.rgtimg == text.D) {
        text.D.hposition = 70%;
        values.ditem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.ditem;
    };
]
/ stimulusframes = [1=clearScreen, text.plus]
/ validresponse = ("a", "b")
</trial>

<trial minus>
/ ontrialbegin = [
    trial.minus.resetstimulusframes();
    list.image.reset();
    trial.minus.insertstimulusframe(list.image.nextvalue, 1);
    values.lftimg = list.image.currentvalue;
    trial.minus.insertstimulusframe(list.image.nextvalue, 1);
    values.rgtimg = list.image.currentvalue;
    
    if (values.lftimg == text.A) {
        text.A.hposition = 30%;
        values.aitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.aitem;
    } else if (values.lftimg == text.B) {
        text.B.hposition = 30%;
    values.bitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.bitem;
    } else if (values.lftimg == text.C) {
        text.C.hposition = 30%;
        values.citem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.citem;
    } else if (values.lftimg == text.D) {
        text.D.hposition = 30%;
        values.ditem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.ditem;
    };
        if (values.rgtimg == text.A) {
        text.A.hposition = 70%;
        values.aitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.aitem;
    } else if (values.rgtimg == text.B) {
        text.B.hposition = 70%;
        values.bitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.bitem;
    } else if (values.rgtimg == text.C) {
        text.C.hposition = 70%;
        values.citem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.citem;
    } else if (values.rgtimg == text.D) {
        text.D.hposition = 70%;
        values.ditem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.ditem;
    };
]
/ stimulusframes = [1=clearScreen, text.minus]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-10=noreplace(plus,minus)]
/ recorddata = true
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency correct
    values.lftimg values.rgtimg values.lftitemnumber values.rgtitemnumber)
</data>

Thank you very much Dave for your kind assistance. I have adjusted the code and it's working fine for one of my experiment.

I have another experiment (same as previous one - four groups of images (e.g., A, B, C, D), each group has eight images) but I have to select some specific pair of images such as:

For "plus" trial, I want to display
- two pairs of even (or odd) numbered images (i.e., if left image "C2.jpg" then right image "D4.jpg" or any other even or odd numbered pairs)
- two pairs of distinct numbered (i.e., one odd one even) images (i.e., if left image "A2.jpg" then right image "B7.jpg" or any other combinations of distinct numbers)

Same for "minus" trial. These two trials are in randomized order (total eight trials would be fine). How would I set this experiment please?

Would appreciate your help - thanks.

Set up separate lists containing odd and even item nunbers, pull the item number for the right image (2nd member of the pair) from the applicable list.

Here's the whole thing for the four plus trials. Minus trials ought to be implemented in the same way.

<values>
/ lftimg = ""
/ rgtimg = ""
/ lftitemnumber = 0
/ rgtitemnumber = 0

/ aitem = 0
/ bitem = 0
/ citem = 0
/ ditem = 0

/ trialtype = ""
/ rightlist = 1

/ lfttype = ""
/ rgttype = ""
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.aitem
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.bitem
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.citem
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.ditem
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list image>
/ items = (text.A, text.B, text.C, text.D)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list hpos>
/ items = (30%, 70%)
/ selectionrate = always
</list>

<list itemnumbers>
/ poolsize = 8
/ selectionrate = always
</list>

<list odditemnumbers>
/ items = (1,3,5,7)
/ not = (values.lftitemnumber)
/ selectionrate = always
/ replace = true
</list>

<list evenitemnumbers>
/ items = (2,4,6,8)
/ not = (values.lftitemnumber)
/ selectionrate = always
/ replace = true
</list>

<list rightitemnumber>
/ items = (list.odditemnumbers.nextvalue, list.evenitemnumbers.nextvalue)
/ selectionmode = values.rightlist
</list>

<list plustype>
/ items = ("same", "same", "distinct", "distinct")
</list>

<trial plus>
/ ontrialbegin = [
    values.trialtype = list.plustype.nextvalue; // determine trial type
    trial.plus.resetstimulusframes();
    list.image.reset();
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.lftimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on left side
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.rgtimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on right side
    
    if (values.lftimg == text.A) {
        text.A.hposition = 30%;
        values.aitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.aitem;
    } else if (values.lftimg == text.B) {
        text.B.hposition = 30%;
    values.bitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.bitem;
    } else if (values.lftimg == text.C) {
        text.C.hposition = 30%;
        values.citem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.citem;
    } else if (values.lftimg == text.D) {
        text.D.hposition = 30%;
        values.ditem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.ditem;
    };
    
    if (mod(values.lftitemnumber, 2) == 1) { // left item is odd
        values.lfttype = "odd";
        if (values.trialtype == "same") { // if trial type is same
            values.rgttype = "odd";
            values.rightlist = 1; // we use odd item numbers for the right image
        } else { // otherwise
            values.rgttype = "even";
            values.rightlist = 2; // we use even item numbers for the right image
        }
    } else if (mod(values.lftitemnumber, 2) == 0) { // left item is even
        values.lfttype = "even";
        if (values.trialtype == "same") { // if trial type is same
            values.rgttype = "even";
            values.rightlist = 2; // we use even item numbers for the right image
        } else { // otherwise
            values.rgttype = "odd";
            values.rightlist = 1; // we use odd item numbers for the right image
        }
    };
        if (values.rgtimg == text.A) {
        text.A.hposition = 70%;
        values.aitem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.aitem;
    } else if (values.rgtimg == text.B) {
        text.B.hposition = 70%;
        values.bitem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.bitem;
    } else if (values.rgtimg == text.C) {
        text.C.hposition = 70%;
        values.citem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.citem;
    } else if (values.rgtimg == text.D) {
        text.D.hposition = 70%;
        values.ditem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.ditem;
    };
]
/ stimulusframes = [1=clearScreen, text.plus]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-4 = trial.plus]
/ recorddata = true
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency correct
    values.lftimg values.rgtimg values.lftitemnumber values.rgtitemnumber values.trialtype values.lfttype values.rgttype)
</data>


Or you can do

<values>
/ lftimg = ""
/ rgtimg = ""
/ lftitemnumber = 0
/ rgtitemnumber = 0

/ aitem = 0
/ bitem = 0
/ citem = 0
/ ditem = 0

/ trialtype = ""
/ rightlist = 1
/ leftlist = 1
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.aitem
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.bitem
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.citem
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.ditem
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list image>
/ items = (text.A, text.B, text.C, text.D)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list hpos>
/ items = (30%, 70%)
/ selectionrate = always
</list>

<list odditemnumbers>
/ items = (1,3,5,7)
/ selectionrate = always
</list>

<list evenitemnumbers>
/ items = (2,4,6,8)
/ selectionrate = always
</list>

<list leftitemnumber>
/ items = (list.odditemnumbers.nextvalue, list.evenitemnumbers.nextvalue)
/ selectionmode = values.leftlist
</list>

<list rightitemnumber>
/ items = (list.odditemnumbers.nextvalue, list.evenitemnumbers.nextvalue)
/ selectionmode = values.rightlist
</list>

<list plustype>
/ items = ("odd/odd", "even/even", "odd/even", "even/odd")
</list>

<list plus_lft>
/ items = (1, 2, 1, 2)
/ selectionmode = list.plustype.currentindex
</list>

<list plus_rgt>
/ items = (1, 2, 2, 1)
/ selectionmode = list.plustype.currentindex
</list>



<trial plus>
/ ontrialbegin = [
    values.trialtype = list.plustype.nextvalue; // determine trial type
    values.leftlist = list.plus_lft.nextvalue;
    values.rightlist = list.plus_rgt.nextvalue;
    trial.plus.resetstimulusframes();
    list.image.reset();
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.lftimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on left side
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.rgtimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on right side
    
    if (values.lftimg == text.A) {
        text.A.hposition = 30%;
        values.aitem = list.leftitemnumber.nextvalue;
        values.lftitemnumber = values.aitem;
    } else if (values.lftimg == text.B) {
        text.B.hposition = 30%;
        values.bitem = list.leftitemnumber.nextvalue;
        values.lftitemnumber = values.bitem;
    } else if (values.lftimg == text.C) {
        text.C.hposition = 30%;
        values.citem = list.leftitemnumber.nextvalue;
        values.lftitemnumber = values.citem;
    } else if (values.lftimg == text.D) {
        text.D.hposition = 30%;
        values.ditem = list.leftitemnumber.nextvalue;
        values.lftitemnumber = values.ditem;
    };
        if (values.rgtimg == text.A) {
        text.A.hposition = 70%;
        values.aitem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.aitem;
    } else if (values.rgtimg == text.B) {
        text.B.hposition = 70%;
        values.bitem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.bitem;
    } else if (values.rgtimg == text.C) {
        text.C.hposition = 70%;
        values.citem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.citem;
    } else if (values.rgtimg == text.D) {
        text.D.hposition = 70%;
        values.ditem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.ditem;
    };
]
/ stimulusframes = [1=clearScreen, text.plus]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-4 = trial.plus]
/ recorddata = true
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency correct
    values.lftimg values.rgtimg values.lftitemnumber values.rgtitemnumber values.trialtype values.leftlist values.rightlist)
</data>


if you want one instance of each specific combination (odd/odd, even/even, odd/even, even/odd). These are all just variations on the same theme. If you understand how one works, you can implement any other.

Thank you Dave for your excellent help and that worked.

Now I have another question - apologies for so many...

I want to extend this to eight groups of images (e.g., A, B, C, D, E, F, G, H) where each group has eight images with a twist that now odd group consists of: text.A, text.C, text.E, text.G
and even group: text.B, text.D, text.F, text.H.

Is there a way we can select right image (values.rgtimg) based on whether left (values.lftimg) is from odd or even groups (considering text.A, text.C, text.E, text.G are in odd group and text.B, text.D, text.F, text.H are in even group) and then we target an item within that group.

Since there are 8 groups of images with 8 images in each group, so we can have 64 trials [i.e., (left, right) images pair as (1,1), (1,2), ..., (8,8) in randomised order]. Discarding the same pairs [such as (1,1), (2,2)..., (8,8)] we will have only 56 pairs.

If we have a 32 "plus" trials, I would like to have 16 "distinct", and 16 "same" (with 8 "odd" and 8 "even") trials.

How do I modify this script please?

Would appreciate your help.

Thanks.

Here is the code (just put all stimulus):

<values>
/ lftimg = ""
/ rgtimg = ""
/ lftitemnumber = 0
/ rgtitemnumber = 0

/ aitem = 0
/ bitem = 0
/ citem = 0
/ ditem = 0
/ eitem = 0
/ fitem = 0
/ gitem = 0
/ hitem = 0

/ trialtype = ""
/ rightlist = 1

/ lfttype = ""
/ rgttype = ""
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.aitem
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.bitem
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.citem
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.ditem
</text>

<text E>
/items = ("E1.jpg","E2.jpg","E3.jpg","E4.jpg","E5.jpg","E6.jpg","E7.jpg","E8.jpg")
/size = (20%,20%)
/fontstyle = ("Erial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.eitem
</text>

<text F>
/items = ("F1.jpg","F2.jpg","F3.jpg","F4.jpg","F5.jpg","F6.jpg","F7.jpg","F8.jpg")
/size = (20%,20%)
/fontstyle = ("Frial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.fitem
</text>

<text G>
/items = ("G1.jpg","G2.jpg","G3.jpg","G4.jpg","G5.jpg","G6.jpg","G7.jpg","G8.jpg")
/size = (20%,20%)
/fontstyle = ("Grial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.gitem
</text>

<text H>
/items = ("H1.jpg","H2.jpg","H3.jpg","H4.jpg","H5.jpg","H6.jpg","H7.jpg","H8.jpg")
/size = (20%,20%)
/fontstyle = ("Hrial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.hitem
</text>


<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list image>
/ items = (text.A, text.B, text.C, text.D, text.E, text.F, text.G, text.H)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list hpos>
/ items = (30%, 70%)
/ selectionrate = always
</list>

<list itemnumbers>
/ poolsize = 8
/ selectionrate = always
</list>

<list odditemnumbers>
/ items = (1,3,5,7)
/ not = (values.lftitemnumber)
/ selectionrate = always
/ replace = true
</list>

<list evenitemnumbers>
/ items = (2,4,6,8)
/ not = (values.lftitemnumber)
/ selectionrate = always
/ replace = true
</list>

<list rightitemnumber>
/ items = (list.odditemnumbers.nextvalue, list.evenitemnumbers.nextvalue)
/ selectionmode = values.rightlist
</list>

<list plustype>
/ items = ("same", "same", "distinct", "distinct")
</list>

<trial plus>
/ ontrialbegin = [
  values.trialtype = list.plustype.nextvalue; // determine trial type
  trial.plus.resetstimulusframes();
  list.image.reset();
  trial.plus.insertstimulusframe(list.image.nextvalue, 1);
  values.lftimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on left side
  trial.plus.insertstimulusframe(list.image.nextvalue, 1);
  values.rgtimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on right side
 
  if (values.lftimg == text.A) {
   text.A.hposition = 30%;
   values.aitem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.aitem;

  } else if (values.lftimg == text.B) {
   text.B.hposition = 30%;
  values.bitem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.bitem;

  } else if (values.lftimg == text.C) {
   text.C.hposition = 30%;
   values.citem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.citem;

  } else if (values.lftimg == text.D) {
   text.D.hposition = 30%;
   values.ditem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.ditem;

  } else if (values.lftimg == text.E) {
   text.E.hposition = 30%;
   values.eitem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.eitem;

  } else if (values.lftimg == text.F) {
   text.F.hposition = 30%;
   values.fitem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.fitem;

  } else if (values.lftimg == text.G) {
   text.E.hposition = 30%;
   values.gitem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.gitem;

  } else if (values.lftimg == text.H) {
   text.F.hposition = 30%;
   values.hitem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.hitem;
  };
 
  if (mod(values.lftitemnumber, 2) == 1) { // left item is odd
   values.lfttype = "odd";
   if (values.trialtype == "same") { // if trial type is same
    values.rgttype = "odd";
    values.rightlist = 1; // we use odd item numbers for the right image
   } else { // otherwise
    values.rgttype = "even";
    values.rightlist = 2; // we use even item numbers for the right image
   }
  } else if (mod(values.lftitemnumber, 2) == 0) { // left item is even
   values.lfttype = "even";
   if (values.trialtype == "same") { // if trial type is same
    values.rgttype = "even";
    values.rightlist = 2; // we use even item numbers for the right image
   } else { // otherwise
    values.rgttype = "odd";
    values.rightlist = 1; // we use odd item numbers for the right image
   }
  };
   if (values.rgtimg == text.A) {
   text.A.hposition = 70%;
   values.aitem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.aitem;

  } else if (values.rgtimg == text.B) {
   text.B.hposition = 70%;
   values.bitem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.bitem;

  } else if (values.rgtimg == text.C) {
   text.C.hposition = 70%;
   values.citem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.citem;

  } else if (values.rgtimg == text.D) {
   text.D.hposition = 70%;
   values.ditem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.ditem;

  } else if (values.rgtimg == text.E) {
   text.C.hposition = 70%;
   values.eitem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.eitem;

  } else if (values.rgtimg == text.F) {
   text.D.hposition = 70%;
   values.fitem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.fitem;

  } else if (values.rgtimg == text.G) {
   text.C.hposition = 70%;
   values.gitem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.gitem;

  } else if (values.rgtimg == text.H) {
   text.D.hposition = 70%;
   values.hitem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.hitem;
  };
]
/ stimulusframes = [1=clearScreen, text.plus]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-64 = trial.plus]
/ recorddata = true
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency correct
  values.lftimg values.rgtimg values.lftitemnumber values.rgtitemnumber values.trialtype values.lfttype values.rgttype)
</data>

> Is there a way we can select right image (values.rgtimg) based on whether left (values.lftimg) is from odd or even groups
> (considering text.A, text.C, text.E, text.G are in odd group and text.B, text.D, text.F, text.H are in even group) and then we target an item within that group.

The answer is the same as in my previous response. Whether it's different images (an "odd" group and an "even" group) or odd vs even item number doesn't make a real difference. So please go back and work through the code I already gave you until you fully understand it, then modify if accordignly.

> Since there are 8 groups of images with 8 images in each group, so we can have 64 trials [i.e., (left, right) images pair as (1,1), (1,2), ..., (8,8) in randomised order].
> Discarding the same pairs [such as (1,1), (2,2)..., (8,8)] we will have only 56 pairs.

Use parired lists to define the pairs, sample from those pairs. This, too, is no different from what's already been discussed.
wuaham
wuaham
Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)Respected Member (305 reputation)
Group: Forum Members
Posts: 38, Visits: 170
Dave - 12/8/2023
wuaham - 12/8/2023
Dave - 12/6/2023
Dave - 12/6/2023
wuaham - 12/6/2023
Dave - 12/1/2023
Dave - 12/1/2023
wuaham - 12/1/2023
I have four groups of images (e.g., A, B, C, D), each group has eight images (currently I put them as text for testing). I want to display two images side by side selected randomly, a text in-between ("Positive" or "Negative" in randomize order) and run trials of equal number of each text.
(Script below)
Questions:
1. Horizontal position:
    How to set horizontal position (/hposition)) values for leftImage and rightImage?
    (Implemented in the script but having issues, sometimes displays horizontal position at zero (as initialized))
2. How to avoid selection of same group on both sides? (e.g., if leftImage comes from group C,
rightImage should be from remaining groups A, B, D but not from group C)
(Tried to branch conditionally but not working - please help)

3. How to avoid selection of same image type on both sides? (e.g., if C5.jpg selected for leftIamge, rightImage can't be A5.jpg, B5.jpg, or D5.jpg, please note I am managing image group by alphabet and type by number)?
(Not sure how to implement)

Would appreciate your kind help.
Thanks

Here is the script in Inquisit-6:
<values>
/ lftimg = ""
/ rgtimg = ""
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<text minus>
/ items = ("Negative")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list leftImage>
/ items = (text.A,text.B, text.C, text.D)
/ replace = true
/ selectionrate = always
</list>

<list rightImage>
/ items = (text.A,text.B, text.C, text.D)
/ replace = true
/ selectionrate = always
</list>

<trial plus>
/ ontrialbegin = [trial.plus.insertstimulusframe(list.leftImage.nextvalue, 1);
                 trial.plus.insertstimulusframe(list.rightImage.nextvalue, 1);]
/ branch = [if (substring(list.leftImage.currentvalue, 5, 1) == substring(list.rightImage.currentvalue, 5, 1)) trial.plus]
                
/ ontrialbegin = [if (substring(list.leftImage.currentvalue, 5, 1) == "A") {text.A.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "B") {text.B.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "C") {text.C.hposition = 30%}
                    else if (substring(list.leftImage.currentvalue, 5, 1) == "D") {text.D.hposition = 30%};]

/ ontrialbegin = [if (substring(list.rightImage.currentvalue, 5, 1) == "A") {text.A.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "B") {text.B.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "C") {text.C.hposition = 70%}
                    else if (substring(list.rightImage.currentvalue, 5, 1) == "D") {text.D.hposition = 70%};]

/ stimulusframes = [1=clearScreen; 2=text.plus; 3=list.leftImage, list.rightImage;]
/ validresponse = ("a", "b")
</trial>

<trial minus>
/ ontrialbegin = [trial.minus.insertstimulusframe(list.leftImage.nextvalue, 1);
                 trial.minus.insertstimulusframe(list.rightImage.nextvalue, 1);]
/ branch = [if (substring(list.leftImage.currentvalue, 5, 1) == substring(list.rightImage.currentvalue, 5, 1)) trial.minus]

/ ontrialbegin = [if (substring(list.leftImage.currentvalue, 5, 1) == "A") {text.A.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "B") {text.B.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "C") {text.C.hposition = 30%}
else if (substring(list.leftImage.currentvalue, 5, 1) == "D") {text.D.hposition = 30%};]

/ ontrialbegin = [if (substring(list.rightImage.currentvalue, 5, 1) == "A") {text.A.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "B") {text.B.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "C") {text.C.hposition = 70%}
else if (substring(list.rightImage.currentvalue, 5, 1) == "D") {text.D.hposition = 70%};]                
                
/ stimulusframes = [1=clearScreen; 2=text.minus; 3=list.leftImage, list.rightImage;]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-10=noreplace(plus,minus)]
/ recorddata = true
</block>


Why do you need two lists (list.leftimage list.rightimage), i.e. why don't you sample the two images to be presented from the same list? The same for left / right positions.

What do you understand "run[ning] trials of equal number of each text" to mean?

As for
> How to avoid selection of same image type on both sides?

use lists and values and set a /not constraint on the list(s), or sample item numbers from a single list.


Here's something you can work through and modify as needed.

<values>
/ lftimg = ""
/ rgtimg = ""
/ lftitemnumber = 0
/ rgtitemnumber = 0

/ aitem = 0
/ bitem = 0
/ citem = 0
/ ditem = 0
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.aitem
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.bitem
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.citem
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.ditem
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<text minus>
/ items = ("Negative")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list image>
/ items = (text.A, text.B, text.C, text.D)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list itemnumbers>
/ poolsize = 8
/ selectionrate = always
</list>

<trial plus>
/ ontrialbegin = [
    trial.plus.resetstimulusframes();
    list.image.reset();
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.lftimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on left side
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.rgtimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on right side
    
    if (values.lftimg == text.A) {
        text.A.hposition = 30%;
        values.aitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.aitem;
    } else if (values.lftimg == text.B) {
        text.B.hposition = 30%;
    values.bitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.bitem;
    } else if (values.lftimg == text.C) {
        text.C.hposition = 30%;
        values.citem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.citem;
    } else if (values.lftimg == text.D) {
        text.D.hposition = 30%;
        values.ditem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.ditem;
    };
        if (values.rgtimg == text.A) {
        text.A.hposition = 70%;
        values.aitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.aitem;
    } else if (values.rgtimg == text.B) {
        text.B.hposition = 70%;
        values.bitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.bitem;
    } else if (values.rgtimg == text.C) {
        text.C.hposition = 70%;
        values.citem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.citem;
    } else if (values.rgtimg == text.D) {
        text.D.hposition = 70%;
        values.ditem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.ditem;
    };
]
/ stimulusframes = [1=clearScreen, text.plus]
/ validresponse = ("a", "b")
</trial>

<trial minus>
/ ontrialbegin = [
    trial.minus.resetstimulusframes();
    list.image.reset();
    trial.minus.insertstimulusframe(list.image.nextvalue, 1);
    values.lftimg = list.image.currentvalue;
    trial.minus.insertstimulusframe(list.image.nextvalue, 1);
    values.rgtimg = list.image.currentvalue;
    
    if (values.lftimg == text.A) {
        text.A.hposition = 30%;
        values.aitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.aitem;
    } else if (values.lftimg == text.B) {
        text.B.hposition = 30%;
    values.bitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.bitem;
    } else if (values.lftimg == text.C) {
        text.C.hposition = 30%;
        values.citem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.citem;
    } else if (values.lftimg == text.D) {
        text.D.hposition = 30%;
        values.ditem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.ditem;
    };
        if (values.rgtimg == text.A) {
        text.A.hposition = 70%;
        values.aitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.aitem;
    } else if (values.rgtimg == text.B) {
        text.B.hposition = 70%;
        values.bitem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.bitem;
    } else if (values.rgtimg == text.C) {
        text.C.hposition = 70%;
        values.citem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.citem;
    } else if (values.rgtimg == text.D) {
        text.D.hposition = 70%;
        values.ditem = list.itemnumbers.nextindex;
        values.rgtitemnumber = values.ditem;
    };
]
/ stimulusframes = [1=clearScreen, text.minus]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-10=noreplace(plus,minus)]
/ recorddata = true
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency correct
    values.lftimg values.rgtimg values.lftitemnumber values.rgtitemnumber)
</data>

Thank you very much Dave for your kind assistance. I have adjusted the code and it's working fine for one of my experiment.

I have another experiment (same as previous one - four groups of images (e.g., A, B, C, D), each group has eight images) but I have to select some specific pair of images such as:

For "plus" trial, I want to display
- two pairs of even (or odd) numbered images (i.e., if left image "C2.jpg" then right image "D4.jpg" or any other even or odd numbered pairs)
- two pairs of distinct numbered (i.e., one odd one even) images (i.e., if left image "A2.jpg" then right image "B7.jpg" or any other combinations of distinct numbers)

Same for "minus" trial. These two trials are in randomized order (total eight trials would be fine). How would I set this experiment please?

Would appreciate your help - thanks.

Set up separate lists containing odd and even item nunbers, pull the item number for the right image (2nd member of the pair) from the applicable list.

Here's the whole thing for the four plus trials. Minus trials ought to be implemented in the same way.

<values>
/ lftimg = ""
/ rgtimg = ""
/ lftitemnumber = 0
/ rgtitemnumber = 0

/ aitem = 0
/ bitem = 0
/ citem = 0
/ ditem = 0

/ trialtype = ""
/ rightlist = 1

/ lfttype = ""
/ rgttype = ""
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.aitem
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.bitem
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.citem
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.ditem
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list image>
/ items = (text.A, text.B, text.C, text.D)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list hpos>
/ items = (30%, 70%)
/ selectionrate = always
</list>

<list itemnumbers>
/ poolsize = 8
/ selectionrate = always
</list>

<list odditemnumbers>
/ items = (1,3,5,7)
/ not = (values.lftitemnumber)
/ selectionrate = always
/ replace = true
</list>

<list evenitemnumbers>
/ items = (2,4,6,8)
/ not = (values.lftitemnumber)
/ selectionrate = always
/ replace = true
</list>

<list rightitemnumber>
/ items = (list.odditemnumbers.nextvalue, list.evenitemnumbers.nextvalue)
/ selectionmode = values.rightlist
</list>

<list plustype>
/ items = ("same", "same", "distinct", "distinct")
</list>

<trial plus>
/ ontrialbegin = [
    values.trialtype = list.plustype.nextvalue; // determine trial type
    trial.plus.resetstimulusframes();
    list.image.reset();
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.lftimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on left side
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.rgtimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on right side
    
    if (values.lftimg == text.A) {
        text.A.hposition = 30%;
        values.aitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.aitem;
    } else if (values.lftimg == text.B) {
        text.B.hposition = 30%;
    values.bitem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.bitem;
    } else if (values.lftimg == text.C) {
        text.C.hposition = 30%;
        values.citem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.citem;
    } else if (values.lftimg == text.D) {
        text.D.hposition = 30%;
        values.ditem = list.itemnumbers.nextindex;
        values.lftitemnumber = values.ditem;
    };
    
    if (mod(values.lftitemnumber, 2) == 1) { // left item is odd
        values.lfttype = "odd";
        if (values.trialtype == "same") { // if trial type is same
            values.rgttype = "odd";
            values.rightlist = 1; // we use odd item numbers for the right image
        } else { // otherwise
            values.rgttype = "even";
            values.rightlist = 2; // we use even item numbers for the right image
        }
    } else if (mod(values.lftitemnumber, 2) == 0) { // left item is even
        values.lfttype = "even";
        if (values.trialtype == "same") { // if trial type is same
            values.rgttype = "even";
            values.rightlist = 2; // we use even item numbers for the right image
        } else { // otherwise
            values.rgttype = "odd";
            values.rightlist = 1; // we use odd item numbers for the right image
        }
    };
        if (values.rgtimg == text.A) {
        text.A.hposition = 70%;
        values.aitem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.aitem;
    } else if (values.rgtimg == text.B) {
        text.B.hposition = 70%;
        values.bitem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.bitem;
    } else if (values.rgtimg == text.C) {
        text.C.hposition = 70%;
        values.citem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.citem;
    } else if (values.rgtimg == text.D) {
        text.D.hposition = 70%;
        values.ditem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.ditem;
    };
]
/ stimulusframes = [1=clearScreen, text.plus]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-4 = trial.plus]
/ recorddata = true
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency correct
    values.lftimg values.rgtimg values.lftitemnumber values.rgtitemnumber values.trialtype values.lfttype values.rgttype)
</data>


Or you can do

<values>
/ lftimg = ""
/ rgtimg = ""
/ lftitemnumber = 0
/ rgtitemnumber = 0

/ aitem = 0
/ bitem = 0
/ citem = 0
/ ditem = 0

/ trialtype = ""
/ rightlist = 1
/ leftlist = 1
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.aitem
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.bitem
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.citem
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.ditem
</text>

<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list image>
/ items = (text.A, text.B, text.C, text.D)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list hpos>
/ items = (30%, 70%)
/ selectionrate = always
</list>

<list odditemnumbers>
/ items = (1,3,5,7)
/ selectionrate = always
</list>

<list evenitemnumbers>
/ items = (2,4,6,8)
/ selectionrate = always
</list>

<list leftitemnumber>
/ items = (list.odditemnumbers.nextvalue, list.evenitemnumbers.nextvalue)
/ selectionmode = values.leftlist
</list>

<list rightitemnumber>
/ items = (list.odditemnumbers.nextvalue, list.evenitemnumbers.nextvalue)
/ selectionmode = values.rightlist
</list>

<list plustype>
/ items = ("odd/odd", "even/even", "odd/even", "even/odd")
</list>

<list plus_lft>
/ items = (1, 2, 1, 2)
/ selectionmode = list.plustype.currentindex
</list>

<list plus_rgt>
/ items = (1, 2, 2, 1)
/ selectionmode = list.plustype.currentindex
</list>



<trial plus>
/ ontrialbegin = [
    values.trialtype = list.plustype.nextvalue; // determine trial type
    values.leftlist = list.plus_lft.nextvalue;
    values.rightlist = list.plus_rgt.nextvalue;
    trial.plus.resetstimulusframes();
    list.image.reset();
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.lftimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on left side
    trial.plus.insertstimulusframe(list.image.nextvalue, 1);
    values.rgtimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on right side
    
    if (values.lftimg == text.A) {
        text.A.hposition = 30%;
        values.aitem = list.leftitemnumber.nextvalue;
        values.lftitemnumber = values.aitem;
    } else if (values.lftimg == text.B) {
        text.B.hposition = 30%;
        values.bitem = list.leftitemnumber.nextvalue;
        values.lftitemnumber = values.bitem;
    } else if (values.lftimg == text.C) {
        text.C.hposition = 30%;
        values.citem = list.leftitemnumber.nextvalue;
        values.lftitemnumber = values.citem;
    } else if (values.lftimg == text.D) {
        text.D.hposition = 30%;
        values.ditem = list.leftitemnumber.nextvalue;
        values.lftitemnumber = values.ditem;
    };
        if (values.rgtimg == text.A) {
        text.A.hposition = 70%;
        values.aitem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.aitem;
    } else if (values.rgtimg == text.B) {
        text.B.hposition = 70%;
        values.bitem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.bitem;
    } else if (values.rgtimg == text.C) {
        text.C.hposition = 70%;
        values.citem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.citem;
    } else if (values.rgtimg == text.D) {
        text.D.hposition = 70%;
        values.ditem = list.rightitemnumber.nextvalue;
        values.rgtitemnumber = values.ditem;
    };
]
/ stimulusframes = [1=clearScreen, text.plus]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-4 = trial.plus]
/ recorddata = true
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency correct
    values.lftimg values.rgtimg values.lftitemnumber values.rgtitemnumber values.trialtype values.leftlist values.rightlist)
</data>


if you want one instance of each specific combination (odd/odd, even/even, odd/even, even/odd). These are all just variations on the same theme. If you understand how one works, you can implement any other.

Thank you Dave for your excellent help and that worked.

Now I have another question - apologies for so many...

I want to extend this to eight groups of images (e.g., A, B, C, D, E, F, G, H) where each group has eight images with a twist that now odd group consists of: text.A, text.C, text.E, text.G
and even group: text.B, text.D, text.F, text.H.

Is there a way we can select right image (values.rgtimg) based on whether left (values.lftimg) is from odd or even groups (considering text.A, text.C, text.E, text.G are in odd group and text.B, text.D, text.F, text.H are in even group) and then we target an item within that group.

Since there are 8 groups of images with 8 images in each group, so we can have 64 trials [i.e., (left, right) images pair as (1,1), (1,2), ..., (8,8) in randomised order]. Discarding the same pairs [such as (1,1), (2,2)..., (8,8)] we will have only 56 pairs.

If we have a 32 "plus" trials, I would like to have 16 "distinct", and 16 "same" (with 8 "odd" and 8 "even") trials.

How do I modify this script please?

Would appreciate your help.

Thanks.

Here is the code (just put all stimulus):

<values>
/ lftimg = ""
/ rgtimg = ""
/ lftitemnumber = 0
/ rgtitemnumber = 0

/ aitem = 0
/ bitem = 0
/ citem = 0
/ ditem = 0
/ eitem = 0
/ fitem = 0
/ gitem = 0
/ hitem = 0

/ trialtype = ""
/ rightlist = 1

/ lfttype = ""
/ rgttype = ""
</values>

<text A>
/items = ("A1.jpg","A2.jpg","A3.jpg","A4.jpg","A5.jpg","A6.jpg","A7.jpg","A8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.aitem
</text>

<text B>
/items = ("B1.jpg","B2.jpg","B3.jpg","B4.jpg","B5.jpg","B6.jpg","B7.jpg","B8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.bitem
</text>

<text C>
/items = ("C1.jpg","C2.jpg","C3.jpg","C4.jpg","C5.jpg","C6.jpg","C7.jpg","C8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.citem
</text>

<text D>
/items = ("D1.jpg","D2.jpg","D3.jpg","D4.jpg","D5.jpg","D6.jpg","D7.jpg","D8.jpg")
/size = (20%,20%)
/fontstyle = ("Arial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.ditem
</text>

<text E>
/items = ("E1.jpg","E2.jpg","E3.jpg","E4.jpg","E5.jpg","E6.jpg","E7.jpg","E8.jpg")
/size = (20%,20%)
/fontstyle = ("Erial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.eitem
</text>

<text F>
/items = ("F1.jpg","F2.jpg","F3.jpg","F4.jpg","F5.jpg","F6.jpg","F7.jpg","F8.jpg")
/size = (20%,20%)
/fontstyle = ("Frial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.fitem
</text>

<text G>
/items = ("G1.jpg","G2.jpg","G3.jpg","G4.jpg","G5.jpg","G6.jpg","G7.jpg","G8.jpg")
/size = (20%,20%)
/fontstyle = ("Grial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.gitem
</text>

<text H>
/items = ("H1.jpg","H2.jpg","H3.jpg","H4.jpg","H5.jpg","H6.jpg","H7.jpg","H8.jpg")
/size = (20%,20%)
/fontstyle = ("Hrial", 50pt, true)
/ vposition = 50%
/ hposition = 0%
/ select = values.hitem
</text>


<text plus>
/ items = ("Positive")
/ size = (20%, 20%)
/ position = (50%, 50%)
/ fontstyle = ("Arial", 30pt, true)
</text>

<list image>
/ items = (text.A, text.B, text.C, text.D, text.E, text.F, text.G, text.H)
/ selectionmode = random
/ replace = false
/ selectionrate = always
</list>

<list hpos>
/ items = (30%, 70%)
/ selectionrate = always
</list>

<list itemnumbers>
/ poolsize = 8
/ selectionrate = always
</list>

<list odditemnumbers>
/ items = (1,3,5,7)
/ not = (values.lftitemnumber)
/ selectionrate = always
/ replace = true
</list>

<list evenitemnumbers>
/ items = (2,4,6,8)
/ not = (values.lftitemnumber)
/ selectionrate = always
/ replace = true
</list>

<list rightitemnumber>
/ items = (list.odditemnumbers.nextvalue, list.evenitemnumbers.nextvalue)
/ selectionmode = values.rightlist
</list>

<list plustype>
/ items = ("same", "same", "distinct", "distinct")
</list>

<trial plus>
/ ontrialbegin = [
  values.trialtype = list.plustype.nextvalue; // determine trial type
  trial.plus.resetstimulusframes();
  list.image.reset();
  trial.plus.insertstimulusframe(list.image.nextvalue, 1);
  values.lftimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on left side
  trial.plus.insertstimulusframe(list.image.nextvalue, 1);
  values.rgtimg = list.image.currentvalue; // image type -- A, B, C, or D -- displayed on right side
 
  if (values.lftimg == text.A) {
   text.A.hposition = 30%;
   values.aitem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.aitem;

  } else if (values.lftimg == text.B) {
   text.B.hposition = 30%;
  values.bitem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.bitem;

  } else if (values.lftimg == text.C) {
   text.C.hposition = 30%;
   values.citem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.citem;

  } else if (values.lftimg == text.D) {
   text.D.hposition = 30%;
   values.ditem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.ditem;

  } else if (values.lftimg == text.E) {
   text.E.hposition = 30%;
   values.eitem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.eitem;

  } else if (values.lftimg == text.F) {
   text.F.hposition = 30%;
   values.fitem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.fitem;

  } else if (values.lftimg == text.G) {
   text.E.hposition = 30%;
   values.gitem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.gitem;

  } else if (values.lftimg == text.H) {
   text.F.hposition = 30%;
   values.hitem = list.itemnumbers.nextindex;
   values.lftitemnumber = values.hitem;
  };
 
  if (mod(values.lftitemnumber, 2) == 1) { // left item is odd
   values.lfttype = "odd";
   if (values.trialtype == "same") { // if trial type is same
    values.rgttype = "odd";
    values.rightlist = 1; // we use odd item numbers for the right image
   } else { // otherwise
    values.rgttype = "even";
    values.rightlist = 2; // we use even item numbers for the right image
   }
  } else if (mod(values.lftitemnumber, 2) == 0) { // left item is even
   values.lfttype = "even";
   if (values.trialtype == "same") { // if trial type is same
    values.rgttype = "even";
    values.rightlist = 2; // we use even item numbers for the right image
   } else { // otherwise
    values.rgttype = "odd";
    values.rightlist = 1; // we use odd item numbers for the right image
   }
  };
   if (values.rgtimg == text.A) {
   text.A.hposition = 70%;
   values.aitem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.aitem;

  } else if (values.rgtimg == text.B) {
   text.B.hposition = 70%;
   values.bitem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.bitem;

  } else if (values.rgtimg == text.C) {
   text.C.hposition = 70%;
   values.citem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.citem;

  } else if (values.rgtimg == text.D) {
   text.D.hposition = 70%;
   values.ditem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.ditem;

  } else if (values.rgtimg == text.E) {
   text.C.hposition = 70%;
   values.eitem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.eitem;

  } else if (values.rgtimg == text.F) {
   text.D.hposition = 70%;
   values.fitem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.fitem;

  } else if (values.rgtimg == text.G) {
   text.C.hposition = 70%;
   values.gitem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.gitem;

  } else if (values.rgtimg == text.H) {
   text.D.hposition = 70%;
   values.hitem = list.rightitemnumber.nextvalue;
   values.rgtitemnumber = values.hitem;
  };
]
/ stimulusframes = [1=clearScreen, text.plus]
/ validresponse = ("a", "b")
</trial>

<block tryblock>
/ trials = [1-64 = trial.plus]
/ recorddata = true
</block>

<data>
/ columns = (date time subject group session blocknum blockcode trialnum trialcode response latency correct
  values.lftimg values.rgtimg values.lftitemnumber values.rgtitemnumber values.trialtype values.lfttype values.rgttype)
</data>

> Is there a way we can select right image (values.rgtimg) based on whether left (values.lftimg) is from odd or even groups
> (considering text.A, text.C, text.E, text.G are in odd group and text.B, text.D, text.F, text.H are in even group) and then we target an item within that group.

The answer is the same as in my previous response. Whether it's different images (an "odd" group and an "even" group) or odd vs even item number doesn't make a real difference. So please go back and work through the code I already gave you until you fully understand it, then modify if accordignly.

> Since there are 8 groups of images with 8 images in each group, so we can have 64 trials [i.e., (left, right) images pair as (1,1), (1,2), ..., (8,8) in randomised order].
> Discarding the same pairs [such as (1,1), (2,2)..., (8,8)] we will have only 56 pairs.

Use parired lists to define the pairs, sample from those pairs. This, too, is no different from what's already been discussed.

Thank you Dave. I have resolved the issue.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search