Calculating Number Values

Forum to ask for any help
Post Reply
rrehart
Posts: 44
Joined: Thu Sep 06, 2012 12:08 am

Calculating Number Values

Post by rrehart » Wed Dec 17, 2014 7:39 pm

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:

cv27
Posts: 233
Joined: Sat Nov 24, 2012 10:15 pm
Location: Montréal, QC, Canada

Re: Calculating Number Values

Post by cv27 » Wed Dec 17, 2014 10:51 pm

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?

User avatar
DemoPad
Site Admin
Posts: 769
Joined: Thu Jun 14, 2012 10:46 am
Contact:

Re: Calculating Number Values

Post by DemoPad » Tue Dec 23, 2014 12:16 pm

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.

Post Reply