<html> <head> <title>Commands and Socials</title> <link rel="stylesheet" type="text/css" href="doc.css" title="Documentation Standard Style"> </head> <body bgcolor="#ffffff"> <table class="main" width="600" border="0"> <tr><td> <div align="right"> DalekenMUD 1.12 documentation. <br>Updated 7 June 2000. <br>Based on original Envy 2.2 documentation. </div> </td></tr> <tr><th class="heading"> <h1>Commands and Socials</h1> </th></tr> <tr><td> <p>This document describes how to add and modify commands and socials within DalekenMUD.</p> </td></tr> <tr><th class="heading"> <h2>Commands</h2> </th></tr> <tr><td> <p>The central organizing table for skills is <code>cmd_table</code>, an array of type <code>struct cmd_type</code>, and is defined in <code>interp.c</code>. This table is ordered firstly by how commonly used a command is, and secondly within groups of equally used commands the commands are sorted alphabetically. Immortal commands are placed at the bottom of the table.</p> <p>The fields of <code>cmd_table</code> are:</p> <dl> <dt><code>char *name;</code></dt> <dd> The name of the command. Command lookup is by partial matching on the name; the first match (which also meets level restrictions) is used. </dd> <dt><code>DO_FUN *do_fun;</code></dt> <dd> The function for this command. A <code>do_fun</code> takes two arguments: the character who is issuing the command and the rest of the argument string after the command name. There are a list of these functions declared in <code>function.h</code> and you can find these functions throughout a majority of the source. </dd> <dt><code>int position;</code></dt> <dd> The minimum position for using this command. </dd> <dt><code>int level;</code></dt> <dd> The minimum level for using this command. This is usually used for restricting certain commands to immortals. </dd> <dt><code>int log;</code></dt> <dd> The type of logging to perform. <code>LOG_NORMAL</code> commands are logged just when the player is logged. <code>LOG_ALWAYS</code> commands are always logged. <code>LOG_NEVER</code> commands are never logged, even if the player is logged. </dd> </dl> </td></tr> <tr><th class="heading"> <h2>How to Add a Command</h2> </th></tr> <tr><td> <ol> <li>Add a line for the command in <code>cmd_table</code> in <code>interp.c</code>.</li> <li>Add a <code>DECLARE_DO_FUN</code> line for the command function to <code>function.h</code>.</li> <li> Write the function and put it into an appropriate file (usually an <code>act_****.c</code> file). <li>Write a help section for the function. See <code>help.are</code> for the format of help entries. We suggest you start your own file of customized help rather than adding into <code>help.are</code>. This will make it easier for you to upgrade to future releases of Daleken (which will have upgraded <code>help.are</code> files). The area file format allows you to have helps in any area file.</li> </ol> <p>That's ALL there is to it!</p> </dd> </dl> </td></tr> <tr><th class="heading"> <h2>Social Commands</h2> </th></tr> <tr><td> <p>Socials have the following fields.</p> <dl> <dt><code>char *name;</dt></code> <dd> The name of the social command. </dd> <dt><code>char *char_no_arg;</dt></code> <dd> The message sent to the character when no argument is given. </dd> <dt><code>char *others_no_arg;</dt></code> <dd> The message sent to others when no argument is given. </dd> <dt><code>char *char_found;</dt></code> <dd> The message sent to the character when a victim is found. </dd> <dt><code>char *others_found;</dt></code> <dd> The message sent to others when a victim is found. </dd> <dt><code>char *vict_found;</dt></code> <dd> The message sent to the victim when a victim is found. </dd> <dt><code>char *char_auto;</dt></code> <dd> The message sent to the character when the victim IS the character. </dd> <dt><code>char *others_auto;</dt></code> <dd> The message sent to others when the victim IS the character. </dd> </dl> <p>All of these messages are <a href="act.html">act</a> messages and may use any <code>$</code> sequences (the <code>act</code> function is documented in <a href="act.html">act.html</a>). If the command is not found in the regular command table, the function <code>check_social</code> looks for a social that matches. This is the last stop before rejecting the command.</p> </td></tr> <tr><th class="heading"> <h2>How to Add a Social Command</h2> </th></tr> <tr><td> Write a new section into social.are or any area you like (<a href="darea.html">darea.html</a>). The sections need not be alphabetized. <blockquote> OR </blockquote> Use the online social creation system, <code>sedit create</code>. (Read the online documentation on sedit.) </td></tr> </table> </body> </html>