Welcome, Guest. Please Login or Register.
eccoMAGIC Forums
04/18/24 at 16:38:52
News: If you have a scroll wheel, TRY EM SCROLL WHEELS. It's NICE!
Home Help Search Login Register


Pages: 1
Send Topic Print
  Rating
Rate:
Rating:
Rating: 0.00
Votes: 0

5
4
3
2
1












5
4
3
2
1


1


2


3


4


5


6


7


8


9


10

'Complex' Math Expressions for Rules (Popularity: 2537 )
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post 'Complex' Math Expressions for Rules
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
 
Code:

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


 
 
 
MODULO:
 
Code:

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


 
 
 
notes:
 
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.
 
Back to top
 
 

The Administrator.
WWW   IP Logged
Pages: 1
Send Topic Print