CODE/HELP: Adding a new Zone Command

From: Brian Menges (
Date: 07/06/96

Well, for some strange reason my pervious mail got cut in half. :(  Here is the
complete mail (hopefully).

I am trying to add a new zone command but I am a little confused with the way
the current zone commands work.  I have added mounts into my MUD and I want to
make it so you can mount one mobile onto a another.  The format I set up is
very similiar to the format for putting an object in another.  It looks like

N <if_flag> <mob_rider> <max_existing> <mount>

So, you have to load the <mount> before you call the mount command in the zone

Here is what I have so far:

In db.c

    case 'M':			/* read a mobile */
      if (mob_index[ZCMD.arg1].number < ZCMD.arg2) {
	mob = read_mobile(ZCMD.arg1, REAL);
	char_to_room(mob, ZCMD.arg3);
	last_cmd = 1;
      } else
	last_cmd = 0;

    case 'N':			/* mobile on mount */
      if (mob_index[ZCMD.arg1].number < ZCMD.arg2)      <--- What does this do?
	mob = read_mobile(ZCMD.arg1, REAL);
	if (!(mount = read_mobile(ZCMD.arg3,REAL)))
	  ZONE_ERROR("target mount not found");
	if(GET_CLASS(mount) != CLASS_MOUNT)
	  ZONE_ERROR("attempt to mount on a NON-mount mob");
	mob_to_mount(mob, mount);
	last_cmd = 1;
	last_cmd = 0;

    case 'O':			/* read an object */
      if (obj_index[ZCMD.arg1].number < ZCMD.arg2) {
	if (ZCMD.arg3 >= 0) {
	  obj = read_object(ZCMD.arg1, REAL);

It never gets past :

    if (mob_index[ZCMD.arg1].number < ZCMD.arg2)

I'm not sure exactly what this line does.

Here is the mob_to_mount function in handler.c I wrote:

/* put a mobile on a mount (quaint)  */
void mob_to_mount(struct char_data * mob, struct char_data * mount)
  int in_room;

  if (!mob || !mount || mob == mount)
    log("SYSERR: NULL mobile or same source and target mount passed to

  if(MOUNTED(mount) != 0)
    log("SYSERR: Mount not free.  Attempting to mount a mobile on a non-free

  char_to_room(mob, mount->in_room);
  MOUNTED(mount) = mob;
  MOUNTED(mob) = mount;



I have been banging my head against the wall on this one.  I don't reall
understand the code for zone files too well.  Any help on this would be greatly

"Take my advice and go back to the time	| Brian Menges
you came from.  The future isn't what 	| NASA Ames Research Center
it used to be."--G'kar, "The Long Dark" | Mail Stop: N262-2
	          0__0			| Phone: (415) 604-0069

This archive was generated by hypermail 2b30 : 12/07/00 PST