TinyMUX

@hook

Commands

Command: @hook/<switch(s)> <command/attribute>

This command will set up ‘hooks’ to be applied to various commands or attributes. You may specify multiple hooks on items. The HOOK_OBJ is an @admin param that specifies the hook object. The following hooks exist:

/before    - Set up a BEFORE hook which will execute before the
             corresponding built-in command/attribute is executed.
             The HOOK_OBJ attribute is b_<command>.

/after     - Set up an AFTER hook on a command which will execute
             after the corresponding built-in command/attribute is
             executed.  The HOOK_OBJ attribute is a_<command>.

/permit    - Affects command permission.  Return BOOLEAN TRUE to
             permit. Return FALSE to notify the enactor with
             'Permission denied.'.  The HOOK_OBJ attribute is
             p_<command>.

/ignore    - Return BOOLEAN FALSE to ignore the corresponding
             built-in command.  Any matching softcoded commands
             continue to be handled.  The HOOK_OBJ attribute is
             i_<command>.

/igswitch  - Specifies that any non-matching /switch to the command
             falls through and is handled by softcode.  This allows
             you to softcode switches to built-in commands.

/fail      - Set up a FAIL hook which executes if the command is
             somehow block by a @hook/permit or @icmd/disable.
             The HOOK_OBJ attribute is af_<command>.

/args      - Set up a ARGS hook which will execute once per
             argument passed to a built-in command. %0 is the first
             argument, %1 is the second argument, %2 is the
             argument in a list, %3 is which argument (starting
             at 0 with list arguments starting at 2), and %4 is the
             list of switches passed verbatim.

/clear     - When used in junction with any of the above switches,
             will clear the hook from being applied.

/list      - This lists the current commands/attributes with hooks.

Examples of @hook are as follows:

> @hook/before look
@hook: new mask for 'look' -> before
> @hook/after look
@hook: new mask for 'look' -> before after
> @hook/igswitch look
@hook: new mask for 'look' -> before after igswitch
> @hook/igswitch/clear look
@hook: new mask for 'look' -> before after
> @hook/list (or just @hook will work)
---------------------------------+---------------------------------------
Built-in Command                 | Hook Mask Values
---------------------------------+---------------------------------------
look                             | before after
---------------------------------+---------------------------------------
Built-in Attribute               | Hook Mask Values
---------------------------------+---------------------------------------
                           -- No @hooks defined --
---------------------------------+---------------------------------------

Related Topics: hook_obj, hook_cmd, HOOK SETUP.