diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-05-02 10:56:33 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-05-02 10:56:33 -0300 |
commit | 397949a0e46fdc813b195a04f02972e8d089ce7b (patch) | |
tree | ae8409b3b5c927a1f9123f39a9b19e1439d1f7d2 | |
parent | 46bbdfe15230da4d8abe41faf04c32fb42c3ad84 (diff) | |
download | serverdata-397949a0e46fdc813b195a04f02972e8d089ce7b.tar.gz serverdata-397949a0e46fdc813b195a04f02972e8d089ce7b.tar.bz2 serverdata-397949a0e46fdc813b195a04f02972e8d089ce7b.tar.xz serverdata-397949a0e46fdc813b195a04f02972e8d089ce7b.zip |
Move Exception() from Util to Main
-rw-r--r-- | npc/functions/main.txt | 45 | ||||
-rw-r--r-- | npc/functions/util.txt | 45 |
2 files changed, 45 insertions, 45 deletions
diff --git a/npc/functions/main.txt b/npc/functions/main.txt index e0a36ddcd..2cfcbe25c 100644 --- a/npc/functions/main.txt +++ b/npc/functions/main.txt @@ -325,6 +325,51 @@ function script validatepin { return true; } +// Something went wrong and must be reported (named after raise Exception in python) +// Exception( BugID, {Flags{, Return Code}} ) +function script Exception { + // Fill variable + .@msg$=getarg(0); + .@gf=getarg(1,RB_DEFAULT); + + if (.@gf & RB_DISPBOTTOM) + dispbottom("ERROR: "+.@msg$); + + if (.@gf & RB_DEBUGMES) + debugmes("[Warning] "+.@msg$); + + if (.@gf & RB_SPEECH) + mesc("ERROR, REPORT ME! "+.@msg$, 1); + + if (.@gf & RB_IRCBROADCAST) + channelmes("#world", "Error in script: "+.@msg$); + + if (.@gf & RB_GLOBALANNOUNCE) + announce("Error in script: "+.@msg$, bc_all); + + if (.@gf & RB_PLEASEREPORT|RB_DISPBOTTOM) + dispbottom("Please take a screenshot and report this bug, explaining how it happened."); + + if (.@gf & RB_PLEASEREPORT|RB_SPEECH) + mesc("Please take a screenshot and report this bug, explaining how it happened."), 1; + + if (.@gf & RB_ISFATAL) { + if (.@gf & RB_SPEECH) { + mesc l("This error is fatal."), 1; + close; + } + if (.@gf & RB_DISPBOTTOM) + dispbottom("This error is fatal, we stop execution."); + + if (.@gf & RB_DEBUGMES) + debugmes("[Error] The error is fatal."); + end; + } + + return getarg(2, 0); + +} + // Linking functions ///////////////////////////////////////////// function script getquestlink { diff --git a/npc/functions/util.txt b/npc/functions/util.txt index 1c6652a7e..df3dd0dd6 100644 --- a/npc/functions/util.txt +++ b/npc/functions/util.txt @@ -651,51 +651,6 @@ function script gettimeparam { } -// Something went wrong and must be reported (I tried to keep a syntax close to python) -// Exception( BugID, {Flags{, Return Code}} ) -function script Exception { - // Fill variable - .@msg$=getarg(0); - .@gf=getarg(1,RB_DEFAULT); - - if (.@gf & RB_DISPBOTTOM) - dispbottom("ERROR: "+.@msg$); - - if (.@gf & RB_DEBUGMES) - debugmes("[Warning] "+.@msg$); - - if (.@gf & RB_SPEECH) - mesc("ERROR, REPORT ME! "+.@msg$, 1); - - if (.@gf & RB_IRCBROADCAST) - channelmes("#world", "Error in script: "+.@msg$); - - if (.@gf & RB_GLOBALANNOUNCE) - announce("Error in script: "+.@msg$, bc_all); - - if (.@gf & RB_PLEASEREPORT|RB_DISPBOTTOM) - dispbottom("Please take a screenshot and report this bug, explaining how it happened."); - - if (.@gf & RB_PLEASEREPORT|RB_SPEECH) - mesc("Please take a screenshot and report this bug, explaining how it happened."), 1; - - if (.@gf & RB_ISFATAL) { - if (.@gf & RB_SPEECH) { - mesc l("This error is fatal."), 1; - close; - } - if (.@gf & RB_DISPBOTTOM) - dispbottom("This error is fatal, we stop execution."); - - if (.@gf & RB_DEBUGMES) - debugmes("[Error] The error is fatal."); - end; - } - - return getarg(2, 0); - -} - // Upon entering a town // EnterTown( LocName ) function script EnterTown { |