From 46bbdfe15230da4d8abe41faf04c32fb42c3ad84 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Thu, 2 May 2019 10:55:27 -0300 Subject: Use Exception() in some places --- npc/002-5/main.txt | 3 +-- npc/functions/fishing.txt | 2 +- npc/functions/instances.txt | 6 +++--- npc/functions/inventoryplace.txt | 3 +-- npc/functions/mobhunter.txt | 8 ++------ npc/functions/util.txt | 11 ++++++++++- 6 files changed, 18 insertions(+), 15 deletions(-) (limited to 'npc') diff --git a/npc/002-5/main.txt b/npc/002-5/main.txt index bd06fe579..22269552e 100644 --- a/npc/002-5/main.txt +++ b/npc/002-5/main.txt @@ -30,11 +30,10 @@ L_Tulim: end; L_Error: - debugmes "ERROR: PLAYER INVALID PC_DEST ON #NardShip: " + PC_DEST$; PC_DEST$ = ""; @timer_navio_running = 0; warp "000-1", 22, 22; - dispbottom l("An error on your travel happened. Please report."); + Exception("PLAYER INVALID PC_DEST ON #NardShip: " + PC_DEST$, RB_DEFAULT | RB_ISFATAL); end; } diff --git a/npc/functions/fishing.txt b/npc/functions/fishing.txt index e84b11cef..b09cb0d48 100644 --- a/npc/functions/fishing.txt +++ b/npc/functions/fishing.txt @@ -76,7 +76,7 @@ function script fishing { }; freeloop(false); } - debugmes("[FISH] Initialized with %d common and %d rare fishes", getarraysize(.@common_fish), getarraysize(.@rare_fish)); + //debugmes("[FISH] Initialized with %d common and %d rare fishes", getarraysize(.@common_fish), getarraysize(.@rare_fish)); .@npc$ = strnpcinfo(0); // the full name of the fishing spot diff --git a/npc/functions/instances.txt b/npc/functions/instances.txt index ee9c3081e..86d08d0a5 100644 --- a/npc/functions/instances.txt +++ b/npc/functions/instances.txt @@ -15,14 +15,14 @@ OnInstRestart: // Candor Instance (we do all tests for debugmes here) .CANDOR_INSTID = instance_create("002-1@CandorInst", 0, IOT_NONE); if (.CANDOR_INSTID < 0) { - debugmes "Error: No instance ID"; + Exception("CANDY Instance ID failed", RB_DEBUGMES|RB_IRCBROADCAST); } else { //debugmes("created new instance id: %s", str(.CANDOR_INSTID)); .CANDOR1$=instance_attachmap("002-1", .CANDOR_INSTID, 0, "002-1@Candor"); - if (.CANDOR1$ == "") debugmes "Error: Map 002-1 CANDY failed"; + if (.CANDOR1$ == "") Exception("Map 002-1 CANDY failed", RB_DEBUGMES|RB_IRCBROADCAST); .CANDOR3$=instance_attachmap("002-3", .CANDOR_INSTID, 0, "002-3@Candor"); - if (.CANDOR3$ == "") debugmes "Error: Map 002-3 CANDY failed"; + if (.CANDOR3$ == "") Exception("Map 002-3 CANDY failed", RB_DEBUGMES|RB_IRCBROADCAST); debugmes "Nard's Ship in Candor instance is set."; instance_set_timeout(1000000, 1000000, .CANDOR_INSTID); diff --git a/npc/functions/inventoryplace.txt b/npc/functions/inventoryplace.txt index 4a5e08cad..76cdad21f 100644 --- a/npc/functions/inventoryplace.txt +++ b/npc/functions/inventoryplace.txt @@ -13,8 +13,7 @@ function script inventoryplace { if (.@argc % 2 != 0) { - debugmes "inventoryplace: Wrong argument count."; - close; + Exception("inventoryplace: Wrong argument count.", RB_SPEECH|RB_ISFATAL|RB_PLEASEREPORT|RB_DEBUGMES); } for (.@i = .@j = 0; .@i < .@argc; .@i += 2) diff --git a/npc/functions/mobhunter.txt b/npc/functions/mobhunter.txt index 464a88ef9..e7bf03421 100644 --- a/npc/functions/mobhunter.txt +++ b/npc/functions/mobhunter.txt @@ -30,9 +30,7 @@ function script GHQ_GetQuestIDByMonsterID { return 8; break; default: - debugmes "Invalid mob ID: " + getarg(0); - dispbottom l("ERROR, Please report: GHQ GQID: Invalid ID: @@", getarg(0)); - return 0; + return Exception("GHQ GQID: Invalid ID: "+getarg(0), RB_DEFAULT^RB_PLEASEREPORT|RB_ISFATAL); break; } @@ -66,9 +64,7 @@ function script GHQ_GetMonsterIDByQuestID { return MountainSnake; break; default: - debugmes "Invalid quest ID: " + getarg(0); - dispbottom l("ERROR, Please report: GHQ GMID: Invalid ID: @@", getarg(0)); - return 0; + return Exception("GHQ GMID: Invalid ID: "+getarg(0), RB_DEFAULT^RB_PLEASEREPORT|RB_ISFATAL); break; } diff --git a/npc/functions/util.txt b/npc/functions/util.txt index 3f4ab0a09..1c6652a7e 100644 --- a/npc/functions/util.txt +++ b/npc/functions/util.txt @@ -667,9 +667,18 @@ function script Exception { if (.@gf & RB_SPEECH) mesc("ERROR, REPORT ME! "+.@msg$, 1); - if (.@gf & RB_PLEASEREPORT) + 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; -- cgit v1.2.3-60-g2f50