SMAUG release 1.4
December 15, 1996

Thoric thoric@realms.game.org


=== Commands

All commands are loaded from the file 'commands.dat' in the system directory,
and put into a hash table of linked lists of type 'struct cmd_type' defined
in 'mud.h'.

The fields of cmd_table are:

    CMDTYPE *   next;

	A pointer to the next command in this hash bucket.

    char *	name;

	The name of the command.  Command lookup is by partial matching on the
	name; the first match (which also meets level restrictions) is used.

    DO_FUN *	do_fun;

	The function for this command.  A 'do_fun' takes two arguments: the
	character who is issuing the command and the rest of the argument
	string after the command name.

    sh_int	position;

	The minimum position for using this command.

    sh_int	level;

	The minimum level for using this command.  This is usually used for
	restricting certain commands to immortals.

    sh_int	log;

	The type of logging to perform.  LOG_NORMAL commands are logged just
	when the player is logged.  LOG_ALWAYS commands are always logged.
	LOG_NEVER commands are never logged, even if the player is logged.



=== How to Add a Command

(1) Add a line for the command in 'skill_name' in tables.c
    Make sure the command starts with "do_" to keep it easy for other
    coders to find.
    Example line: if ( skill == do_mycmd ) return "do_mycmd";

(2) Add a line for the command in 'skill_function' in tables.c
    Make sure to put this in the proper location in the switch statement.
    Example line: if ( !str_cmp( name, "do_mycmd" )) return do_mycmd;

(3) Add a 'DECLARE_DO_FUN' line for the command function to 'mud.h'.

(4) Write the function and put it into an appropriate '*.c' file.

(5) Either use 'cedit <name> create' to create the command online, or
    edit the 'commands.dat' file offline to put the command in the
    appropriate location.  You can use 'cedit <name> raise' and
    'cedit <name> lower' to adjust a command's position in the hash table.

(6) Write a help section for the function.  See 'help.are' for the format of
    help entries.  We suggest you start your own file of customized help rather
    than adding into 'help.are'.  This will make it easier for you to upgrade
    to future releases of SMAUG (which will have upgraded 'help.are' files).
    SMAUG supports as many help files as you want.

That's ALL there is to it!



=== Social Commands

Social commands add to the atmosphere of the game.  The social commands are
contained in 'socials.dat' in the system directory.
The socials are loaded into a hash table of linked lists which are insert
sorted when added.

The fields of this table are:

    SOCIALTYPE * next;

	Pointer to the next social in this hash bucket.

    char *	 name;

	The name of the social command.

    char *	 char_no_arg;

	The message sent to the character when no argument is given.

    char *	 others_no_arg;

	The message sent to others when no argument is given.

    char *	 char_found;

	The message sent to the character when a victim is found.

    char *	 others_found;

	The message sent to others when a victim is found.

    char *	 vict_found;

	The message sent to the victim when a victim is found.

    char *	 char_auto;

	The message sent to the character when the victim IS the character.

    char *	 others_auto;

	The message sent to others when the victim IS the character.

All of these messages are 'act' messages and may use any '$' sequences (the
'act' function is documented in 'act.txt').  If the command is not found in the
regular command table, the function 'check_social' looks in 'social_index' for
a match.  This is the last stop before rejecting the command.

Socials without arguments, such as 'hop', may have NULL for the strings sent
when arguments are present.



=== How to Add a Social Command

(1) Use the 'sedit' command to add a social online (see 'help sedit')
    or edit 'socials.dat' offline if you wish.

That's ALL there is to it.
