[an error occurred while processing this directive]
[<a href="index.shtml">Package Index</a></code> | <a href="index_std.shtml">Mudlib Index</a></code> | <a href="index_eff.shtml">Effect Index</a></code>]<br><h2>File /obj/handlers/smack_handler.c</h2>
Smack stands for Self-Made, Advanced Command Kit, and is a system which can
be used in the creation of meta commands, that is, commands that can make new
commands.  It works by keeping track of a list of "modules", each of which
contains a bit of Fancy Stuff the finished command can do.  Then different
modules are combined into a finished command.
This handler keeps track of what the modules are and where to find them, and
also keeps track of which players have access to which home-made commands.<p><b>See also:</b><br>/obj/smack/smack_object.c, /obj/smack/smack_module.c and /cmds/playtester/squint_.c
<br /><p>Written by Woom<p>Started October 2, 2003<h2>Inherits</h2>
This class inherits the following classes /std/room/basic_room.c<h2>Includes</h2>
This class includes the following files /include/smack.h<h2>Method index</h2>
<ul>
<li><a href="#add_known_smack">add_known_smack</a>(mixed, mixed, string, string)<br/>
This adds a smack as known to someone.
<li><a href="#add_save_call">add_save_call</a>(string, string)<br/>
Add a save call.
<li><a href="#char_to_method">char_to_method</a>(string)<br/>
This tells us the method of the module with character ch.
<li><a href="#char_to_module">char_to_module</a>(string)<br/>
Gives a certain module object
<li><a href="#char_to_path">char_to_path</a>(string)<br/>
Gives the file name of a module, based on its character.
<li><a href="#do_add">do_add</a>(string, string)<li><a href="#do_list">do_list</a>()<li><a href="#do_remove">do_remove</a>(string, string)<li><a href="#do_set">do_set</a>(string, int)<li><a href="#get_smack_object">get_smack_object</a>(string)<br/>
This returns a set up smack object, based on its buildup.
<li><a href="#method_to_char">method_to_char</a>(string, string)<br/>
This finds the character of the module with a specific method and guild.
<li><a href="#module_info">module_info</a>()<br/>
This gives information on what modules are available, as a string.
<li><a href="#player_name">player_name</a>(mixed)<br/>
Turns a player object into its name.
<li><a href="#query_all_module_methods">query_all_module_methods</a>(string)<br/>
This returns all module methods, or only those of guild g if g is specified.
<li><a href="#query_guild">query_guild</a>(string)<br/>
This tells us what guilds a specific module is registered for.
<li><a href="#query_module_chars">query_module_chars</a>(string)<br/>
This will tell us what module chars are available, or what chars of a
specific guild are available.
<li><a href="#query_module_methods">query_module_methods</a>(string)<br/>
This returns all module methods that are currently in game, or only those of
guild g if g is specified.
<li><a href="#query_pt_module_methods">query_pt_module_methods</a>(string)<br/>
This returns all module methods that are currently in playtesting, or only
those of guild g if g is specified.
<li><a href="#query_save_calls">query_save_calls</a>()<br/>
This gives a list of functions called each time the handler saves.
<li><a href="#query_smack">query_smack</a>(mixed, string, string)<br/>
This will give the store data of a particular smack in a particular player's
memory, if it exists.
<li><a href="#query_smack_names_known">query_smack_names_known</a>(mixed, string)<br/>
This tells the names of the smacks someone knows.
<li><a href="#query_smack_names_known_nocase">query_smack_names_known_nocase</a>(mixed, string)<br/>
This tells the names of the smacks someone knows, in all lower case.
<li><a href="#query_smacks_known">query_smacks_known</a>(mixed, string)<br/>
This gives a list of smacks someone knows.
<li><a href="#register_module">register_module</a>(string, string)<br/>
This registers a module with the handler.
<li><a href="#rehash">rehash</a>()<br/>
This re-registers all modules, effectively checking for changes.
<li><a href="#remove_known_smack">remove_known_smack</a>(mixed, string, string)<br/>
This makes someone forget a specific smack.
<li><a href="#remove_module">remove_module</a>(string, string)<br/>
This removes a specific module from a specific guild.
<li><a href="#remove_record">remove_record</a>(mixed)<br/>
This deletes someone's save file.
<li><a href="#remove_save_call">remove_save_call</a>(string)<br/>
Remove a save call.
<li><a href="#remove_specific_record">remove_specific_record</a>(mixed, string)<br/>
This deletes a specific list from someone's save file.
<li><a href="#reset_pt">reset_pt</a>(string)<br/>
This removes a module as being in playtesting, and makes it open to the
public.
<li><a href="#set_pt">set_pt</a>(string)<br/>
This flags a module as being in playtesting.
</ul>
<h2>Public Functions</h2>
These are functions that everyone can access.<p>
<dl>
<dt class="autodocfuncname"><a name="add_known_smack">
add_known_smack</a><pre class="autodocfuncdef">
void add_known_smack(mixed pl,
                     mixed name,
                     string build,
                     string id)
</pre><dd><br />
This adds a smack as known to someone.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
pl - The person to add the smack to, or her name<br />
name - The name of the smack to add, or the smack as a store class<br />
build - What buildup to give the smack (can be anything if name is given
as a class)<br />
id - What smack list to add it to
<br />
<br />
<br /></dl>

<dt class="autodocfuncname"><a name="add_save_call">
add_save_call</a><pre class="autodocfuncdef">
int add_save_call(string file,
                  string func)
</pre><dd><br />
Add a save call.  This is called each time the handler saves.  Good for
cleaning up caches.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
file - What file to call in<br />
func - What function to call<br />
<br />
<dd><b>Returns:</b>
<br />1 for success, 0 for failure
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="char_to_method">
char_to_method</a><pre class="autodocfuncdef">
string char_to_method(string ch)
</pre><dd><br />
This tells us the method of the module with character ch.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
ch - The character to search for<br />
<br />
<dd><b>Returns:</b>
<br />Its associated method
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="char_to_module">
char_to_module</a><pre class="autodocfuncdef">
object char_to_module(string ch)
</pre><dd><br />
Gives a certain module object<br />
<br /><dl>
<dd><b>Parameters:</b><br />
ch - The character of the module to search for<br />
<br />
<dd><b>Returns:</b>
<br />The loaded object
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="char_to_path">
char_to_path</a><pre class="autodocfuncdef">
string char_to_path(string ch)
</pre><dd><br />
Gives the file name of a module, based on its character.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
ch - The character to search for<br />
<br />
<dd><b>Returns:</b>
<br />The file name of the module
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="do_add">
do_add</a><pre class="autodocfuncdef">
int do_add(string file,
           string guild)
</pre>
<dt class="autodocfuncname"><a name="do_list">
do_list</a><pre class="autodocfuncdef">
int do_list()
</pre>
<dt class="autodocfuncname"><a name="do_remove">
do_remove</a><pre class="autodocfuncdef">
int do_remove(string mod,
              string guild)
</pre>
<dt class="autodocfuncname"><a name="do_set">
do_set</a><pre class="autodocfuncdef">
int do_set(string module,
           int onoff)
</pre>
<dt class="autodocfuncname"><a name="get_smack_object">
get_smack_object</a><pre class="autodocfuncdef">
object get_smack_object(string b)
</pre><dd><br />
This returns a set up smack object, based on its buildup.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
b - The buildup to use<br />
<br />
<dd><b>Returns:</b>
<br />The set up smack object
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="method_to_char">
method_to_char</a><pre class="autodocfuncdef">
string method_to_char(string m,
                      string g)
</pre><dd><br />
This finds the character of the module with a specific method and guild.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
m - The method to search for<br />
g - In what guild to search for the module<br />
<br />
<dd><b>Returns:</b>
<br />The found module character
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="module_info">
module_info</a><pre class="autodocfuncdef">
string module_info()
</pre><dd><br />
This gives information on what modules are available, as a string.<br />
<br /><dl>
<dd><b>Returns:</b>
<br />All sorts of information
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="player_name">
player_name</a><pre class="autodocfuncdef">
string player_name(mixed name)
</pre><dd><br />
Turns a player object into its name.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
name - The player object, or her name<br />
<br />
<dd><b>Returns:</b>
<br />The player's name
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="query_all_module_methods">
query_all_module_methods</a><pre class="autodocfuncdef">
varargs string * query_all_module_methods(string g)
</pre><dd><br />
This returns all module methods, or only those of guild g if g is specified.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
g - 0 to get all methods, a string for methods of guild g<br />
<br />
<dd><b>Returns:</b>
<br />A list of available methods
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="query_guild">
query_guild</a><pre class="autodocfuncdef">
string * query_guild(string ch)
</pre><dd><br />
This tells us what guilds a specific module is registered for.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
ch - The character of the module we want to check<br />
<br />
<dd><b>Returns:</b>
<br />A list of guilds the module is registered for
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="query_module_chars">
query_module_chars</a><pre class="autodocfuncdef">
varargs string * query_module_chars(string g)
</pre><dd><br />
This will tell us what module chars are available, or what chars of a
specific guild are available.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
g - 0 for all chars, a string for chars of guild g<br />
<br />
<dd><b>Returns:</b>
<br />A list of characters
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="query_module_methods">
query_module_methods</a><pre class="autodocfuncdef">
varargs string * query_module_methods(string g)
</pre><dd><br />
This returns all module methods that are currently in game, or only those of
guild g if g is specified.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
g - 0 to get all methods, a string for methods of guild g<br />
<br />
<dd><b>Returns:</b>
<br />A list of available methods
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="query_pt_module_methods">
query_pt_module_methods</a><pre class="autodocfuncdef">
varargs string * query_pt_module_methods(string g)
</pre><dd><br />
This returns all module methods that are currently in playtesting, or only
those of guild g if g is specified.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
g - 0 to get all methods, a string for methods of guild g<br />
<br />
<dd><b>Returns:</b>
<br />A list of available methods
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="query_save_calls">
query_save_calls</a><pre class="autodocfuncdef">
mapping query_save_calls()
</pre><dd><br />
This gives a list of functions called each time the handler saves.<br />
<br /><dl>
<dd><b>Returns:</b>
<br />A list of files, and what functions are called in them.
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="query_smack">
query_smack</a><pre class="autodocfuncdef">
class store query_smack(mixed player,
                        string smack,
                        string id)
</pre><dd><br />
This will give the store data of a particular smack in a particular player's
memory, if it exists.  It takes nicknames in account.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
player - The player to check for<br />
smack - The smack name to look for<br />
id - The smack list to look in<br />
<br />
<dd><b>Returns:</b>
<br />The store class corresponding to the name
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="query_smack_names_known">
query_smack_names_known</a><pre class="autodocfuncdef">
string * query_smack_names_known(mixed pl,
                                 string id)
</pre><dd><br />
This tells the names of the smacks someone knows.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
pl - The person to check, or her name<br />
id - The list to check in<br />
<br />
<dd><b>Returns:</b>
<br />A list with the names of the known smacks
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="query_smack_names_known_nocase">
query_smack_names_known_nocase</a><pre class="autodocfuncdef">
string * query_smack_names_known_nocase(mixed pl,
                                        string id)
</pre><dd><br />
This tells the names of the smacks someone knows, in all lower case.  It's a
bit more economic than lower-casing the above function.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
pl - The person to check, or her name<br />
id - The list to check in<br />
<br />
<dd><b>Returns:</b>
<br />A list with the names of the known smacks
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="query_smacks_known">
query_smacks_known</a><pre class="autodocfuncdef">
class store * query_smacks_known(mixed name,
                                 string id)
</pre><dd><br />
This gives a list of smacks someone knows.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
name - The person to check, or her name<br />
id - What list of smacks to fetch<br />
<br />
<dd><b>Returns:</b>
<br />A list of smacks known
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="register_module">
register_module</a><pre class="autodocfuncdef">
int register_module(string file,
                    string g)
</pre><dd><br />
This registers a module with the handler.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
file - Where to find the module<br />
g - What guild to register it for<br />
<br />
<dd><b>Returns:</b>
<br />1 if it succeeds, 0 if it fails
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="rehash">
rehash</a><pre class="autodocfuncdef">
int rehash()
</pre><dd><br />
This re-registers all modules, effectively checking for changes.  This
shouldn't be called too often...<br />
<br /><dl>
<dd><b>Returns:</b>
<br />The number of modules that were removed from the handler.
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="remove_known_smack">
remove_known_smack</a><pre class="autodocfuncdef">
string remove_known_smack(mixed pl,
                          string name,
                          string id)
</pre><dd><br />
This makes someone forget a specific smack.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
pl - The person whose mind we want to alter, or her name<br />
name - The name of the smack to remove<br />
id - The smack list to remove it from<br />
<br />
<dd><b>Returns:</b>
<br />The correctly capitalised name of the smack removed, or 0 if it
failed
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="remove_module">
remove_module</a><pre class="autodocfuncdef">
void remove_module(string ch,
                   string g)
</pre><dd><br />
This removes a specific module from a specific guild.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
ch - The module character<br />
g - The guild to remove it from
<br />
<br />
<br /></dl>

<dt class="autodocfuncname"><a name="remove_record">
remove_record</a><pre class="autodocfuncdef">
void remove_record(mixed person)
</pre><dd><br />
This deletes someone's save file.  Used by the refresh handler.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
person - The person whose data to delete, or her name
<br />
<br />
<br /></dl>

<dt class="autodocfuncname"><a name="remove_save_call">
remove_save_call</a><pre class="autodocfuncdef">
int remove_save_call(string file)
</pre><dd><br />
Remove a save call.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
file - What save call to remove<br />
<br />
<dd><b>Returns:</b>
<br />1 for success, 0 for failure
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="remove_specific_record">
remove_specific_record</a><pre class="autodocfuncdef">
void remove_specific_record(mixed person,
                            string id)
</pre><dd><br />
This deletes a specific list from someone's save file.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
person - The person whose data to delete, or her name<br />
id - The list to remove
<br />
<br />
<br /></dl>

<dt class="autodocfuncname"><a name="reset_pt">
reset_pt</a><pre class="autodocfuncdef">
int reset_pt(string ch)
</pre><dd><br />
This removes a module as being in playtesting, and makes it open to the
public.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
ch - The character of the module we want to change the status of<br />
<br />
<dd><b>Returns:</b>
<br />1 if status was changed, otherwise 0
<br /><br />
<br /></dl>

<dt class="autodocfuncname"><a name="set_pt">
set_pt</a><pre class="autodocfuncdef">
int set_pt(string ch)
</pre><dd><br />
This flags a module as being in playtesting.<br />
<br /><dl>
<dd><b>Parameters:</b><br />
ch - The character of the module we want to change the status of<br />
<br />
<dd><b>Returns:</b>
<br />1 if status was changed, otherwise 0
<br /><br />
<br /></dl>

</dl>
[an error occurred while processing this directive]

