Page 1 of 1

Calculating Number Values

Posted: Wed Dec 17, 2014 7:39 pm
by rrehart
I am trying to use numbers to in a calculation, but can't seem to get the RegEx right. So:

I set a number to (x), then I set a second number to (y). Then I try to calculate the numbers into a new number (z) and it doesn't calculate. I figure I have to be doing something wrong with the RegEx.

Example:

v.X = 5
v.Y = 10

In order to get a calculated sum of 50, I have tried:

v.Z = [v.X][*][v.Y]
v.Z = [v.X[*]v.Y]
v.Z = v.X[*]v.Y
v.Z = [v.X*v.Y]

In each example, I either get a return value of 5 (v.X), or 0. What am I doing wrong?? :oops:

Re: Calculating Number Values

Posted: Wed Dec 17, 2014 10:51 pm
by cv27
Typical reply with questions instead of answers, sorry, but: I'm a bit confused by your reference to RegEx; I use RegEx extensively in 2-way but wasn't aware that RegEx expressions could be used in other areas such as the action editor. So, in what context are you trying to do this calculation?

If, as I would expect, you are trying to set a number in the action editor, then this is what I would have coded (not verified):
1- action type: Set a number
2- Number: v.Z
3- [v.X][*][v.Y]

DemoPad would confirm, but I suspect that the calculation operators ( [+], [-], [*]. [/] ) consider only one variable following the operator. If that's the case, then I would do:
1- Set number v.Z to [v.X]
2- Set number v.Z to [*][v.Y]

Extremely good question.

DemoPad?

Re: Calculating Number Values

Posted: Tue Dec 23, 2014 12:16 pm
by DemoPad
cv27 wrote:I use RegEx extensively in 2-way but wasn't aware that RegEx expressions could be used in other areas such as the action editor.
Correct, Regex can only be used in the feedback module
cv27 wrote:I suspect that the calculation operators ( [+], [-], [*]. [/] ) consider only one variable following the operator. If that's the case, then I would do:
1- Set number v.Z to [v.X]
2- Set number v.Z to [*][v.Y]
Correct again - you can't build compound calculations - you can only use a single operator per action.