******************************************************************************
File Name : faq.txt
Description : Frequently Asked Questions.
******************************************************************************
1. WHAT IS THE DIFFERENCE BETWEEN A BODY AND A CONNECTION?
In Glad there are two main structures for storing information about the
players. The first is a CONNECTION (conn_t) which contains all the socket
information and input/output buffers. The second is a BODY (body_t) which
stores the character-specific information such as statistics, gender, room,
opponent, etc. You shouldn't have to change any of the CONNECTION data.
2. HOW DO I ADD VARIABLES TO PLAYER CHARACTERS?
Add the variable to the "body" structure declared in sockets.h, making sure
to do a clean compile afterwards (delete all the .o files then make). If
you want the variable to save, then go into file_io.c and add the variable
to the player file table (a_kstPlayerFileTable). If it's an enumerated type
that you're adding then you'll need to update the enumerated types table
(a_kstEnumTable) as well.
3. HOW DO I ADD NEW COMMANDS?
Go into the commands.h file and add the "CMD(...);" prototype for your new
command, then go into commands.c and update the command table (kstCmdTable)
to reference your new command. Finally, scroll to the bottom of commands.c
and add the code for your new command, following the same format as the
other commands.
4. HOW DO I ADD NEW FIGHTING TECHNIQUES TO AN EXISTING STYLE?
Open the appropriate .c file (combat_hands.c, combat_legs.c, etc) and update
the combat table (kstCmbtTable<location>) for your new technique, following
the format for the existing techniques. Scroll to the bottom of the file
and add the new function required by your technique. Open the appropriate
.h file and add the prototype for your new function.
5. HOW DO I ADD ENTIRELY NEW FIGHTING STYLES?
Create two new files, combat_<type>.c and combat_<type>.h, where <type> is
the new type of table desired. Add the .c file to the Makefile, then open
combat.c and make sure that your new .c file is #included at the top. Move
down to the combat table (kstCmbtTable) also in combat.c, and add your own
combat table to the array.
Copy the format of the .c and .h files, adjusting them as appropriate for
your new fighting style. In brief, the .h file should contain an extern
references to your new combat table and a list of prototypes for the various
techniques it uses. Your .c file should contain the combat table (with the
combat commands at the bottom preceded with an '@' symbol), a list of combat
command functions and a list of combat technique functions.
6. HOW DO I ADD ROOMS/OBJECTS/MOBILES?
This will require some work to do. You could create separate structures
for the rooms and objects, or combine them with the body structure (so
that everything is of "thing" type). You could have predefined exists in
each room that may or may not point to another room. You could have a
dynamic exist system whereby each room could have zero or more pointers
to other rooms, using a keyword for each exit ("north", "east", "enter",
"tavern", etc). You could have a coordinate/grid-based system whereby
your current coordinate position determines what rooms you're in. You
could ignore the entire concept of rooms and go for a pure coordinate
based system. There are many ways to do this, none of them "right" or
"wrong". I'd suggest you take the time to really think about what you
want your system to do and then design your system accordingly - it's
not something I can just give instructions for.
7. HOW DO I ADD NEW HELP FILES?
Create a new text file in the "help" directory which contains the text you
want in the new help file. Add a reference to the new file in the help file
table (s_stHelpTable) in help.c, making sure to indicate whether or not you
want the content of the file to be automatically justified by the mud (which
you'd normally only do if the file contains dynamic text).
8. HOW DO I ADD A VARIABLE TO THE DYNAMIC TEXT DESCRIPTION CODE?
Go into text_io.c and update the variable table (a_kstVarTable) to include
your new variable. If the variable is a constant then you don't need to do
anything else, but if it's a function variable then you'll need to add the
function above the table in either the "Number access functions" or "Text
access functions" section.
9. HOW DO I ADD MORE COLOURS?
Go into text_io.c and add the new colours in the "Colours" section.