Displaying pics using conditional


Author
Message
anabela_c
anabela_c
Associate Member (56 reputation)Associate Member (56 reputation)Associate Member (56 reputation)Associate Member (56 reputation)Associate Member (56 reputation)Associate Member (56 reputation)Associate Member (56 reputation)Associate Member (56 reputation)Associate Member (56 reputation)
Group: Forum Members
Posts: 15, Visits: 47
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

Attachments
160.bmp (44 views, 2.00 MB)
200.bmp (60 views, 2.00 MB)
Dave
Dave
Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)
Group: Administrators
Posts: 11K, Visits: 71K
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>


anabela_c
anabela_c
Associate Member (56 reputation)Associate Member (56 reputation)Associate Member (56 reputation)Associate Member (56 reputation)Associate Member (56 reputation)Associate Member (56 reputation)Associate Member (56 reputation)Associate Member (56 reputation)Associate Member (56 reputation)
Group: Forum Members
Posts: 15, Visits: 47
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>

Dave
Dave
Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)
Group: Administrators
Posts: 11K, Visits: 71K
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.
anabela_c
anabela_c
Associate Member (56 reputation)Associate Member (56 reputation)Associate Member (56 reputation)Associate Member (56 reputation)Associate Member (56 reputation)Associate Member (56 reputation)Associate Member (56 reputation)Associate Member (56 reputation)Associate Member (56 reputation)
Group: Forum Members
Posts: 15, Visits: 47
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!

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search