summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--npc/functions/util.txt24
1 files changed, 23 insertions, 1 deletions
diff --git a/npc/functions/util.txt b/npc/functions/util.txt
index 164c7d7d8..7bd0b9dbe 100644
--- a/npc/functions/util.txt
+++ b/npc/functions/util.txt
@@ -919,6 +919,28 @@ function script EnterTown {
}
// Convert map name to location id
+// LocToMap( LocName )
+function script LocToMap {
+ // Fill variable
+ .@v$=getarg(0);
+
+ // Error code
+ if (playerattached())
+ .@err=RB_DEFAULT;
+ else
+ .@err=RB_DEBUGMES;
+
+ // Validade variable, see npc/000-1/exit.txt first
+ setarray .@mapx$, "005-1", "003-1", "009-1", "012-1", "017-1", "018-5", "020-1", "024-1";
+ setarray .@locs$, "Candor", "Tulim", "Halin", "Hurns", "LoF", "Lilit", "Nival", "Frostia";
+ .@lx=array_find(.@locs$, .@v$);
+ if (.@lx < 0)
+ return Exception("Invalid map passed to MapToLoc: "+.@v$, .@err);
+
+ return .@locs$[.@lx];
+}
+
+// Convert map name to location id
// MapToLoc( MapName )
function script MapToLoc {
// Fill variable
@@ -933,7 +955,7 @@ function script MapToLoc {
// Validade variable, see npc/000-1/exit.txt first
setarray .@mapx$, "005-1", "003-1", "009-1", "012-1", "017-1", "018-5", "020-1", "024-1";
setarray .@locs$, "Candor", "Tulim", "Halin", "Hurns", "LoF", "Lilit", "Nival", "Frostia";
- .@lx=array_find(.@locs$, .@v$);
+ .@lx=array_find(.@mapx$, .@v$);
if (.@lx < 0)
return Exception("Invalid map passed to MapToLoc: "+.@v$, .@err);