diff options
author | Jesusaves <cpntb1@ymail.com> | 2020-05-28 15:33:53 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2020-05-28 15:33:53 -0300 |
commit | 3f95220951ba55fc3544eed530848adbf453135d (patch) | |
tree | 75d40acae04bdd3ef367ec3a1c5409fe7599cf1d /npc/functions/util.txt | |
parent | ab37700e8b255e58e361d0cca7fb5b0996b6e376 (diff) | |
download | serverdata-3f95220951ba55fc3544eed530848adbf453135d.tar.gz serverdata-3f95220951ba55fc3544eed530848adbf453135d.tar.bz2 serverdata-3f95220951ba55fc3544eed530848adbf453135d.tar.xz serverdata-3f95220951ba55fc3544eed530848adbf453135d.zip |
...And, I think I've found Micksha's bug. '-'
Diffstat (limited to 'npc/functions/util.txt')
-rw-r--r-- | npc/functions/util.txt | 24 |
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); |