Articles

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.


Snippets

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:

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:
  1. Small code change:
    Add a file to your makefile.
    Add a command to the MUD (interp.[ch])
  2. Add an item-type to your MUD, complete with OLC additions (if needed).
  3. 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().
  4. Add a field to CHAR_DATA, PC_DATA, ROOM_INDEX_DATA, etc., complete with all necessary support code (db.c, save.c, etc.).
  5. 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.

Now, the code, in alphabetical order.

Dump command

This allows characters to dump the contents of a container either onto the floor of the room or into another container.

Addition of a command, dump.
Difficulty: 1

Engage combat

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

Knock

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.

Addition of a command, knock.
Difficulty: 1

Letter-writing

This allows characters to write a note, seal it, give it to someone else, and have them unseal it and read it. (Sealing is optional).

Addition of four commands, write, read, seal, and unseal.
Addition of a new itemtype, ITEM_NOTEPAPER.
Difficulty: 2

Losereply

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.

Addition of a command, losereply.
Difficulty: 1

MUD Status (immortal command)

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, "");)

Addition of a command, mudstat.
Difficulty: 1


"MERC/Derivative Programmers" webring
[Next] [Index] [Prev] [Joining]