blob: de1b6093ee491a7232e2fe003bba1454e004dadc [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
2 #include <sys/driver_hooks.h>
3
4 set_driver_hook(H_COMMAND, value)
5
6 <value> being:
7
8 int <closure>(string command, object command_giver)
9 int <name>(string command, object command_giver)
10
11DESCRIPTION
12 Optional hook to parse and execute commands. If this hook is
13 used, it bypasses the normal command parsing done by the
14 driver (including the MODIFY_COMMAND and NOTIFY_FAIL hooks).
15
16 The hook is called with two parameters: the command received
17 from the living (interactive user or NPC), and the living
18 object (the 'command giver') itself. The hook has to return
19 non-0 if the command was found and executed, and 0 otherwise.
20
21 At the time the hook is called, query_command() returns the
22 command string and this_player() returns the living object.
23 query_verb() and query_notify_fail() return 0.
24
25 If the hook is a string, it is the name of an lfun in the
26 command giver; if the hook is a lambda closure, it is bound to
27 the command giver before the call.
28
29HISTORY
30
31SEE ALSO
32 hooks(C), modify_command(H), modify_command_fname(H), notify_fail(H),
33 send_notify_fail(H)