I have written a couple articles for
Imaginary Realities webzine on coding. If you'd like to read them, links to the IR
version (which is quite nicely formatted) can be accessed from below.
I've only written for ROM 2.4-based MUDs, so the code here will be for that
code-base. Most of my code is proprietary for
Ansalon (ansalonmud.org 8679), and won't
be listed here. My more "generic" code, however, will be posted below. I hope
you can find a use for this code on your MUD.
I write all my code according to the
GNU Coding Standards. If you have a problem with my indentation, brackets, or
comment style, please check the above out, especially the sections entitled
Formatting Your Source Code,
Commenting Your Work, and
Clean Use of C Constructs.
I try to follow them rigidly, and I find that it increases readability. If you don't have
a good C coding style, please be sure to read the above.
I'm very big in intellectual property rights. In order to use this code or any
derivatives in your MUD, you must do the following:
Have a helpfile for the item that includes a credit to me, with the above e-mail
address in it. (E.g. This code was written by John Patrick (j.s.patrick@ieee.org) and
used with permission.)
The difficulty of adding the snippet varies from 1 (easiest) to 5 (most difficult). If you
are relatively new to coding a MUD, please stick with snippets of difficulty 2 or less.
Here is the difficulty scale:
Small code change:
Add a file to your makefile.
Add a command to the MUD (interp.[ch])
Add an item-type to your MUD, complete with OLC additions (if needed).
Moderate code change:
Add necessary code for skills, spells, talents, or abilities (declare the gsn_*, add to const.c, increase all necessary defines)
Add a CON_ state to nanny().
Add a field to CHAR_DATA, PC_DATA, ROOM_INDEX_DATA, etc., complete with all necessary support code (db.c, save.c, etc.).
Extreme code change.
If you don't know how to do something, please find one of the "MUD-coding tutorials" that are
available on the web. I will try to include any information about "tricky" code additions.
This allows characters to switch melee targets during combat. You can also set a specific level
that would allow them to switch to attacking someone that isn't already attacking them.
Addition of a command, engage.
Addition of a new skill, engage.
Difficulty: 3
A small snippet, this allows a character to knock on a door, and lets everyone in the room
on the other side of the door know that someone has knocked. Very good addition to an RP-based MUD.
This command allows immortals to make someone lose their "reply" ability, or more properly, it
makes the player "forget" who was the last person to give them a tell. This is great for when
an immortal wants to go wizinvis and not be bother by people who they gave a "tell" to.
This allows immortals to view if the mud is currently in "newlock" and/or "wizlock".
Extremely simple, hardly worth adding here. The best addition, though, is to have this
command automatically run whenever an immortal logs in (i.e. in comm.c, right after the
do_function(ch, &do_look, "auto");, add if (IS_IMMORTAL(ch)) do_function(ch, &do_mudstat, "");)