Millisecond Forums

Displaying pics using conditional

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

By anabela_c - 7/14/2021

Hi (Dave?) :)

I need to display a picture based on a previous selected response (radiobuttons) but I am not sure on how to implement a conditional within the picture (if is possible). I am trying as follows (with the surveypage option, perhaps is better to use the ‘optionvalues' but I don’t know how):


<picture OfferPic>
/ items = [
    if (radiobuttons.CoalitionPartner.response == "YOU - <%item.avatarallo.item(text.avatarallo_match.currentindex)%> coalition"){picture.OfferBoxPartner.items =
        "200.bmp"                                    
    } else {picture.OfferBoxPartner.items =
        "160.bmp"
    };
]
/ position = (30%,50%)
/ size = (60%,60%)
</picture>


<surveypage CoalitionOffer>
/ questions = [1=OfferBox1, OfferBox2]
/ stimulusframes = [1 = clearscreen, OfferPic]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
</surveypage>

<surveypage CoalitionPartner>
/ questions = [1=CoalitionPartner]
/ stimulusframes = [1 = CoalitionPartnerText,CoalitionPartnerEgo, CoalitionPartnerAllo]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
/ nextbuttonposition = (42,90)
</surveypage>

<radiobuttons CoalitionPartner>
/ options = ("YOU - <%item.avatarallo.item(text.avatarallo_match.currentindex)%> coalition","YOU - <%item.avatarego.item(text.avatarego_match.currentindex)%> coalition")
/ responsefontstyle = ("Arial", 3%, true)
/ optionvalues = ("allo", "ego")
/ orientation = horizontal
/ size = (25, 10)
/ position = (25%, 70%)
</radiobuttons>

<textbox OfferBox1>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 52%)
/ required = true
</textbox>

<textbox OfferBox2>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 62%)
/ required = true
</textbox>

<text CoalitionPartnerText>
/ items = ("Please indicate which coalition you want to form:")
/ fontstyle = ("Arial", 3%, true)
/ position = (49%,10%)
</text>

<text CoalitionPartnerEgo>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarego_match)
/ position = (75, 30)
</text>

<text CoalitionPartnerAllo>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarallo_match)
/ position = (23, 30)
</text>

<item avatarego>
/1="DUNLOP"
/2="BENSON"
</item>

<item avatarallo>
/1="BENSON"
/2="DUNLOP"
</item>

<text avatarego_match>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ position = (29, 30)
</text>

<text avatarallo_match>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ position = (71, 30)
</text>

<block Trial1>
/ trials = [
    1= CoalitionPartner;
    2= CoalitionOffer;
</block>

I tried to edit the script to make it shorter, let me know if you need other parts!

Thanks in advance!
Anabela
By Dave - 7/14/2021

anabela_c - 7/14/2021
Hi (Dave?) :)

I need to display a picture based on a previous selected response (radiobuttons) but I am not sure on how to implement a conditional within the picture (if is possible). I am trying as follows (with the surveypage option, perhaps is better to use the ‘optionvalues' but I don’t know how):


<picture OfferPic>
/ items = [
    if (radiobuttons.CoalitionPartner.response == "YOU - <%item.avatarallo.item(text.avatarallo_match.currentindex)%> coalition"){picture.OfferBoxPartner.items =
        "200.bmp"                                    
    } else {picture.OfferBoxPartner.items =
        "160.bmp"
    };
]
/ position = (30%,50%)
/ size = (60%,60%)
</picture>


<surveypage CoalitionOffer>
/ questions = [1=OfferBox1, OfferBox2]
/ stimulusframes = [1 = clearscreen, OfferPic]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
</surveypage>

<surveypage CoalitionPartner>
/ questions = [1=CoalitionPartner]
/ stimulusframes = [1 = CoalitionPartnerText,CoalitionPartnerEgo, CoalitionPartnerAllo]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
/ nextbuttonposition = (42,90)
</surveypage>

<radiobuttons CoalitionPartner>
/ options = ("YOU - <%item.avatarallo.item(text.avatarallo_match.currentindex)%> coalition","YOU - <%item.avatarego.item(text.avatarego_match.currentindex)%> coalition")
/ responsefontstyle = ("Arial", 3%, true)
/ optionvalues = ("allo", "ego")
/ orientation = horizontal
/ size = (25, 10)
/ position = (25%, 70%)
</radiobuttons>

<textbox OfferBox1>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 52%)
/ required = true
</textbox>

<textbox OfferBox2>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 62%)
/ required = true
</textbox>

<text CoalitionPartnerText>
/ items = ("Please indicate which coalition you want to form:")
/ fontstyle = ("Arial", 3%, true)
/ position = (49%,10%)
</text>

<text CoalitionPartnerEgo>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarego_match)
/ position = (75, 30)
</text>

<text CoalitionPartnerAllo>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarallo_match)
/ position = (23, 30)
</text>

<item avatarego>
/1="DUNLOP"
/2="BENSON"
</item>

<item avatarallo>
/1="BENSON"
/2="DUNLOP"
</item>

<text avatarego_match>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ position = (29, 30)
</text>

<text avatarallo_match>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ position = (71, 30)
</text>

<block Trial1>
/ trials = [
    1= CoalitionPartner;
    2= CoalitionOffer;
</block>

I tried to edit the script to make it shorter, let me know if you need other parts!

Thanks in advance!
Anabela

You simply do:

<picture OfferPic>
/ items = ("200.bmp", "160.bmp")
/ position = (30%,50%)
/ size = (60%,60%)
/ select = values.selectedoffer
</picture>

<values>
/ selectedoffer = 2
</values>

<surveypage CoalitionOffer>
/ questions = [1=OfferBox1, OfferBox2]
/ stimulusframes = [1 = clearscreen, OfferPic]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
</surveypage>

<surveypage CoalitionPartner>
/ ontrialend = [
    if (radiobuttons.CoalitionPartner.response == "allo"){
        values.selectedoffer = 1;
    } else {
        values.selectedoffer = 2;
    };
]
/ questions = [1=CoalitionPartner]
/ stimulusframes = [1 = CoalitionPartnerText,CoalitionPartnerEgo, CoalitionPartnerAllo]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
/ nextbuttonposition = (42,90)
</surveypage>

<radiobuttons CoalitionPartner>
/ options = ("YOU - <%item.avatarallo.item(text.avatarallo_match.currentindex)%> coalition","YOU - <%item.avatarego.item(text.avatarego_match.currentindex)%> coalition")
/ responsefontstyle = ("Arial", 3%, true)
/ optionvalues = ("allo", "ego")
/ orientation = horizontal
/ size = (25, 10)
/ position = (25%, 70%)
</radiobuttons>

<textbox OfferBox1>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 52%)
/ required = true
</textbox>

<textbox OfferBox2>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 62%)
/ required = true
</textbox>

<text CoalitionPartnerText>
/ items = ("Please indicate which coalition you want to form:")
/ fontstyle = ("Arial", 3%, true)
/ position = (49%,10%)
</text>

<text CoalitionPartnerEgo>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarego_match)
/ position = (75, 30)
</text>

<text CoalitionPartnerAllo>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarallo_match)
/ position = (23, 30)
</text>

<item avatarego>
/1="DUNLOP"
/2="BENSON"
</item>

<item avatarallo>
/1="BENSON"
/2="DUNLOP"
</item>

<text avatarego_match>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ position = (29, 30)
</text>

<text avatarallo_match>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ position = (71, 30)
</text>

<block Trial1>
/ trials = [
1= CoalitionPartner;
2= CoalitionOffer;]
</block>

By anabela_c - 7/14/2021

Dave - 7/14/2021
anabela_c - 7/14/2021
Hi (Dave?) :)

I need to display a picture based on a previous selected response (radiobuttons) but I am not sure on how to implement a conditional within the picture (if is possible). I am trying as follows (with the surveypage option, perhaps is better to use the ‘optionvalues' but I don’t know how):


<picture OfferPic>
/ items = [
    if (radiobuttons.CoalitionPartner.response == "YOU - <%item.avatarallo.item(text.avatarallo_match.currentindex)%> coalition"){picture.OfferBoxPartner.items =
        "200.bmp"                                    
    } else {picture.OfferBoxPartner.items =
        "160.bmp"
    };
]
/ position = (30%,50%)
/ size = (60%,60%)
</picture>


<surveypage CoalitionOffer>
/ questions = [1=OfferBox1, OfferBox2]
/ stimulusframes = [1 = clearscreen, OfferPic]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
</surveypage>

<surveypage CoalitionPartner>
/ questions = [1=CoalitionPartner]
/ stimulusframes = [1 = CoalitionPartnerText,CoalitionPartnerEgo, CoalitionPartnerAllo]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
/ nextbuttonposition = (42,90)
</surveypage>

<radiobuttons CoalitionPartner>
/ options = ("YOU - <%item.avatarallo.item(text.avatarallo_match.currentindex)%> coalition","YOU - <%item.avatarego.item(text.avatarego_match.currentindex)%> coalition")
/ responsefontstyle = ("Arial", 3%, true)
/ optionvalues = ("allo", "ego")
/ orientation = horizontal
/ size = (25, 10)
/ position = (25%, 70%)
</radiobuttons>

<textbox OfferBox1>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 52%)
/ required = true
</textbox>

<textbox OfferBox2>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 62%)
/ required = true
</textbox>

<text CoalitionPartnerText>
/ items = ("Please indicate which coalition you want to form:")
/ fontstyle = ("Arial", 3%, true)
/ position = (49%,10%)
</text>

<text CoalitionPartnerEgo>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarego_match)
/ position = (75, 30)
</text>

<text CoalitionPartnerAllo>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarallo_match)
/ position = (23, 30)
</text>

<item avatarego>
/1="DUNLOP"
/2="BENSON"
</item>

<item avatarallo>
/1="BENSON"
/2="DUNLOP"
</item>

<text avatarego_match>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ position = (29, 30)
</text>

<text avatarallo_match>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ position = (71, 30)
</text>

<block Trial1>
/ trials = [
    1= CoalitionPartner;
    2= CoalitionOffer;
</block>

I tried to edit the script to make it shorter, let me know if you need other parts!

Thanks in advance!
Anabela

You simply do:

<picture OfferPic>
/ items = ("200.bmp", "160.bmp")
/ position = (30%,50%)
/ size = (60%,60%)
/ select = values.selectedoffer
</picture>

<values>
/ selectedoffer = 2
</values>

<surveypage CoalitionOffer>
/ questions = [1=OfferBox1, OfferBox2]
/ stimulusframes = [1 = clearscreen, OfferPic]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
</surveypage>

<surveypage CoalitionPartner>
/ ontrialend = [
    if (radiobuttons.CoalitionPartner.response == "allo"){
        values.selectedoffer = 1;
    } else {
        values.selectedoffer = 2;
    };
]
/ questions = [1=CoalitionPartner]
/ stimulusframes = [1 = CoalitionPartnerText,CoalitionPartnerEgo, CoalitionPartnerAllo]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
/ nextbuttonposition = (42,90)
</surveypage>

<radiobuttons CoalitionPartner>
/ options = ("YOU - <%item.avatarallo.item(text.avatarallo_match.currentindex)%> coalition","YOU - <%item.avatarego.item(text.avatarego_match.currentindex)%> coalition")
/ responsefontstyle = ("Arial", 3%, true)
/ optionvalues = ("allo", "ego")
/ orientation = horizontal
/ size = (25, 10)
/ position = (25%, 70%)
</radiobuttons>

<textbox OfferBox1>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 52%)
/ required = true
</textbox>

<textbox OfferBox2>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 62%)
/ required = true
</textbox>

<text CoalitionPartnerText>
/ items = ("Please indicate which coalition you want to form:")
/ fontstyle = ("Arial", 3%, true)
/ position = (49%,10%)
</text>

<text CoalitionPartnerEgo>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarego_match)
/ position = (75, 30)
</text>

<text CoalitionPartnerAllo>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarallo_match)
/ position = (23, 30)
</text>

<item avatarego>
/1="DUNLOP"
/2="BENSON"
</item>

<item avatarallo>
/1="BENSON"
/2="DUNLOP"
</item>

<text avatarego_match>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ position = (29, 30)
</text>

<text avatarallo_match>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ position = (71, 30)
</text>

<block Trial1>
/ trials = [
1= CoalitionPartner;
2= CoalitionOffer;]
</block>


Thank you so much for you help as always, however it only displays one picture (200.bmp), should I need to add another item in "values" for 1? So far I only changed/added this (maybe I miss some line):  

<surveypage CoalitionPartner>
/ ontrialbegin = [
        if (radiobuttons.CoalitionPartner.response == "allo") {
        values.selectedoffer = 1;
    } else {
        values.selectedoffer = 2;
    };
]
/ questions = [1=CoalitionPartner]
/ stimulusframes = [1 = CoalitionPartnerText,CoalitionPartnerEgo, CoalitionPartnerAllo]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
/ nextbuttonposition = (42,90)
</surveypage>

---
<values>
/ selectedoffer = 2
</values>

---
<picture OfferPic>
/ items = ("200.bmp","160.bmp")
/ position = (30%,50%)
/ size = (60%,60%)
/ select = values.selectedoffer
</picture>
By Dave - 7/14/2021

anabela_c - 7/14/2021
Dave - 7/14/2021
anabela_c - 7/14/2021
Hi (Dave?) :)

I need to display a picture based on a previous selected response (radiobuttons) but I am not sure on how to implement a conditional within the picture (if is possible). I am trying as follows (with the surveypage option, perhaps is better to use the ‘optionvalues' but I don’t know how):


<picture OfferPic>
/ items = [
    if (radiobuttons.CoalitionPartner.response == "YOU - <%item.avatarallo.item(text.avatarallo_match.currentindex)%> coalition"){picture.OfferBoxPartner.items =
        "200.bmp"                                    
    } else {picture.OfferBoxPartner.items =
        "160.bmp"
    };
]
/ position = (30%,50%)
/ size = (60%,60%)
</picture>


<surveypage CoalitionOffer>
/ questions = [1=OfferBox1, OfferBox2]
/ stimulusframes = [1 = clearscreen, OfferPic]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
</surveypage>

<surveypage CoalitionPartner>
/ questions = [1=CoalitionPartner]
/ stimulusframes = [1 = CoalitionPartnerText,CoalitionPartnerEgo, CoalitionPartnerAllo]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
/ nextbuttonposition = (42,90)
</surveypage>

<radiobuttons CoalitionPartner>
/ options = ("YOU - <%item.avatarallo.item(text.avatarallo_match.currentindex)%> coalition","YOU - <%item.avatarego.item(text.avatarego_match.currentindex)%> coalition")
/ responsefontstyle = ("Arial", 3%, true)
/ optionvalues = ("allo", "ego")
/ orientation = horizontal
/ size = (25, 10)
/ position = (25%, 70%)
</radiobuttons>

<textbox OfferBox1>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 52%)
/ required = true
</textbox>

<textbox OfferBox2>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 62%)
/ required = true
</textbox>

<text CoalitionPartnerText>
/ items = ("Please indicate which coalition you want to form:")
/ fontstyle = ("Arial", 3%, true)
/ position = (49%,10%)
</text>

<text CoalitionPartnerEgo>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarego_match)
/ position = (75, 30)
</text>

<text CoalitionPartnerAllo>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarallo_match)
/ position = (23, 30)
</text>

<item avatarego>
/1="DUNLOP"
/2="BENSON"
</item>

<item avatarallo>
/1="BENSON"
/2="DUNLOP"
</item>

<text avatarego_match>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ position = (29, 30)
</text>

<text avatarallo_match>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ position = (71, 30)
</text>

<block Trial1>
/ trials = [
    1= CoalitionPartner;
    2= CoalitionOffer;
</block>

I tried to edit the script to make it shorter, let me know if you need other parts!

Thanks in advance!
Anabela

You simply do:

<picture OfferPic>
/ items = ("200.bmp", "160.bmp")
/ position = (30%,50%)
/ size = (60%,60%)
/ select = values.selectedoffer
</picture>

<values>
/ selectedoffer = 2
</values>

<surveypage CoalitionOffer>
/ questions = [1=OfferBox1, OfferBox2]
/ stimulusframes = [1 = clearscreen, OfferPic]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
</surveypage>

<surveypage CoalitionPartner>
/ ontrialend = [
    if (radiobuttons.CoalitionPartner.response == "allo"){
        values.selectedoffer = 1;
    } else {
        values.selectedoffer = 2;
    };
]
/ questions = [1=CoalitionPartner]
/ stimulusframes = [1 = CoalitionPartnerText,CoalitionPartnerEgo, CoalitionPartnerAllo]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
/ nextbuttonposition = (42,90)
</surveypage>

<radiobuttons CoalitionPartner>
/ options = ("YOU - <%item.avatarallo.item(text.avatarallo_match.currentindex)%> coalition","YOU - <%item.avatarego.item(text.avatarego_match.currentindex)%> coalition")
/ responsefontstyle = ("Arial", 3%, true)
/ optionvalues = ("allo", "ego")
/ orientation = horizontal
/ size = (25, 10)
/ position = (25%, 70%)
</radiobuttons>

<textbox OfferBox1>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 52%)
/ required = true
</textbox>

<textbox OfferBox2>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 62%)
/ required = true
</textbox>

<text CoalitionPartnerText>
/ items = ("Please indicate which coalition you want to form:")
/ fontstyle = ("Arial", 3%, true)
/ position = (49%,10%)
</text>

<text CoalitionPartnerEgo>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarego_match)
/ position = (75, 30)
</text>

<text CoalitionPartnerAllo>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarallo_match)
/ position = (23, 30)
</text>

<item avatarego>
/1="DUNLOP"
/2="BENSON"
</item>

<item avatarallo>
/1="BENSON"
/2="DUNLOP"
</item>

<text avatarego_match>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ position = (29, 30)
</text>

<text avatarallo_match>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ position = (71, 30)
</text>

<block Trial1>
/ trials = [
1= CoalitionPartner;
2= CoalitionOffer;]
</block>


Thank you so much for you help as always, however it only displays one picture (200.bmp), should I need to add another item in "values" for 1? So far I only changed/added this (maybe I miss some line):  

<surveypage CoalitionPartner>
/ ontrialbegin = [
        if (radiobuttons.CoalitionPartner.response == "allo") {
        values.selectedoffer = 1;
    } else {
        values.selectedoffer = 2;
    };
]
/ questions = [1=CoalitionPartner]
/ stimulusframes = [1 = CoalitionPartnerText,CoalitionPartnerEgo, CoalitionPartnerAllo]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
/ nextbuttonposition = (42,90)
</surveypage>

---
<values>
/ selectedoffer = 2
</values>

---
<picture OfferPic>
/ items = ("200.bmp","160.bmp")
/ position = (30%,50%)
/ size = (60%,60%)
/ select = values.selectedoffer
</picture>

The logic in the surveypage ought to be executed /ontrialend, not /ontrialbegin.

Refer back to the example code in my previous response, which does this correctly.
By anabela_c - 7/14/2021

Dave - 7/14/2021
anabela_c - 7/14/2021
Dave - 7/14/2021
anabela_c - 7/14/2021
Hi (Dave?) :)

I need to display a picture based on a previous selected response (radiobuttons) but I am not sure on how to implement a conditional within the picture (if is possible). I am trying as follows (with the surveypage option, perhaps is better to use the ‘optionvalues' but I don’t know how):


<picture OfferPic>
/ items = [
    if (radiobuttons.CoalitionPartner.response == "YOU - <%item.avatarallo.item(text.avatarallo_match.currentindex)%> coalition"){picture.OfferBoxPartner.items =
        "200.bmp"                                    
    } else {picture.OfferBoxPartner.items =
        "160.bmp"
    };
]
/ position = (30%,50%)
/ size = (60%,60%)
</picture>


<surveypage CoalitionOffer>
/ questions = [1=OfferBox1, OfferBox2]
/ stimulusframes = [1 = clearscreen, OfferPic]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
</surveypage>

<surveypage CoalitionPartner>
/ questions = [1=CoalitionPartner]
/ stimulusframes = [1 = CoalitionPartnerText,CoalitionPartnerEgo, CoalitionPartnerAllo]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
/ nextbuttonposition = (42,90)
</surveypage>

<radiobuttons CoalitionPartner>
/ options = ("YOU - <%item.avatarallo.item(text.avatarallo_match.currentindex)%> coalition","YOU - <%item.avatarego.item(text.avatarego_match.currentindex)%> coalition")
/ responsefontstyle = ("Arial", 3%, true)
/ optionvalues = ("allo", "ego")
/ orientation = horizontal
/ size = (25, 10)
/ position = (25%, 70%)
</radiobuttons>

<textbox OfferBox1>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 52%)
/ required = true
</textbox>

<textbox OfferBox2>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 62%)
/ required = true
</textbox>

<text CoalitionPartnerText>
/ items = ("Please indicate which coalition you want to form:")
/ fontstyle = ("Arial", 3%, true)
/ position = (49%,10%)
</text>

<text CoalitionPartnerEgo>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarego_match)
/ position = (75, 30)
</text>

<text CoalitionPartnerAllo>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarallo_match)
/ position = (23, 30)
</text>

<item avatarego>
/1="DUNLOP"
/2="BENSON"
</item>

<item avatarallo>
/1="BENSON"
/2="DUNLOP"
</item>

<text avatarego_match>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ position = (29, 30)
</text>

<text avatarallo_match>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ position = (71, 30)
</text>

<block Trial1>
/ trials = [
    1= CoalitionPartner;
    2= CoalitionOffer;
</block>

I tried to edit the script to make it shorter, let me know if you need other parts!

Thanks in advance!
Anabela

You simply do:

<picture OfferPic>
/ items = ("200.bmp", "160.bmp")
/ position = (30%,50%)
/ size = (60%,60%)
/ select = values.selectedoffer
</picture>

<values>
/ selectedoffer = 2
</values>

<surveypage CoalitionOffer>
/ questions = [1=OfferBox1, OfferBox2]
/ stimulusframes = [1 = clearscreen, OfferPic]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
</surveypage>

<surveypage CoalitionPartner>
/ ontrialend = [
    if (radiobuttons.CoalitionPartner.response == "allo"){
        values.selectedoffer = 1;
    } else {
        values.selectedoffer = 2;
    };
]
/ questions = [1=CoalitionPartner]
/ stimulusframes = [1 = CoalitionPartnerText,CoalitionPartnerEgo, CoalitionPartnerAllo]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
/ nextbuttonposition = (42,90)
</surveypage>

<radiobuttons CoalitionPartner>
/ options = ("YOU - <%item.avatarallo.item(text.avatarallo_match.currentindex)%> coalition","YOU - <%item.avatarego.item(text.avatarego_match.currentindex)%> coalition")
/ responsefontstyle = ("Arial", 3%, true)
/ optionvalues = ("allo", "ego")
/ orientation = horizontal
/ size = (25, 10)
/ position = (25%, 70%)
</radiobuttons>

<textbox OfferBox1>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 52%)
/ required = true
</textbox>

<textbox OfferBox2>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 62%)
/ required = true
</textbox>

<text CoalitionPartnerText>
/ items = ("Please indicate which coalition you want to form:")
/ fontstyle = ("Arial", 3%, true)
/ position = (49%,10%)
</text>

<text CoalitionPartnerEgo>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarego_match)
/ position = (75, 30)
</text>

<text CoalitionPartnerAllo>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarallo_match)
/ position = (23, 30)
</text>

<item avatarego>
/1="DUNLOP"
/2="BENSON"
</item>

<item avatarallo>
/1="BENSON"
/2="DUNLOP"
</item>

<text avatarego_match>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ position = (29, 30)
</text>

<text avatarallo_match>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ position = (71, 30)
</text>

<block Trial1>
/ trials = [
1= CoalitionPartner;
2= CoalitionOffer;]
</block>


Thank you so much for you help as always, however it only displays one picture (200.bmp), should I need to add another item in "values" for 1? So far I only changed/added this (maybe I miss some line):  

<surveypage CoalitionPartner>
/ ontrialbegin = [
        if (radiobuttons.CoalitionPartner.response == "allo") {
        values.selectedoffer = 1;
    } else {
        values.selectedoffer = 2;
    };
]
/ questions = [1=CoalitionPartner]
/ stimulusframes = [1 = CoalitionPartnerText,CoalitionPartnerEgo, CoalitionPartnerAllo]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
/ nextbuttonposition = (42,90)
</surveypage>

---
<values>
/ selectedoffer = 2
</values>

---
<picture OfferPic>
/ items = ("200.bmp","160.bmp")
/ position = (30%,50%)
/ size = (60%,60%)
/ select = values.selectedoffer
</picture>

The logic in the surveypage ought to be executed /ontrialend, not /ontrialbegin.

Refer back to the example code in my previous response, which does this correctly.

Oh my apologies! thanks a lot!
By anabela_c - 11/1/2022

Dave - 7/14/2021
anabela_c - 7/14/2021
Hi (Dave?) :)

I need to display a picture based on a previous selected response (radiobuttons) but I am not sure on how to implement a conditional within the picture (if is possible). I am trying as follows (with the surveypage option, perhaps is better to use the ‘optionvalues' but I don’t know how):


<picture OfferPic>
/ items = [
    if (radiobuttons.CoalitionPartner.response == "YOU - <%item.avatarallo.item(text.avatarallo_match.currentindex)%> coalition"){picture.OfferBoxPartner.items =
        "200.bmp"                                    
    } else {picture.OfferBoxPartner.items =
        "160.bmp"
    };
]
/ position = (30%,50%)
/ size = (60%,60%)
</picture>


<surveypage CoalitionOffer>
/ questions = [1=OfferBox1, OfferBox2]
/ stimulusframes = [1 = clearscreen, OfferPic]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
</surveypage>

<surveypage CoalitionPartner>
/ questions = [1=CoalitionPartner]
/ stimulusframes = [1 = CoalitionPartnerText,CoalitionPartnerEgo, CoalitionPartnerAllo]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
/ nextbuttonposition = (42,90)
</surveypage>

<radiobuttons CoalitionPartner>
/ options = ("YOU - <%item.avatarallo.item(text.avatarallo_match.currentindex)%> coalition","YOU - <%item.avatarego.item(text.avatarego_match.currentindex)%> coalition")
/ responsefontstyle = ("Arial", 3%, true)
/ optionvalues = ("allo", "ego")
/ orientation = horizontal
/ size = (25, 10)
/ position = (25%, 70%)
</radiobuttons>

<textbox OfferBox1>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 52%)
/ required = true
</textbox>

<textbox OfferBox2>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 62%)
/ required = true
</textbox>

<text CoalitionPartnerText>
/ items = ("Please indicate which coalition you want to form:")
/ fontstyle = ("Arial", 3%, true)
/ position = (49%,10%)
</text>

<text CoalitionPartnerEgo>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarego_match)
/ position = (75, 30)
</text>

<text CoalitionPartnerAllo>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarallo_match)
/ position = (23, 30)
</text>

<item avatarego>
/1="DUNLOP"
/2="BENSON"
</item>

<item avatarallo>
/1="BENSON"
/2="DUNLOP"
</item>

<text avatarego_match>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ position = (29, 30)
</text>

<text avatarallo_match>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ position = (71, 30)
</text>

<block Trial1>
/ trials = [
    1= CoalitionPartner;
    2= CoalitionOffer;
</block>

I tried to edit the script to make it shorter, let me know if you need other parts!

Thanks in advance!
Anabela

You simply do:

<picture OfferPic>
/ items = ("200.bmp", "160.bmp")
/ position = (30%,50%)
/ size = (60%,60%)
/ select = values.selectedoffer
</picture>

<values>
/ selectedoffer = 2
</values>

<surveypage CoalitionOffer>
/ questions = [1=OfferBox1, OfferBox2]
/ stimulusframes = [1 = clearscreen, OfferPic]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
</surveypage>

<surveypage CoalitionPartner>
/ ontrialend = [
    if (radiobuttons.CoalitionPartner.response == "allo"){
        values.selectedoffer = 1;
    } else {
        values.selectedoffer = 2;
    };
]
/ questions = [1=CoalitionPartner]
/ stimulusframes = [1 = CoalitionPartnerText,CoalitionPartnerEgo, CoalitionPartnerAllo]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
/ nextbuttonposition = (42,90)
</surveypage>

<radiobuttons CoalitionPartner>
/ options = ("YOU - <%item.avatarallo.item(text.avatarallo_match.currentindex)%> coalition","YOU - <%item.avatarego.item(text.avatarego_match.currentindex)%> coalition")
/ responsefontstyle = ("Arial", 3%, true)
/ optionvalues = ("allo", "ego")
/ orientation = horizontal
/ size = (25, 10)
/ position = (25%, 70%)
</radiobuttons>

<textbox OfferBox1>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 52%)
/ required = true
</textbox>

<textbox OfferBox2>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 62%)
/ required = true
</textbox>

<text CoalitionPartnerText>
/ items = ("Please indicate which coalition you want to form:")
/ fontstyle = ("Arial", 3%, true)
/ position = (49%,10%)
</text>

<text CoalitionPartnerEgo>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarego_match)
/ position = (75, 30)
</text>

<text CoalitionPartnerAllo>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarallo_match)
/ position = (23, 30)
</text>

<item avatarego>
/1="DUNLOP"
/2="BENSON"
</item>

<item avatarallo>
/1="BENSON"
/2="DUNLOP"
</item>

<text avatarego_match>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ position = (29, 30)
</text>

<text avatarallo_match>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ position = (71, 30)
</text>

<block Trial1>
/ trials = [
1= CoalitionPartner;
2= CoalitionOffer;]
</block>


Hi Dave, I have a similar situation but the conditional is between two groups of pictures (so multiple pictures). That is instead of only two items (i.e., / items = ("200.bmp", "160.bmp"), I now have 6 items in total, and I need to display only 3 of those items in one condition, and the other 3 items in another condition. Can I add something like || after the values? for instance: 
/ ontrialbegin = [
   if (radiobuttons.CoalitionPartner.response == "allo") {
   values.selectedoffer = 1 || values.selectedoffer = 2 || values.selectedoffer = 3;
  } else {
   values.selectedoffer = 4 || values.selectedoffer = 5 || values.selectedoffer = 6 ;
  };
Thanks in advance!!
By Dave - 11/1/2022

anabela_c - 11/1/2022
Dave - 7/14/2021
anabela_c - 7/14/2021
Hi (Dave?) :)

I need to display a picture based on a previous selected response (radiobuttons) but I am not sure on how to implement a conditional within the picture (if is possible). I am trying as follows (with the surveypage option, perhaps is better to use the ‘optionvalues' but I don’t know how):


<picture OfferPic>
/ items = [
    if (radiobuttons.CoalitionPartner.response == "YOU - <%item.avatarallo.item(text.avatarallo_match.currentindex)%> coalition"){picture.OfferBoxPartner.items =
        "200.bmp"                                    
    } else {picture.OfferBoxPartner.items =
        "160.bmp"
    };
]
/ position = (30%,50%)
/ size = (60%,60%)
</picture>


<surveypage CoalitionOffer>
/ questions = [1=OfferBox1, OfferBox2]
/ stimulusframes = [1 = clearscreen, OfferPic]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
</surveypage>

<surveypage CoalitionPartner>
/ questions = [1=CoalitionPartner]
/ stimulusframes = [1 = CoalitionPartnerText,CoalitionPartnerEgo, CoalitionPartnerAllo]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
/ nextbuttonposition = (42,90)
</surveypage>

<radiobuttons CoalitionPartner>
/ options = ("YOU - <%item.avatarallo.item(text.avatarallo_match.currentindex)%> coalition","YOU - <%item.avatarego.item(text.avatarego_match.currentindex)%> coalition")
/ responsefontstyle = ("Arial", 3%, true)
/ optionvalues = ("allo", "ego")
/ orientation = horizontal
/ size = (25, 10)
/ position = (25%, 70%)
</radiobuttons>

<textbox OfferBox1>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 52%)
/ required = true
</textbox>

<textbox OfferBox2>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 62%)
/ required = true
</textbox>

<text CoalitionPartnerText>
/ items = ("Please indicate which coalition you want to form:")
/ fontstyle = ("Arial", 3%, true)
/ position = (49%,10%)
</text>

<text CoalitionPartnerEgo>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarego_match)
/ position = (75, 30)
</text>

<text CoalitionPartnerAllo>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarallo_match)
/ position = (23, 30)
</text>

<item avatarego>
/1="DUNLOP"
/2="BENSON"
</item>

<item avatarallo>
/1="BENSON"
/2="DUNLOP"
</item>

<text avatarego_match>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ position = (29, 30)
</text>

<text avatarallo_match>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ position = (71, 30)
</text>

<block Trial1>
/ trials = [
    1= CoalitionPartner;
    2= CoalitionOffer;
</block>

I tried to edit the script to make it shorter, let me know if you need other parts!

Thanks in advance!
Anabela

You simply do:

<picture OfferPic>
/ items = ("200.bmp", "160.bmp")
/ position = (30%,50%)
/ size = (60%,60%)
/ select = values.selectedoffer
</picture>

<values>
/ selectedoffer = 2
</values>

<surveypage CoalitionOffer>
/ questions = [1=OfferBox1, OfferBox2]
/ stimulusframes = [1 = clearscreen, OfferPic]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
</surveypage>

<surveypage CoalitionPartner>
/ ontrialend = [
    if (radiobuttons.CoalitionPartner.response == "allo"){
        values.selectedoffer = 1;
    } else {
        values.selectedoffer = 2;
    };
]
/ questions = [1=CoalitionPartner]
/ stimulusframes = [1 = CoalitionPartnerText,CoalitionPartnerEgo, CoalitionPartnerAllo]
/ showbackbutton = false
/ showquestionnumbers = false
/ showpagenumbers = false
/ showmousecursor = true
/ navigationbuttonsize = (15,5)
/ finishlabel = "Click here to continue"
/ nextbuttonposition = (42,90)
</surveypage>

<radiobuttons CoalitionPartner>
/ options = ("YOU - <%item.avatarallo.item(text.avatarallo_match.currentindex)%> coalition","YOU - <%item.avatarego.item(text.avatarego_match.currentindex)%> coalition")
/ responsefontstyle = ("Arial", 3%, true)
/ optionvalues = ("allo", "ego")
/ orientation = horizontal
/ size = (25, 10)
/ position = (25%, 70%)
</radiobuttons>

<textbox OfferBox1>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 52%)
/ required = true
</textbox>

<textbox OfferBox2>
/ required = true
/ textboxsize = (5,5)
/ position = (67%, 62%)
/ required = true
</textbox>

<text CoalitionPartnerText>
/ items = ("Please indicate which coalition you want to form:")
/ fontstyle = ("Arial", 3%, true)
/ position = (49%,10%)
</text>

<text CoalitionPartnerEgo>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarego_match)
/ position = (75, 30)
</text>

<text CoalitionPartnerAllo>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ select = current(text.avatarallo_match)
/ position = (23, 30)
</text>

<item avatarego>
/1="DUNLOP"
/2="BENSON"
</item>

<item avatarallo>
/1="BENSON"
/2="DUNLOP"
</item>

<text avatarego_match>
/ items = avatarego
/ fontstyle = ("Arial", 3%, true)
/ position = (29, 30)
</text>

<text avatarallo_match>
/ items = avatarallo
/ fontstyle = ("Arial", 3%, true)
/ position = (71, 30)
</text>

<block Trial1>
/ trials = [
1= CoalitionPartner;
2= CoalitionOffer;]
</block>


Hi Dave, I have a similar situation but the conditional is between two groups of pictures (so multiple pictures). That is instead of only two items (i.e., / items = ("200.bmp", "160.bmp"), I now have 6 items in total, and I need to display only 3 of those items in one condition, and the other 3 items in another condition. Can I add something like || after the values? for instance: 
/ ontrialbegin = [
   if (radiobuttons.CoalitionPartner.response == "allo") {
   values.selectedoffer = 1 || values.selectedoffer = 2 || values.selectedoffer = 3;
  } else {
   values.selectedoffer = 4 || values.selectedoffer = 5 || values.selectedoffer = 6 ;
  };
Thanks in advance!!

I'm sorry, but

/ ontrialbegin = [
if (radiobuttons.CoalitionPartner.response == "allo") {
values.selectedoffer = 1 || values.selectedoffer = 2 || values.selectedoffer = 3;
} else {
values.selectedoffer = 4 || values.selectedoffer = 5 || values.selectedoffer = 6 ;
};


makes absolutely no sense. Please explain clearly what you want to do, to include, among other things, what "I need to display only 3 of those items in one condition, and the other 3 items in another condition" is supposed to mean. Display them when? How? All at the same time? At different times?