Millisecond Forums

What am I missing?

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

By Lucie1043 - 6/26/2016

Hi,

I am trying to link correct responses to text items but I must have missed something as the program register every answer as an error. Could you please check my script?

<trial opposite0click>
/ stimulusframes = [1 = yes, no, instructionframe, stimuli1, opposite1; 2 = stimuli2, opposite2; 3 = question0click, questionopposite0click, Is, ?]
/ inputdevice = mouse
/ validresponse = (yes, no)
/ iscorrectresponse = [trial.opposite0click.correct == list.answers1.nextvalue]
/ errormessage = true(error, 500)
/ correctmessage = true (correctmessage, 500)
</trial>

<list answers1>
/ items = ("no", "yes")
/ selectionmode = text.questionopposite.currentindex
</list>

<text questionopposite>
/ items = questionopposite
/ fontstyle = ("Arial", 15pt, true)
/ txcolor = (255, 0, 0)
/ position = (50, 30)
/ select = list.answers1.nextvalue
</text>

<item no>
/1 = "NO"
</item>

<item yes>
/1 = "YES"
</item>

<text no>
/items = no
/select = replace
/vposition = 90%
/ hposition = list.hpos.nextvalue
/txcolor = (255, 0, 0)
/ fontstyle = ("Arial", 30pt, true)
</text>

<text yes>
/items = yes
/select = replace
/vposition = 90%
/ hposition = list.hpos.nextvalue
/txcolor = (255, 0, 0)
/ fontstyle = ("Arial", 30pt, true)
</text>

<text error>
/ items= ("ERROR")
/ fontstyle = ("Arial", 50pt, true)
/ txcolor = (255, 0, 0)
</text>

<text correctmessage>
/ items= ("You won")
/ fontstyle = ("Arial", 50pt, true)
/ txcolor = (255, 0, 0)
</text>

<text questionopposite>
/ items = questionopposite
/ fontstyle = ("Arial", 15pt, true)
/ txcolor = (255, 0, 0)
/ position = (50, 30)
/ select = list.answers1.nextvalue
</text>


Thanks for your help!

Lucie
By Dave - 6/26/2016

<list answers1>
/ items = ("no", "yes")
/ selectionmode = text.questionopposite.currentindex
</list>

<text questionopposite>
/ items = questionopposite
/ fontstyle = ("Arial", 15pt, true)
/ txcolor = (255, 0, 0)
/ position = (50, 30)
/ select = list.answers1.nextvalue
</text>

This does not make sense: You instruct the <list> to select the item number corresponding to the item selected by <text questionopposite>, but you also instruct <text questionopposite> to select *its* item according to the <list> (and wrongly so; "yes" or "no", which is what list.answers1.nextvalue returns, is not an item number). In other words: The entire definition is circular (in addition to using improper syntax).

The proper way to do this is:

<block questionblock>
/ trials = [1-4 = questiontrial]
</block>

<trial questiontrial>
/ stimulusframes = [1=question, yes, no]
/ inputdevice = mouse
/ validresponse = (yes, no)
/ iscorrectresponse = [trial.questiontrial.response == list.correctanswers.nextvalue]
</trial>

<text question>
/ items = questionitems
/ select = noreplace
</text>

<item questionitems>
/ 1 = "Question A -- Correct answer is yes."
/ 1 = "Question B -- Correct answer is yes."
/ 1 = "Question C -- Correct answer is no."
/ 1 = "Question D -- Correct answer is no."
</item>

<list correctanswers>
/ items = ("yes", "yes", "no", "no")
/ selectionmode = text.question.currentindex
</list>

<text yes>
/ items = ("YES.")
/ position = (40%, 60%)
</text>

<text no>
/ items = ("NO.")
/ position = (60%, 60%)
</text>