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


Changing a value depending on the presentation of a specific...

Author
Message
plush
plush
Esteemed Member
Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K reputation)Esteemed Member (2K 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
Supreme Being (374K reputation)Supreme Being (374K reputation)Supreme Being (374K reputation)Supreme Being (374K reputation)Supreme Being (374K reputation)Supreme Being (374K reputation)Supreme Being (374K reputation)Supreme Being (374K reputation)Supreme Being (374K reputation)

Group: Administrators
Posts: 8.8K, Visits: 36K
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


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....






Millisecond Forums


Search