Autoexit Code (Another) [by Eric Kilfoil]
Snippet Posted Wednesday, August 12th @ 11:24:16 PM, by George Greer in the Commands dept.
Added Mar 11, 1997. Click the link below to read it or download it.

From: Eric Kilfoil <kewjhoe@amanda.bciworld.com>
Subject: New Autoexit function

I really didn't care for the stock Autoexit function, so i wrote my own.
If you want it here it is.  All you have to do is, in act.informative.c,
replace the do_auto_exits function with this one.

This will give you an autoexit that looks more like the exit command rather
than the little one liner thing.  It will also tell you if there are closed
doors (which i couldn't figure out why that wasn't there stock). It'll look
something like this:

Obvious Exits:

North - The Kitchen
South - The Living Room
East  - The door is closed
West  - The closet is closed

It also checks the keyword of the door and puts that in there.

For immortals, it would look something like this:

Obvious Exits:

[North] [Room Number]  - The Kitchen
[South] [Room Number]  - The Living Room
[East ] [Room Number]  - The Bathroom - CLOSED
[West ] [Room Number]  - The Closet - CLOSED - LOCKED - PICKPROOF


Keep in mind that it will change the normal autoexit, not add another one.
If you wanted, i suppose you could make a new a new PRF_FLAG for autodir
or something, but i found the builtin autoexit so useless i just scrapped
the whole thing.  Well, here it is.  It may have bugs, but i don't think
so (it's not very difficult code) but just be forewarned:

void do_auto_exits(struct char_data *ch)
{
  int door;

  *buf = '\0';

  if (IS_AFFECTED(ch, AFF_BLIND)) {
    send_to_char("You can't see a damned thing, you're blind!\r\n", ch);
    return;
  }
  for (door = 0; door < NUM_OF_DIRS; door++) {
    if (EXIT(ch, door) && EXIT(ch, door)->to_room != NOWHERE &&
        !IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED)) {
      if (GET_LEVEL(ch) >= LVL_IMMORT)
        sprintf(buf2, "%-5s - [%5d] %s\r\n", dirs[door],
                world[EXIT(ch, door)->to_room].number,
                world[EXIT(ch, door)->to_room].name);
      else {
        sprintf(buf2, "%-5s - ", dirs[door]);
        if (IS_DARK(EXIT(ch, door)->to_room) && !CAN_SEE_IN_DARK(ch))
          strcat(buf2, "Too dark to tell\r\n");
        else {
          strcat(buf2, world[EXIT(ch, door)->to_room].name);
          strcat(buf2, "\r\n");
        }
      }
      strcat(buf, CAP(buf2));
    } else if (EXIT(ch, door) && EXIT(ch, door)->to_room != NOWHERE &&
                IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED)) {
        if (GET_LEVEL(ch) >= LVL_IMMORT) {
          sprintf(buf2, "%-5s - [%5d] %s - CLOSED", dirs[door],
                world[EXIT(ch, door)->to_room].number,
                world[EXIT(ch, door)->to_room].name);
          if (IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED))
                strcat(buf2, " - LOCKED");
          if (IS_SET(EXIT(ch, door)->exit_info, EX_PICKPROOF))
                strcat(buf2, " - PICKPROOF");
          strcat(buf2, "\r\n");
        } else
          sprintf(buf2, "%-5s - The %s is closed\r\n", dirs[door],
                fname(EXIT(ch, door)->keyword));
      strcat(buf, CAP(buf2));
    }
  }
  send_to_char("Obvious exits:\r\n", ch);

  if (*buf)
    send_to_char(buf, ch);
  else
    send_to_char(" None.\r\n", ch);
}


<< Autoexit Code [by Nashak] | Reply | View as text | Threaded | Autoexit (New Exits Format) [by Nashak] >>

 


Related Links
  download
Related Articles
More by greerga
 
 

CircleMUD Snippets
 
Note: Not all of these snippets will work perfectly with your version of code, so be prepared to fix one or two bugs that may arise, and please let me know what you needed to do to fix it. Sending a corrected version is always welcome.
Finally, if you wish to use any of the snippets from this page, you are more than welcome, just mention the authors in your credits. If you wish to release any of these snippets to the public on another site, contact me FIRST.