Millisecond Forums

expressions to values

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

By plush - 3/19/2017

Dear Inquisit wizards,

I have a value (doping = 0) that I later need in my script to use as input. To calculate this value I use an expression (values.doping = round(expressions.iat_doping_d*100). However, the doping-value isn't updated.

The expression itself is a number and one that I see it saved in the data. I therefore do not expect the problem to be about the expression itself, but in how it is used to replace the doping-value.

Suggestions are much appreciated!

Best and thanks,

Tom

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

<values>
/ doping = 0
</values>

<trial doping_summary>
/ stimulustimes = [0=doping_summary]
/ validresponse = (" ")
/ recorddata = false
/ ontrialbegin = [values.doping = round(expressions.iat_doping_d*100)]
</trial>

<text doping_summary>
/ items = ("Your score was <% values.doping %>.")
/ size = (60%, 60%)
/ hjustify = left
</text>

By Dave - 3/19/2017

plush - Monday, March 20, 2017
Dear Inquisit wizards,

I have a value (doping = 0) that I later need in my script to use as input. To calculate this value I use an expression (values.doping = round(expressions.iat_doping_d*100). However, the doping-value isn't updated.

The expression itself is a number and one that I see it saved in the data. I therefore do not expect the problem to be about the expression itself, but in how it is used to replace the doping-value.

Suggestions are much appreciated!

Best and thanks,

Tom

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

<values>
/ doping = 0
</values>

<trial doping_summary>
/ stimulustimes = [0=doping_summary]
/ validresponse = (" ")
/ recorddata = false
/ ontrialbegin = [values.doping = round(expressions.iat_doping_d*100)]
</trial>

<text doping_summary>
/ items = ("Your score was <% values.doping %>.")
/ size = (60%, 60%)
/ hjustify = left
</text>


There is nothing obviously wrong with the code you posted and -- as far as I can tell -- it works with an arbitrary expression:

<values>
/ doping = 0
</values>

<trial doping_summary>
/ stimulustimes = [0=doping_summary]
/ validresponse = (" ")
/ recorddata = false
/ ontrialbegin = [values.doping = round(expressions.iat_doping_d*100)]
</trial>

<text doping_summary>
/ items = ("Your score was <% values.doping %>.")
/ size = (60%, 60%)
/ hjustify = left
</text>

<expressions>
/ iat_doping_d = rand(-2,2)
</expressions>

So I suspect I does have something to do with your particular expression. Regardless, instead of using a value, why don't you use the expressions directly in your <text> element, i.e.

<text doping_summary>
/ items = ("Your score was <% expressions.iat_doping_d*100 %>.")
/ size = (60%, 60%)
/ hjustify = left
</text>

or

<text doping_summary>
/ items = ("Your score was <% round(expressions.iat_doping_d*100) %>.")
/ size = (60%, 60%)
/ hjustify = left
</text>