Calculation

Ok here is what I am trying to do: I have a global variable called gEmergency on the trigger event for key fob button 1 pressed being set to NOW.

On the release button event I have a local variable called lNow being set to now.
Next I want to subtract gEmergency from lNow to get the number of milliseconds that has passed from the time the button was pressed till it was released and assign it back to gEmergency.
Now if I was writing this as code I would probably write something like:
gEmergency=(lNow-gEmergency)/1000
This would give me a new number giving the number of seconds between the press time and release time to use elsewhere in my conditional actions.

Now I am really new to Rule Machine and canā€™t figure out how to get the calculation ā€œgEmergency=(lNow-gEmergency)/1000ā€ into an actionā€¦ is there a place where I can just enter this code or do I have to build it someway?

Help!!! Please donā€™t use screen shots I canā€™t see them.

Rio

You can use variable math. It's an option in RM when you set a variable.

1 Like

Thanks i found it. I was using the variable type of Time and not number.

Rio

2 Likes