From 508c75860c19527a4481b022ebe5bdf26ed87de6 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sun, 16 Jun 2019 23:34:40 -0300 Subject: New (unused) math function: limit(lower, target, higher) --- npc/functions/math.txt | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'npc/functions') 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 { -- cgit v1.2.3-70-g09d2