Millisecond Forums

Displaying a picture based on user input

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

By Cowdice - 11/18/2021

Hi there!

I'm quite new to Inquisit and am trying to figure out how a participant can choose a picture from a set of four that will then be displayed later in the task. The problem I've having is that no matter which picture is chosen, the first item from avatarchosen is displayed (the Penguin, in this case). Below, I've included the code for when the picture is chosen and an example trial that I'd like the "chosenavatar" picture displayed in. I suspect the problem has something to do with the participantavatars list not populating, but I'm not sure. Any help you can offer would be much appreciated :)

<item avatarchosen>
/ 1 = "Penguin.png"
/ 2 = "Panther.png"
/ 3 = "Tabby.png"
/ 4 = "Stag.jpg"
</item>

<picture chosenavatar>
/ items = avatarchosen
/ size = (15%, 15%)
/ position = (50%, 25%)
/ select = list.participantavatars.currentindex
/ erase = false
</picture>

<list participantavatars>
/ poolsize = 1
</list>

<trial instruction3>
/ stimulustimes = [0=clearscreen, picture.Slide3, Penguin, Panther, Tabby, Stag]
/ inputdevice = mouse
/ ontrialbegin = [list.participantavatars.clearitems()]
/ validresponse = (picture.Penguin, picture.Panther, picture.Tabby, picture.Stag)
/ ontrialend = [if (trial.instruction3.response == picture.Penguin) list.participantavatars.insertitem("item.Penguin", 1)
else if (trial.instruction3.response == picture.Panther) list.participantavatars.insertitem("item.Panther", 1)
else if (trial.instruction3.response == picture.Tabby) list.participantavatars.insertitem("item.Tabby", 1)
else if (trial.instruction3.response == picture.Stag) list.participantavatars.insertitem("item.Stag", 1)]
/ branch = [trial.instruction4]
</trial>

<trial RCstart>
/ inputdevice = mouse
/ ontrialbegin = [
    values.trialcounter += 1
]
/ stimulustimes = [0= RCV1; 6000= clearscreen, Bear, Wildebeest, YOU, AtoB_static, picture.chosenavatar, Game;
11000= clearscreen, Bear, Wildebeest, YOU, AtoB_static, picture.chosenavatar,3;
12000= clearscreen, Bear, Wildebeest, YOU, AtoB_static, picture.chosenavatar,2;
13000= clearscreen, Bear, Wildebeest, YOU, AtoB_static, picture.chosenavatar,1;
14000= clearscreen, Bear, Wildebeest, YOU, AtoB_static, picture.chosenavatar,play;
15000= clearscreen, Bear, Wildebeest, YOU, AtoB_static, picture.chosenavatar,video.AtoB]
/ timeout = 0
/ branch = [
    trial.2P
]
</trial>
By Dave - 11/19/2021


Your syntax in <trial instruction3> is all wrong. You'll want to do something like this:

<values>
/ chosenavatar = 1
</values>

<picture chosenavatar>
/ items = avatarchosen
/ size = (15%, 15%)
/ position = (50%, 25%)
/ select = values.chosenavatar
/ erase = false
</picture>

<trial instruction3>
/ stimulustimes = [0=clearscreen, picture.Slide3, Penguin, Panther, Tabby, Stag]
/ inputdevice = mouse
/ validresponse = (picture.Penguin, picture.Panther, picture.Tabby, picture.Stag)
/ ontrialend = [
    if (trial.instruction3.response == "Penguin") {
        values.chosenavatar = 1;
    } else if (trial.instruction3.response == "Panther") {
        values.chosenavatar = 2;
    } else if (trial.instruction3.response == "Tabby") {
        values.chosenavatar = 3;
    } else if (trial.instruction3.response == "Stag") {
        values.chosenavatar = 4;
    };
]

/ branch = [trial.instruction4]
</trial>
By Cowdice - 11/19/2021

Thank you, Dave, this is very helpful!