Hi all,
I just came across an issue in a script I'm working on that would be most elegantly solved by reading how many radiobutton questions were responded to correctly within a surveypage in order to calculate a reward for participants. For example, on the following surveypage, participants are supposed to get £0.05 per correct radiobutton response:
<values>
/CorrectAdvancedContentQuestions = ""
</values>
<surveypage AttentionQuestions1>
/ questions = [1-3 = noreplace(BurntCity1, BurntCity2, BurntCity3)]
/ showpagenumbers = false
/ showquestionnumbers = false
/ nextbuttonposition = (50%,90%)
/ ontrialend = [values.CorrectAdvancedContentQuestions += surveypage.AttentionQuestions1.correctcount]
</surveypage>
<radiobuttons BurntCity1>
/ caption = "What was the cause of the city's initial prosperity?"
/ options = ("Its river's waters caused crops and animals to grow well", "Its inhabitants were highly skilled traders", "Kish had blessed the city with gold and jewels", "Its inhabitants robbed travelers")
/ correctresponse = ("Its river's waters caused crops and animals to grow well")
/ validresponse = ("Its river's waters caused crops and animals to grow well", "Its inhabitants were highly skilled traders", "Kish had blessed the city with gold and jewels", "Its inhabitants robbed travelers")
/ order = random
</radiobuttons>
<radiobuttons BurntCity2>
/ caption = "Why did Kish summon the fire spirit?"
/ options = ("She was angry because the people did not honor her any longer", "The inhabitants were freezing and needed warmth", "To punish the fire spirit for hurting the inhabitants", "To collect the offerings the people had brought to her")
/ correctresponse = ("She was angry because the people did not honor her any longer")
/ validresponse = ("She was angry because the people did not honor her any longer", "The inhabitants were freezing and needed warmth", "To punish the fire spirit for hurting the inhabitants", "To collect the offerings the people had brought to her")
/ order = random
</radiobuttons>
<radiobuttons BurntCity3>
/ caption = "What happened to the people of the city in the end?"
/ options = ("Many of them were burned to death and the rest were maimed", "They all joined together in rebuilding their city with Kish's help", "They united to fight the evil fire spirit", "They sailed away across their river")
/ correctresponse = ("Many of them were burned to death and the rest were maimed")
/ validresponse = ("Many of them were burned to death and the rest were maimed", "They all joined together in rebuilding their city with Kish's help", "They united to fight the evil fire spirit", "They sailed away across their river")
/ order = random
</radiobuttons>
My /ontrialend is an attempt to set that up (I would do the actual reward calculation in an expression later on, so I can set the reward dynamically for future task versions), but it seems as though all the attributes for the surveypage element that I could use (correct, totalcorrect, correctcount) apply to the page in its entirety (i.e. =0 if any question on the page is wrong, =1 if all questions are correct). The radiobuttons element doesn't have a correct attribute for me to reference. Is there any way to do this?
My current workaround is to use conditional logic based on the answers to each individual question, à la:
if (radiobuttons.BurntCity1.response == "Its river's waters caused crops and animals to grow well") values.CorrectAdvancedContentQuestions += 1
, but this seems very clunky for multiple survey pages with different questions.