Millisecond Forums

Can I make text boxes with assigned values?

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

By akb2204 - 5/10/2015

Hello,

This is my first time coding in Inquisit and I have looked at the Millisecond Test Library and the online forums, but do not think I have found the exact answer that I need.  I'm trying to create an experiment in which participants allocate hypothetical money to a series of faces.  After each face, participants would see a running total of how much "money" they have left over before the next face/trial. For the money allocation page, I want to have 8 different text boxes presented simultaneously with a certain, fixed amount displayed on each box and when the participant clicks on the box, I would like the amount shown on the box to be deducted from their total, and then the updated total to be displayed on the next "screen"...

I am really not sure of how to have the text boxes actually assigned to the value they display and would be sincerely grateful if anyone could help me with this please!

Thank you in advance!
By Dave - 5/10/2015

You simply set up 8 <text> elements, each displaying a different amount of money. Have participants click on one of the <text> elements and subtract the selected amount from their total:

<values>
/ total = 1000
/ amount1 = 10
/ amount2 = 25
</values>

<block myblock>
/ trials = [1-4=allocate]
</block>

<trial allocate>
/ ontrialend = [if (trial.allocate.response=="amount1") values.total-=values.amount1]
/ ontrialend = [if (trial.allocate.response=="amount2") values.total-=values.amount2]
/ stimulusframes = [1=stimulus, amount1, amount2]
/ validresponse = (amount1, amount2)
/ inputdevice = mouse
/ branch = [trial.showmoneyleft]
</trial>

<trial showmoneyleft>
/ stimulusframes = [1=total]
/ validresponse = (0)
/ trialduration = 1000
/ recorddata = false
</trial>

<text stimulus>
/ items = ("A", "B", "C", "D")
</text>

<text amount1>
/ items = ("<%values.amount1%>$")
/ txbgcolor = grey
/ size = (5%, 0.05px*display.width)
/ position = (40%, 75%)
/ vjustify = center
</text>

<text amount2>
/ items = ("<%values.amount2%>$")
/ txbgcolor = grey
/ size = (5%, 0.05px*display.width)
/ position = (60%, 75%)
/ vjustify = center
</text>

<text total>
/ items = ("You still have <%values.total%>$")
/ position = (50%, 50%)
</text>

By akb2204 - 5/10/2015

Thank you so very much, Supreme Being Dave!! This is great!

Sincerely,
AKB