Changing a value depending on the presentation of a specific stimulus-item


Author
Message
plush
plush
Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)Guru (5.3K reputation)
Group: Forum Members
Posts: 57, Visits: 96
Dear Inquisit,

I am trying to change a value depending on the presentation of a specific stimulus-item. The code below however does not work. Any suggestions will be much appreciated.

Thanks!

------------------------------------------------------------------------------------------------------

<values>
/totalearnings = 0
</values>
<expressions>
/ totalearnings = format("%.2f", values.totalearnings)
</expressions>

<text totalearnings>
/ items = ("Total Points: <%expressions.totalearnings%>    ")
/ position = (70%, 82%)
/ valign = bottom
/ halign = left
/ erase = false
</text>

<trial outcomeleftbutton1>
/stimulustimes = [1=outcomeleftbuttontext1,totalearnings]
/timeout = 1000
/ ontrialend = [if(text.outcomeleftbuttontext1=="1 point") values.totalearnings+=1]
/ ontrialend = [if(text.outcomeleftbuttontext1=="5 points") values.totalearnings+=5]
</trial>

<text outcomeleftbuttontext1>
/ items = ("5 points","5 points","5 points","1 point","5 points","5 points","5 points","1 point")
/ select = noreplace
</text>

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
plush - Wednesday, March 28, 2018
Dear Inquisit,

I am trying to change a value depending on the presentation of a specific stimulus-item. The code below however does not work. Any suggestions will be much appreciated.

Thanks!

------------------------------------------------------------------------------------------------------

<values>
/totalearnings = 0
</values>
<expressions>
/ totalearnings = format("%.2f", values.totalearnings)
</expressions>

<text totalearnings>
/ items = ("Total Points: <%expressions.totalearnings%>    ")
/ position = (70%, 82%)
/ valign = bottom
/ halign = left
/ erase = false
</text>

<trial outcomeleftbutton1>
/stimulustimes = [1=outcomeleftbuttontext1,totalearnings]
/timeout = 1000
/ ontrialend = [if(text.outcomeleftbuttontext1=="1 point") values.totalearnings+=1]
/ ontrialend = [if(text.outcomeleftbuttontext1=="5 points") values.totalearnings+=5]
</trial>

<text outcomeleftbuttontext1>
/ items = ("5 points","5 points","5 points","1 point","5 points","5 points","5 points","1 point")
/ select = noreplace
</text>

<trial outcomeleftbutton1>
/stimulustimes = [1=outcomeleftbuttontext1,totalearnings]
/timeout = 1000
/ ontrialend = [if(text.outcomeleftbuttontext1=="1 point") values.totalearnings+=1]
/ ontrialend = [if(text.outcomeleftbuttontext1=="5 points") values.totalearnings+=5]
</trial>

text.outcomeleftbuttontext1 doesn't return anything. You apparently want to read the <text> element's currently selected item, so you should use the currentitem property:

<trial outcomeleftbutton1>
/stimulustimes = [1=outcomeleftbuttontext1,totalearnings]
/timeout = 1000
/ ontrialend = [if(text.outcomeleftbuttontext1.currentitem =="1 point") values.totalearnings+=1]
/ ontrialend = [if(text.outcomeleftbuttontext1.currentiitem =="5 points") values.totalearnings+=5]
</trial>
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search