The eccoMAGIC Forums
the SLANG EXTENSION and Guest Programming >> Slang Rules Scripts, Functions, Examples and HOW TO >> 'Complex' Math Expressions for Rules

Message started by Admin on 02/15/17 at 23:23:32

Title: 'Complex' Math Expressions for Rules
Post by Admin on 02/15/17 at 23:23:32

In LUA scripts you can use the LUA math (including from the math module).  So modulo is simple in LUA,  e.g., "%".

But how to do stuff like that in simple slang rules ?

Absolute Value

iff([Base] < 0,0 - [Base],[Base])


++::replace((0 + replace((iff([Base] < 0,0 - [Base],[Base]) /7.0),"\d+(?=\.)","") + 0.01) * 7.0,"\.\d+",""):[Base] <> ""


Condition of [Base] would ignore value when zero, so we use a text compare <> blank

This example is modula for 7.  Use 7".0" to force decimal in result, even if 7 % 7.

The eccoMAGIC Forums » Powered by YaBB 2.1!
YaBB © 2000-2005. All Rights Reserved.