mirror of
https://github.com/ldmud/ldmud
synced 2026-08-12 14:26:05 -04:00
33 lines
1.2 KiB
Text
33 lines
1.2 KiB
Text
SYNOPSIS
|
|
#include <sys/driver_hooks.h>
|
|
|
|
set_driver_hook(H_COMMAND, value)
|
|
|
|
<value> being:
|
|
|
|
int <closure>(string command, object command_giver)
|
|
int <name>(string command, object command_giver)
|
|
|
|
DESCRIPTION
|
|
Optional hook to parse and execute commands. If this hook is
|
|
used, it bypasses the normal command parsing done by the
|
|
driver (including the MODIFY_COMMAND and NOTIFY_FAIL hooks).
|
|
|
|
The hook is called with two parameters: the command received
|
|
from the living (interactive user or NPC), and the living
|
|
object (the 'command giver') itself. The hook has to return
|
|
non-0 if the command was found and executed, and 0 otherwise.
|
|
|
|
At the time the hook is called, query_command() returns the
|
|
command string and this_player() returns the living object.
|
|
query_verb() and query_notify_fail() return 0.
|
|
|
|
If the hook is a string, it is the name of an lfun in the
|
|
command giver; if the hook is a lambda closure, it is bound to
|
|
the command giver before the call.
|
|
|
|
HISTORY
|
|
|
|
SEE ALSO
|
|
hooks(C), modify_command(H), modify_command_fname(H), notify_fail(H),
|
|
send_notify_fail(H)
|