From 1eb354820d2473b9d54af5dbf42d6027591f84fd Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sat, 6 Oct 2018 16:05:22 -0300 Subject: Move RNGesus to utils file. They're better there. Maybe even on main. --- npc/functions/RNGesus.txt | 23 ----------------------- npc/functions/util.txt | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 23 deletions(-) delete mode 100644 npc/functions/RNGesus.txt (limited to 'npc/functions') diff --git a/npc/functions/RNGesus.txt b/npc/functions/RNGesus.txt deleted file mode 100644 index f71c2f28a..000000000 --- a/npc/functions/RNGesus.txt +++ /dev/null @@ -1,23 +0,0 @@ -// Evol functions. -// Authors: -// gumi -// Description: -// Randomization helper functions. - - - -// any({, ...}) -// returns one argument randomly - -function script any { - return getarg(rand(getargcount())); -} - - - -// any_of() -// returns any member of the array - -function script any_of { - return getelementofarray(getarg(0), getarrayindex(getarg(0)) + rand(getarraysize(getarg(0)) - getarrayindex(getarg(0)))); -} diff --git a/npc/functions/util.txt b/npc/functions/util.txt index 99d60da5d..47e07ea72 100644 --- a/npc/functions/util.txt +++ b/npc/functions/util.txt @@ -406,3 +406,18 @@ function script mercrank { } } + +// Randomizer functions by gumi +///////////////////////////////////////////// + +// returns one argument randomly +// any( {, ...} ) +function script any { + return getarg(rand(getargcount())); +} + +// returns any member of the array +// any_of( ) +function script any_of { + return getelementofarray(getarg(0), getarrayindex(getarg(0)) + rand(getarraysize(getarg(0)) - getarrayindex(getarg(0)))); +} -- cgit v1.2.3-60-g2f50