<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="http://wiki.lostsouls.org/w/skins/common/feed.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>Man hook list - Revision history</title>
		<link>http://wiki.lostsouls.org/w/index.php?title=Man_hook_list&amp;action=history</link>
		<description>Revision history for this page on the wiki</description>
		<language>en</language>
		<generator>MediaWiki 1.8.2</generator>
		<lastBuildDate>Sat, 11 Apr 2026 13:11:21 GMT</lastBuildDate>
		<item>
			<title>Laine at 21:48, 11 June 2007</title>
			<link>http://wiki.lostsouls.org/w/index.php?title=Man_hook_list&amp;diff=3987&amp;oldid=prev</link>
			<description>&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Synopsis==&lt;br /&gt;
&lt;br /&gt;
This document lists the hooks available via the hooks mechanism, what&lt;br /&gt;
objects acknowledge them, and the arguments provided to them.&lt;br /&gt;
&lt;br /&gt;
==Files==&lt;br /&gt;
 /mod/basic/hooks.c&lt;br /&gt;
 /lib/hooks.h&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
There are seven types of hooks: Can, Do, Fail, Mod, Poll, Value, At, and&lt;br /&gt;
Revise hooks.  Each hook begins with one of these classifications.  All&lt;br /&gt;
Can hooks have Do and Fail hooks which corresponds to them.&lt;br /&gt;
&lt;br /&gt;
Can hooks control whether an event can take place.  In general, they are&lt;br /&gt;
expected to have a return value of 1, for allowing the action to take&lt;br /&gt;
place, 0, for denying the action, or a string or message array, for&lt;br /&gt;
denying the action with the return value providing an error message.&lt;br /&gt;
Any special properties of return values are noted in the description of&lt;br /&gt;
the individual hook.&lt;br /&gt;
&lt;br /&gt;
IMPORTANT NOTE: It is very important not to *do* things in Can_ hooks.&lt;br /&gt;
That includes issuing messages other than by return value, moving things,&lt;br /&gt;
harming people, or anything else.  If you need to do anything like that,&lt;br /&gt;
and the choice of whether you need to do it has to be made in the Can_&lt;br /&gt;
hook, use a global variable to signal to a corresponding Do_ or Fail_&lt;br /&gt;
hook and execute the action there.  This is VERY IMPORTANT.  The reason&lt;br /&gt;
is that Can_ hooks are SPECIFICALLY MEANT to be able to be called merely&lt;br /&gt;
to *find out* if an action would theoretically be possible.  That means&lt;br /&gt;
that when a Can_ hook is called, you DO NOT KNOW whether the action is&lt;br /&gt;
actually taking place, so having consequences to it occur may be utterly&lt;br /&gt;
inappropriate.&lt;br /&gt;
&lt;br /&gt;
Do hooks are called to indicate that an event has taken place or, in some&lt;br /&gt;
cases, is imminently about to take place.  Their return values are usually,&lt;br /&gt;
but not always, ignored.  Any action taken based on their return values&lt;br /&gt;
will be specified in the hook's documentation.&lt;br /&gt;
&lt;br /&gt;
Fail hooks are called to indicate that an event has failed.  Depending&lt;br /&gt;
on the individual implementation, this may mean specifically that a Can&lt;br /&gt;
hook has prevented the event, or other failure modes may trigger the hook.&lt;br /&gt;
As with Do hooks, return values are usually ignored, but if not, this will&lt;br /&gt;
be described in the hook's documentation.&lt;br /&gt;
&lt;br /&gt;
Mod hooks usually affect the numerical values associated with an event;&lt;br /&gt;
e.g. the amount of damage inflicted by a weapon hit, the chance of success&lt;br /&gt;
at picking a lock or breaking a door.  As they can be used to accumulate&lt;br /&gt;
other addable values, such as arrays, they can also be used in the process&lt;br /&gt;
of building object lists and so forth.&lt;br /&gt;
&lt;br /&gt;
Value hooks resemble Mod hooks, except that they only allow one value to be&lt;br /&gt;
returned.  They are mainly used by lib core applications.&lt;br /&gt;
&lt;br /&gt;
Poll hooks resemble Value hooks, but rather than simply using the first&lt;br /&gt;
nonzero value encountered, a &amp;quot;vote&amp;quot; is taken among all the hooks, with the&lt;br /&gt;
value which receives the most &amp;quot;votes&amp;quot; winning.&lt;br /&gt;
&lt;br /&gt;
At hooks are identical to Do hooks except in that they have no&lt;br /&gt;
corresponding Can and Fail hooks.  They exist so notification hooks&lt;br /&gt;
can be properly defined for events cannot feasibly or appropriatly be&lt;br /&gt;
made preventable.&lt;br /&gt;
&lt;br /&gt;
Revise hooks are something like Mod or Poll hooks, but work by continually&lt;br /&gt;
modifying a given value.  The return value of each hook is considered to&lt;br /&gt;
be the desired modification of this value.  The current value being&lt;br /&gt;
revised is passed as the first argument to the hook functions, before any&lt;br /&gt;
other arguments normally used by the hook.&lt;br /&gt;
&lt;br /&gt;
The full list of lib-wide hooks is defined by /lib/hooks.h.  Not all hooks&lt;br /&gt;
defined are necessarily implemented.  Hooks in the following list can be&lt;br /&gt;
considered implemented.  Each has its own man page for further information;&lt;br /&gt;
note that the man pages use the lower case version of the name (so you&lt;br /&gt;
should type e.g. 'man can_act' rather than 'man Can_Act').&lt;br /&gt;
&lt;br /&gt;
The lib-wide hooks are designated using integer macros.  The hooks support&lt;br /&gt;
also allows strings to be used to designate &amp;quot;local hooks&amp;quot;; this is intended&lt;br /&gt;
to be used by limited-scope applications for which it would not be&lt;br /&gt;
appropriate to define a lib-wide hook.  Hooks of this type should use a&lt;br /&gt;
name that looks like &amp;quot;can_xxx_yyy&amp;quot;, &amp;quot;do_xxx_yyy&amp;quot;, and so on, where xxx is&lt;br /&gt;
an indicator of the context (e.g. &amp;quot;ring&amp;quot;, &amp;quot;figurine&amp;quot;, &amp;quot;Project_Monster&amp;quot;)&lt;br /&gt;
and yyy is a description of the action of the hook.  The type of a local&lt;br /&gt;
hook is determined by the letter the name begins with:&lt;br /&gt;
&lt;br /&gt;
    'a' : At hook&lt;br /&gt;
    'c' : Can hook&lt;br /&gt;
    'd' : Do hook&lt;br /&gt;
    'f' : Fail hook&lt;br /&gt;
    'm' : Mod hook&lt;br /&gt;
    'p' : Poll hook&lt;br /&gt;
    'v' : Value hook&lt;br /&gt;
&lt;br /&gt;
Hooks beginning with other letters are also treated as Mod hooks, but it&lt;br /&gt;
is not recommended that you take advantage of this, as it could change.&lt;br /&gt;
&lt;br /&gt;
Can_Act&lt;br /&gt;
Can_Ammo_Launch_Move&lt;br /&gt;
Can_Attack&lt;br /&gt;
Can_Attack_In&lt;br /&gt;
Can_Be_Attacked&lt;br /&gt;
Can_Be_Closed&lt;br /&gt;
Can_Be_Friend&lt;br /&gt;
Can_Be_Linkdead&lt;br /&gt;
Can_Be_Locked&lt;br /&gt;
Can_Be_Opened&lt;br /&gt;
Can_Be_Unlocked&lt;br /&gt;
Can_Block_Exit&lt;br /&gt;
Can_Die&lt;br /&gt;
Can_Equip_Item&lt;br /&gt;
Can_Fight&lt;br /&gt;
Can_Go_Direction&lt;br /&gt;
Can_Have_Limb_Disabled&lt;br /&gt;
Can_Have_Limb_Restored&lt;br /&gt;
Can_Have_Limb_Severed&lt;br /&gt;
Can_Have_Lock_Picked&lt;br /&gt;
Can_Hear&lt;br /&gt;
Can_Heart_Beat&lt;br /&gt;
Can_Launch_Move&lt;br /&gt;
Can_Look_Direction&lt;br /&gt;
Can_Move&lt;br /&gt;
Can_Move_In&lt;br /&gt;
Can_Move_Out&lt;br /&gt;
Can_Obey&lt;br /&gt;
Can_Perform_Close&lt;br /&gt;
Can_Perform_Lock&lt;br /&gt;
Can_Perform_Obey&lt;br /&gt;
Can_Perform_Open&lt;br /&gt;
Can_Perform_Pick_Lock&lt;br /&gt;
Can_Perform_Unlock&lt;br /&gt;
Can_Quit&lt;br /&gt;
Can_Unequip_Item&lt;br /&gt;
&lt;br /&gt;
Do_Act&lt;br /&gt;
Do_Ammo_Launch_Move&lt;br /&gt;
Do_Attack&lt;br /&gt;
Do_Attack_In&lt;br /&gt;
Do_Be_Attacked&lt;br /&gt;
Do_Be_Closed&lt;br /&gt;
Do_Be_Friend&lt;br /&gt;
Do_Be_Linkdead&lt;br /&gt;
Do_Be_Locked&lt;br /&gt;
Do_Be_Opened&lt;br /&gt;
Do_Be_Unlocked&lt;br /&gt;
Do_Block_Exit&lt;br /&gt;
Do_Die&lt;br /&gt;
Do_Equip_Item&lt;br /&gt;
Do_Fight&lt;br /&gt;
Do_Go_Direction&lt;br /&gt;
Do_Have_Limb_Disabled&lt;br /&gt;
Do_Have_Limb_Restored&lt;br /&gt;
Do_Have_Limb_Severed&lt;br /&gt;
Do_Have_Lock_Picked&lt;br /&gt;
Do_Hear&lt;br /&gt;
Do_Heart_Beat&lt;br /&gt;
Do_Launch_Move&lt;br /&gt;
Do_Look_Direction&lt;br /&gt;
Do_Move&lt;br /&gt;
Do_Move_In&lt;br /&gt;
Do_Move_Out&lt;br /&gt;
Do_Obey&lt;br /&gt;
Do_Perform_Close&lt;br /&gt;
Do_Perform_Lock&lt;br /&gt;
Do_Perform_Obey&lt;br /&gt;
Do_Perform_Open&lt;br /&gt;
Do_Perform_Pick_Lock&lt;br /&gt;
Do_Perform_Unlock&lt;br /&gt;
Do_Quit&lt;br /&gt;
Do_Unequip_Item&lt;br /&gt;
&lt;br /&gt;
Fail_Act&lt;br /&gt;
Fail_Attack&lt;br /&gt;
Fail_Attack_In&lt;br /&gt;
Fail_Be_Attacked&lt;br /&gt;
Fail_Be_Closed&lt;br /&gt;
Fail_Be_Friend&lt;br /&gt;
Fail_Be_Locked&lt;br /&gt;
Fail_Be_Opened&lt;br /&gt;
Fail_Be_Unlocked&lt;br /&gt;
Fail_Block_Exit&lt;br /&gt;
Fail_Die&lt;br /&gt;
Fail_Equip_Item&lt;br /&gt;
Fail_Fight&lt;br /&gt;
Fail_Go_Direction&lt;br /&gt;
Fail_Have_Limb_Disabled&lt;br /&gt;
Fail_Have_Limb_Restored&lt;br /&gt;
Fail_Have_Limb_Severed&lt;br /&gt;
Fail_Have_Lock_Picked&lt;br /&gt;
Fail_Hear&lt;br /&gt;
Fail_Heart_Beat&lt;br /&gt;
Fail_Obey&lt;br /&gt;
Fail_Perform_Close&lt;br /&gt;
Fail_Perform_Lock&lt;br /&gt;
Fail_Perform_Obey&lt;br /&gt;
Fail_Perform_Open&lt;br /&gt;
Fail_Perform_Pick_Lock&lt;br /&gt;
Fail_Perform_Unlock&lt;br /&gt;
Fail_Unequip_Item&lt;br /&gt;
&lt;br /&gt;
Mod_Absorb_Damage&lt;br /&gt;
Mod_Ammo_Inflict_Damage&lt;br /&gt;
Mod_Attack_Cycle&lt;br /&gt;
Mod_Comprehend_Language&lt;br /&gt;
Mod_Destination&lt;br /&gt;
Mod_Friendship&lt;br /&gt;
Mod_Inflict_Damage&lt;br /&gt;
Mod_Obedience&lt;br /&gt;
Mod_Pick_Lock&lt;br /&gt;
&lt;br /&gt;
At_Update_Configuration&lt;br /&gt;
At_Incarnate&lt;/div&gt;</description>
			<pubDate>Mon, 11 Jun 2007 21:48:19 GMT</pubDate>			<dc:creator>Laine</dc:creator>			<comments>http://wiki.lostsouls.org/Talk:Man_hook_list</comments>		</item>
	</channel>
</rss>