Millisecond Forums

Recording integer responses upon clicking pictures

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

By sunm - 12/27/2013

Hello,

I'm trying to create a custom likert-style question (Self-assessment Manikin) where I can record 1-9 after a picture stimulus is clicked. I have the trial and pictures lined up, but I can't figure out how to record the response as an integer upon clicking an appropriate picture.


Bonus: Would it be possible to change the picture (e.g. grey background instead of white) upon mouseover, to indicate to the respondent what option s/he is selecting?

My code so far:

<trial SAMA1>
/ stimulustimes = [0=SAMAinstruct, SAMA1, SAMA2, SAMA3, SAMA4, SAMA5, SAMA6, SAMA7, SAMA8, SAMA9]
/ validresponse = (SAMA1, SAMA2, SAMA3, SAMA4, SAMA5, SAMA6, SAMA7, SAMA8, SAMA9)
/ inputdevice = mouse
</trial>

<text SAMAinstruct>
/ items = ("Rate your Arousal")
/ size = (500px, 200px)
/ fontstyle = ("Verdana", 14pt)
/ position = (50%,40%)
</text>
<picture SAMA1>
/items = ("SAM-A-1.png")
/position = (10%,50%)
</picture>
<picture SAMA2>
/items = ("SAM-A-2.png")
/position = (20%,50%)
</picture>
<picture SAMA3>
/items = ("SAM-A-3.png")
/position = (30%,50%)
</picture>
<picture SAMA4>
/items = ("SAM-A-4.png")
/position = (40%,50%)
</picture>
<picture SAMA5>
/items = ("SAM-A-5.png")
/position = (50%,50%)
</picture>
<picture SAMA6>
/items = ("SAM-A-6.png")
/position = (60%,50%)
</picture>
<picture SAMA7>
/items = ("SAM-A-7.png")
/position = (70%,50%)
</picture>
<picture SAMA8>
/items = ("SAM-A-8.png")
/position = (80%,50%)
</picture>
<picture SAMA9>
/items = ("SAM-A-9.png")
/position = (90%,50%)
</picture>


Thank you! 
By Dave - 12/27/2013

Set up an <expression> that strips the letters from the <trial>'s response property

<expressions>
/ response_as_integer = replaceall(trial.sama1.response, "SAMA", "")
</expressions>

and log that expression to the data file

<data>
/ columns = [..., expressions.response_as_integer, ...]
</data>

You could achieve the same thing via a bit of conditional logic in /ontrialend, storing the result in a <values> entry and logging that value instead.

Finally, you could simply name your picture elements differently and not need any of the above (i.e., <picture 1>, <picture 2> etc.). You cannot use '0' as a name though, as 0 signifies 'noresponse'.