hookctl
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | hookctl [2008/10/17 15:02] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | === ADDING AND REMOVING HOOKS === | ||
+ | $hookctl(ADD [# | ||
+ | [(<arg list>)] < | ||
+ | Compare this to: | ||
+ | /ON [# | ||
+ | |||
+ | Where [#] is used to indicate a < | ||
+ | where [!] is used to indicate that the ON is a " | ||
+ | where ['] is used to indicate that the ON is a " | ||
+ | where [< | ||
+ | where [< | ||
+ | where [< | ||
+ | where [< | ||
+ | matched against $* each time the ON is checked | ||
+ | where [< | ||
+ | is run. | ||
+ | |||
+ | ADD registers a new /ON and returns the /ON's new < | ||
+ | < | ||
+ | |||
+ | Example: $hookctl(ADD ^MSG * (nick, msg) {echo msg from $nick: $msg}) | ||
+ | is the same as | ||
+ | /ON ^MSG * (nick, msg) {echo msg from $nick: $msg} | ||
+ | | ||
+ | |||
+ | $hookctl(REMOVE < | ||
+ | Delete the given /ON. If < | ||
+ | executing /ON. | ||
+ | |||
+ | $hookctl(SET LIST < | ||
+ | A lot of people create a large number of on hooks that look like: | ||
+ | ON ^TYPE * { echo $cparse($format[type]) } | ||
+ | for each TYPE. Since all of these ONs are otherwise identical, | ||
+ | they clutter up the /on list, and managing all of the variables | ||
+ | is a hassle. | ||
+ | " | ||
+ | |||
+ | You can now set a format with | ||
+ | $hookctl(SET LIST < | ||
+ | and if you don't have an /ON < | ||
+ | echo $cparse(< | ||
+ | and suppress the normal output. | ||
+ | |||
+ | You may surround < | ||
+ | hell. Match sure to keep your {}s matched up if you do so. | ||
+ | |||
+ | Here' | ||
+ | (Two-expansion implied hooks work through a /set that is | ||
+ | exposed to the user for changing) | ||
+ | @ hook = ' | ||
+ | @ fmt = '< | ||
+ | addset format_$hook str | ||
+ | @ hookctl(set list $hook implied \\$var) | ||
+ | set format_$hook $fmt | ||
+ | Then, whenever the user changes /set format_send_public, | ||
+ | automatically reflect how /on send_public events are displayed. | ||
+ | See the " | ||
+ | |||
+ | Here' | ||
+ | @ hookctl(set list send_public implied {< | ||
+ | Because this does not expose a variable to the user, the user | ||
+ | cannot change it directly. | ||
+ | (such as an /fset alias) for the user to update this value. | ||
+ | |||
+ | === WORKING WITH THE ONs YOU'VE CREATED === | ||
+ | -- In these GET HOOK operations, the values in <> are the values that | ||
+ | were originally provided to the ADD operation (or the /ON command) | ||
+ | < | ||
+ | | ||
+ | |||
+ | $hookctl(GET HOOK < | ||
+ | Return an /ON's < | ||
+ | |||
+ | $hookctl(GET HOOK < | ||
+ | Return 1 if /ON was created with ['] (flexible -- < | ||
+ | expanded each time the /ON is checked) | ||
+ | Return 0 if not. | ||
+ | |||
+ | $hookctl(GET HOOK < | ||
+ | Return an /ON's < | ||
+ | |||
+ | $hookctl(GET HOOK < | ||
+ | Return 1 if /ON was created with [!] (negative on) | ||
+ | Return 0 if not. | ||
+ | |||
+ | $hookctl(GET HOOK < | ||
+ | $hookctl(GET HOOK < | ||
+ | Return an /ON's < | ||
+ | |||
+ | $hookctl(GET HOOK < | ||
+ | Return an /ON's </ | ||
+ | |||
+ | $hookctl(GET HOOK < | ||
+ | Return an /ON's < | ||
+ | |||
+ | $hookctl(GET HOOK < | ||
+ | Return 1 if the /ON is being " | ||
+ | (" | ||
+ | $hookctl(GET HOOK <ref> STRING) | ||
+ | Returns a string that is suitable for passing to /eval {....} to | ||
+ | recreate the hook. This will be used by scripts that want to | ||
+ | "/ | ||
+ | be able to /load it later. | ||
+ | |||
+ | $hookctl(GET HOOK < | ||
+ | Return an /ON's < | ||
+ | (" | ||
+ | |||
+ | $hookctl(GET HOOK < | ||
+ | Return an /ON's < | ||
+ | |||
+ | -- In these SET HOOK operations, if you attempt to change a value so it | ||
+ | | ||
+ | | ||
+ | howl how he handled this. | ||
+ | |||
+ | $hookctl(SET HOOK < | ||
+ | Clear an /ON's argument list (so it no longer takes one) | ||
+ | |||
+ | $hookctl(SET HOOK < | ||
+ | Replace an /ON's argument list | ||
+ | |||
+ | $hookctl(SET HOOK < | ||
+ | Clear (or set) an /ON's flexible-pattern attribute | ||
+ | |||
+ | $hookctl(SET HOOK < | ||
+ | Change an /ON's < | ||
+ | per serial number with the exact same < | ||
+ | |||
+ | $hookctl(SET HOOK < | ||
+ | Clear (or set) an /ON's " | ||
+ | |||
+ | $hookctl(SET HOOK < | ||
+ | $hookctl(SET HOOK < | ||
+ | Change an /ON's < | ||
+ | the noise' | ||
+ | Example: $hookctl(SET HOOK 147 NOISE SILENT) | ||
+ | and $hookctl(SET HOOK 147 NOISE 1) do the same thing. | ||
+ | | ||
+ | $hookctl(SET HOOK < | ||
+ | Change an /ON's </ | ||
+ | |||
+ | $hookctl(SET HOOK < | ||
+ | Change an /ON's < | ||
+ | /ON per serial number with the exact same < | ||
+ | |||
+ | $hookctl(SET HOOK < | ||
+ | Clear (or set) an /ON's skippable attribute. | ||
+ | " | ||
+ | deleted. | ||
+ | |||
+ | $hookctl(SET HOOK < | ||
+ | Change the ircII commands executed when an /ON goes off. | ||
+ | |||
+ | |||
+ | === GETTING INFORMATION ABOUT ON TYPES === | ||
+ | $hookctl(LIST) | ||
+ | $hookctl(LIST LISTS) | ||
+ | Return all of the valid < | ||
+ | |||
+ | $hookctl(LIST LISTS < | ||
+ | Return all of the valie < | ||
+ | Ex: $hookctl(LIST LISTS g*) returns " | ||
+ | |||
+ | $hookctl(LIST POPULATED_LISTS) | ||
+ | Return all of the valid < | ||
+ | |||
+ | $hookctl(LIST POPULATED_LISTS < | ||
+ | Return all of the valid < | ||
+ | /ON registered for them. | ||
+ | |||
+ | $hookctl(LIST HOOKS) | ||
+ | Return all of the registered < | ||
+ | |||
+ | $hookctl(LIST HOOKS < | ||
+ | Return all registered < | ||
+ | Ex: $hookctl(LIST HOOKS MSG) returns the refnums of your /ON MSG's | ||
+ | |||
+ | $hookctl(FIRST_NAMED_HOOK) | ||
+ | Return the number such that | ||
+ | $word($hookctl(FIRST_NAMED_HOOK) $hookctl(LIST)) | ||
+ | returns the first non-numeric /ON type. | ||
+ | |||
+ | $hookctl(NUMBER_OF_LISTS) | ||
+ | $hookctl(COUNT) | ||
+ | $hookctl(COUNT LISTS) | ||
+ | Return the number of items in $hookctl(LIST) | ||
+ | |||
+ | $hookctl(COUNT LISTS < | ||
+ | Return the number of items in $hookctl(LIST LISTS < | ||
+ | |||
+ | $hookctl(COUNT POPULATED_LISTS) | ||
+ | Return the number of items in $hookctl(LIST POPULATED_LISTS) | ||
+ | |||
+ | $hookctl(COUNT POPULATED_LISTS < | ||
+ | Return the number of items in $hookctl(LIST POPULATED_LISTS < | ||
+ | |||
+ | $hookctl(COUNT HOOKS) | ||
+ | Return the number of items in $hookctl(LIST HOOKS) | ||
+ | |||
+ | $hookctl(COUNT HOOKS < | ||
+ | Return the number of items in $hookctl(LIST HOOKS < | ||
+ | $hookctl(GET LIST < | ||
+ | This just returns < | ||
+ | |||
+ | $hookctl(GET LIST < | ||
+ | Return the mininum number of words in $* for any /ON of this type. | ||
+ | Remember that your < | ||
+ | AT LEAST this number of words. | ||
+ | will never go off. | ||
+ | |||
+ | $hookctl(GET LIST < | ||
+ | Return the number of invocations of this /ON type are pending. | ||
+ | For example, the first time an /ON MSG event is thrown, then | ||
+ | $hookctl(GET LIST MSG MARK) is 1. If your /ON does something | ||
+ | funky like a /WAIT and another MSG comes in before your /ON is | ||
+ | finished, then $hookctl(GET LIST MSG MARK) is 2. | ||
+ | |||
+ | $hookctl(GET LIST < | ||
+ | This is an internal bitmask value. | ||
+ | is used to prevent an /ON from going off recursively. | ||
+ | is /ON INPUT. | ||
+ | /ON INPUT event is thrown, no /ON's will actually be executed; the | ||
+ | ON is considered unhooked. | ||
+ | commands (like /sendline) from within certain /ON's (like /on input) | ||
+ | where without this flag that would result in infinite recursion | ||
+ | (and crash) | ||
+ | === GETTING INFORMATION ABOUT NOISE TYPES === | ||
+ | $hookctl(DEFAULT_NOISE_LEVEL) | ||
+ | This always returns " | ||
+ | VALUE (see below) is the null character. | ||
+ | |||
+ | $hookctl(NOISE_LEVELS) | ||
+ | This returns all of the < | ||
+ | Ex: $hookctl(NOISE_LEVELS) returns " | ||
+ | |||
+ | $hookctl(NOISE_LEVELS < | ||
+ | This returns all of the < | ||
+ | Ex: $hookctl(NOISE LEVELS s*) returns " | ||
+ | |||
+ | $hookctl(NOISE_LEVEL_NUM) | ||
+ | This returns the highest < | ||
+ | |||
+ | In the GET NOISE operations, < | ||
+ | flag. This is one of " | ||
+ | " | ||
+ | of the noise types. | ||
+ | respectively. | ||
+ | |||
+ | $hookctl(GET NOISE < | ||
+ | Get the name of the noise type. One of " | ||
+ | " | ||
+ | |||
+ | $hookctl(GET NOISE < | ||
+ | Returns 0 if the noise type does a /SET DISPLAY OFF while | ||
+ | executing the /ON body. | ||
+ | Returns 1 if /SET DISPLAY is not changed when the /ON goes off. | ||
+ | |||
+ | $hookctl(GET NOISE < | ||
+ | Returns 0 if you are not told when the /ON is executed. | ||
+ | Returns 1 if you are told whenever the /ON is executed. | ||
+ | |||
+ | $hookctl(GET NOISE < | ||
+ | Preface: | ||
+ | are appropriate to run, then some " | ||
+ | be taken. | ||
+ | Returns 0 if executing the /ON does not cause the " | ||
+ | to be suppressed. | ||
+ | Returns 1 if executing the /ON causes the " | ||
+ | suppressed. | ||
+ | |||
+ | $hookctl(GET NOISE < | ||
+ | Returns the refnum of the noise type. | ||
+ | Example: $hookctl(GET NOISE SILENT VALUE) returns " | ||
+ | |||
+ | $hookctl(GET NOISE < | ||
+ | Returns the < | ||
+ | Example: $hookctl(GET NOISE SILENT IDENTIFIER) returns " | ||
+ | |||
+ | $hookctl(GET NOISE < | ||
+ | This always returns 0 for now. | ||
+ | === MISCELLANEOUS OPERATIONS === | ||
+ | $hookctl(EXECUTING_HOOKS) | ||
+ | This returns the refnums of all of the hooks that are currently | ||
+ | pending (executing). | ||
+ | word is the current /ON, and the second word is the /ON that is waiting | ||
+ | for the first one to finish, etc. | ||
+ | operate on an /ON from within itsself whenever it goes off. | ||
+ | |||
+ | $hookctl(HALTCHAIN < | ||
+ | $hookctl(DENY_ALL_HOOKS) | ||
+ | $hookctl(DENY_ALL_HOOKS 1) | ||
+ | $hookctl(DENY_ALL_HOOKS 0) | ||
+ | $hookctl(EMPTY_SLOTS) | ||
+ | $hookctl(HOOKLIST_SIZE) | ||
+ | $hookctl(LAST_CREATED_HOOK) | ||
+ | $hookctl(PACKAGE < | ||
+ | $hookctl(SERIAL < | ||
+ | $hookctl(RETVAL) | ||
+ | $hookctl(RETVAL < | ||
+ | $hookctl(LOOKUP < | ||
+ | $hookctl(MATCH < | ||
hookctl.txt · Last modified: 2008/10/17 15:02 by 127.0.0.1