diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-04-22 11:17:17 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-04-22 11:17:17 -0300 |
commit | de1ab31800a499d760b52275bc264bed21ac672c (patch) | |
tree | 211a34157574193815909eabdb25a4e06cd835c8 /npc | |
parent | ee97a459c8acb20deb7d2906178c8d6d1b21314c (diff) | |
download | serverdata-de1ab31800a499d760b52275bc264bed21ac672c.tar.gz serverdata-de1ab31800a499d760b52275bc264bed21ac672c.tar.bz2 serverdata-de1ab31800a499d760b52275bc264bed21ac672c.tar.xz serverdata-de1ab31800a499d760b52275bc264bed21ac672c.zip |
Make my math rules more clear
Diffstat (limited to 'npc')
-rw-r--r-- | npc/functions/math.txt | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/npc/functions/math.txt b/npc/functions/math.txt index ebb9ee069..a07b46280 100644 --- a/npc/functions/math.txt +++ b/npc/functions/math.txt @@ -68,3 +68,27 @@ function script log2 { return .@i; } + +// result is: lower < target <= higher +// is_between ( lower, higher, target) +function script is_between { + .@val=getarg(2); + return (getarg(0) < .@val && getarg(1) >= .@val); +} + + +// result is the ponderate average. +// ponderate_avg ( arg1, sub1, arg2, sub2) +function script ponderate_avg { + .@a1=getarg(0); + .@s1=getarg(1); + .@a2=getarg(2); + .@s2=getarg(3); + + .@h1=.@a1*.@s1; + .@h2=.@a1*.@s1; + .@dd=.@s1+.@s2; + + return (.@h1+.@h2)/.@dd; +} + |