DalekenMUD 1.12 documentation.
Updated 7 June 2000.
Based on original Envy 2.2 documentation.
|
Commands and Socials
|
This document describes how to add and modify commands and socials within
DalekenMUD.
|
Commands
|
The central organizing table for skills is cmd_table , an
array of type struct cmd_type , and is defined in
interp.c . 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.
The fields of cmd_table are:
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. There are a list of these functions declared in
function.h and you can find these functions throughout a
majority of the source.
int position;
-
The minimum position for using this command.
int level;
-
The minimum level for using this command. This is usually used for
restricting certain commands to immortals.
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
|
- Add a line for the command in
cmd_table in
interp.c .
- Add a
DECLARE_DO_FUN line for the command function to
function.h .
- Write the function and put it into an appropriate file (usually an
act_****.c file).
- 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 Daleken (which will have
upgraded help.are files). The area file format allows you
to have helps in any area file.
That's ALL there is to it!
|
Social Commands
|
Socials have the following fields.
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.html). If the command is not found in the regular
command table, the function check_social looks for a social that
matches. This is the last stop before rejecting the command.
|
How to Add a Social Command
|
Write a new section into social.are or any area you like
(darea.html). The sections need not be alphabetized.
OR
Use the online social creation system, sedit create . (Read the
online documentation on sedit.)
|