diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-06-16 23:34:40 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-06-16 23:34:40 -0300 |
commit | 508c75860c19527a4481b022ebe5bdf26ed87de6 (patch) | |
tree | 59766429e9844905f618a0be9058d18ec789bebc /npc/functions | |
parent | ae22105e139fa53a8e3b6da12d53e819bcb2fb55 (diff) | |
download | serverdata-508c75860c19527a4481b022ebe5bdf26ed87de6.tar.gz serverdata-508c75860c19527a4481b022ebe5bdf26ed87de6.tar.bz2 serverdata-508c75860c19527a4481b022ebe5bdf26ed87de6.tar.xz serverdata-508c75860c19527a4481b022ebe5bdf26ed87de6.zip |
New (unused) math function: limit(lower, target, higher)
Diffstat (limited to 'npc/functions')
-rw-r--r-- | npc/functions/math.txt | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/npc/functions/math.txt b/npc/functions/math.txt index b213cfd79..068d46cba 100644 --- a/npc/functions/math.txt +++ b/npc/functions/math.txt @@ -77,6 +77,14 @@ function script is_between { } +// forces the equation: lower <= target <= higher. +// Note it still works if higher and target values are swapped. +// limit ( lower, target, higher) +function script limit { + return max(getarg(0), min(getarg(1), getarg(2))); +} + + // result is the ponderate average. // ponderate_avg ( arg1, sub1, arg2, sub2) function script ponderate_avg { |