summaryrefslogtreecommitdiff
path: root/npc/functions/main.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/functions/main.txt')
-rw-r--r--npc/functions/main.txt21
1 files changed, 21 insertions, 0 deletions
diff --git a/npc/functions/main.txt b/npc/functions/main.txt
index bf6389989..9446d218b 100644
--- a/npc/functions/main.txt
+++ b/npc/functions/main.txt
@@ -3,6 +3,7 @@
// Authors:
// 4144
// Travolta
+// gumi
// Jesusalva
// Description:
// Built-in essential functions.
@@ -231,6 +232,24 @@ function script npctalkonce {
return true;
}
+// Randomizer functions
+/////////////////////////////////////////////
+
+// returns one argument randomly
+// any( <arg>{, ...<arg>} )
+function script any {
+ return getarg(rand(getargcount()));
+}
+
+// returns any member of the array
+// any_of( <array> )
+function script any_of {
+ return getelementofarray(getarg(0), getarrayindex(getarg(0)) + rand(getarraysize(getarg(0)) - getarrayindex(getarg(0))));
+}
+
+// TMW2 Custom Functions
+/////////////////////////////////////////////
+
function script isin {
if (getmapxy(.@mapName$, .@xpos, .@ypos, 0) != 0)
return false;
@@ -275,6 +294,8 @@ function script validatepin {
return true;
}
+// Linking functions
+/////////////////////////////////////////////
function script getquestlink {
return "[@@q" + getarg(0) + "|@@]";
}