From 25a64bfba88fc3b03a6f8ebef897f447fb3fc61d Mon Sep 17 00:00:00 2001 From: skotlex Date: Fri, 16 Feb 2007 20:53:05 +0000 Subject: - Updated the Dancer job quest to attach a player to the main timer script. - Updated script commands startnpctimer, stopnpctimer, initnpctimer so you can attach a player to them, this is done because the attach/detach functions can't be used to attach to a different script than the one currently running. - Some script code cleaning - Updated the script_command reference with the new flag values of [start/stop/init]npctimer. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9872 54d463be-8e91-2dee-dedb-b68131a5f0ec --- doc/script_commands.txt | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'doc') diff --git a/doc/script_commands.txt b/doc/script_commands.txt index a6293172f..4d55df25f 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -59,6 +59,10 @@ //= 3.02.20070209 //= Corrected/updated info on Xor/setd/getd/callfunc/callsub/return and //= updated some examples to use "better" code. [FlavioJS] +//= 3.03.20070216 +//= Expanded/clarified information on npc timers, added info about the +//= new attach flag for script commands startnpctimer/ stopnpctimer/ +//= initnpctimer [Skotlex] //===== Compatible With =================================== //= LOL, can be used by anyone hopefully //===== Description ======================================= @@ -4815,9 +4819,12 @@ is. --------------------------------------- -*initnpctimer{ ""}; -*stopnpctimer{ ""}; -*startnpctimer{ ""}; +*initnpctimer{ "" {, } } | + {"" | }; +*stopnpctimer{ "" {, } } | + { "" | }; +*startnpctimer{ "" {, } } | + { "" | }; *setnpctimer {,""}; *getnpctimer({,""}); *attachnpctimer {""}; @@ -4844,17 +4851,19 @@ To create the timer, use the 'initnpctimer', which will start it running. 'stopnpctimer' will pause the timer, without clearing the current tick, while 'startnpctimer' will let the paused timer continue. -It is not quite clear whether the new invocations will always have a RID. -Apparently, the RID that was in effect when the timer was initialised will still -be attached to these executions in some cases, but it's not quite clear - -experiment with RID-dependent commands, like 'mes', and tell us what happens and -who gets the message, if anyone. - -Even if they don't have a RID by default, 'attachnpctimer' will allow you to -explicitly attach a character's RID to the timer, which will make them the -target for all character-referencing commands and functions, not to mention -variables. 'detachnpctimer' will make the RID zero, making all character- -referencing functions fail with an error. +By default timers do not have a RID attached, which lets the timers continue even +if the player that started them logs off. To attach a RID to a timer, you can +either use the "attach flag" optional value when using initnpctimer/startnpctimer, +likewise, the optional flag of stopnpctimer detaches any RID after stopping +the timer. One a player is attached to a timer, it stays attached to all +timers from that script until detached manually. You can have multiple +npctimers going on at the same time as long as each one has a different player +attached (think of each RID being used as an independant timer). + +The other method to attach/detach a RID is through the script commands +'attachnpctimer' and 'detachnpctimer'. Once attached, that will make the +character the target for all character-referencing commands and functions, +not to mention variables. 'setnpctimer' will explicitly set the timer to a given tick. To make it useful, you will need the 'getnpctimer' function, which the type of information argument -- cgit v1.2.3-70-g09d2