diff options
Diffstat (limited to 'npc/commands/debug.txt')
-rw-r--r-- | npc/commands/debug.txt | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/npc/commands/debug.txt b/npc/commands/debug.txt index 5d628eca3..58764aec9 100644 --- a/npc/commands/debug.txt +++ b/npc/commands/debug.txt @@ -71,11 +71,57 @@ OnCall: if (!is_admin()) { end; } - GlobalDebugMenu; + GlobalDebugMenu(); closedialog; end; +OnSetVar: + if (getarraysize(.@atcmd_parameters$) != 3) + Exception("Usage: @set-var VARIABLE INDEX VALUE", RB_DISPBOTTOM|RB_ISFATAL); + + .@cmd$=array_shift(.@atcmd_parameters$); + .@idx=atoi(array_shift(.@atcmd_parameters$)); + if (charat(.@atcmd_parameters$[0], + getstrlen(.@atcmd_parameters$[0])-1) == "$") + .@str=true; + + if (.@str) + .@val$=array_shift(.@atcmd_parameters$); + else + .@val=array_shift(.@atcmd_parameters$); + + if (.@str) + setd(sprintf("%s[%d]", .@cmd$, .@idx), .@val$); + else + setd(sprintf("%s[%d]", .@cmd$, .@idx), .@val); + + dispbottom sprintf("%s[%d] is now: %s", .@cmd$, .@idx, + getd(sprintf("%s[%d]", .@cmd$, .@idx))); + end; + +// If the char is not a staff member, it'll be sent to GM Log instead +OnGetVar: + if (getarraysize(.@atcmd_parameters$) != 2) + Exception("Usage: @get-var VARIABLE INDEX", RB_DISPBOTTOM|RB_ISFATAL); + + .@cmd$=array_shift(.@atcmd_parameters$); + .@idx=atoi(array_shift(.@atcmd_parameters$)); + + .@mg$=sprintf("%s[%d] == %s", .@cmd$, .@idx, + getd(sprintf("%s[%d]", .@cmd$, .@idx))); + + if (!is_staff()) + atcommand("@request System Information: "+.@mg$); + else + dispbottom(.@mg$); + end; + OnInit: bindatcmd "debug", "@debug::OnCall", 99, 99, 1; - // TODO / FIXME: add a @test command that opens the help window for test-server + bindatcmd "getvar", "@debug::OnGetVar", 99, 99, 1; + bindatcmd "get-var", "@debug::OnGetVar", 99, 99, 1; + bindatcmd "setvar", "@debug::OnSetVar", 99, 99, 1; + bindatcmd "set-var", "@debug::OnSetVar", 99, 99, 1; + end; } + |