Displaying a picture based on user input


Author
Message
Cowdice
Cowdice
Associate Member (77 reputation)Associate Member (77 reputation)Associate Member (77 reputation)Associate Member (77 reputation)Associate Member (77 reputation)Associate Member (77 reputation)Associate Member (77 reputation)Associate Member (77 reputation)Associate Member (77 reputation)
Group: Forum Members
Posts: 7, Visits: 44
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>

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: 98K

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>

Edited 3 Years Ago by Dave
Cowdice
Cowdice
Associate Member (77 reputation)Associate Member (77 reputation)Associate Member (77 reputation)Associate Member (77 reputation)Associate Member (77 reputation)Associate Member (77 reputation)Associate Member (77 reputation)Associate Member (77 reputation)Associate Member (77 reputation)
Group: Forum Members
Posts: 7, Visits: 44
Thank you, Dave, this is very helpful!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search