Re: [CODE] Things todo [Whoops]

From: Tony Robbins (tonyr@pacific101.com)
Date: 12/21/98


Heh, that was supposed to be private mail.

Anyway, I'll post this here as an obcircle.  It's never even been compiled :P

In theory, it lets you move a person from a room to another sending various
messages, if they type the right command.

-B.

#define NUM_PORTERS     2

SPEC(beleporter)
{
  int i;

  struct beleporter_fun {
    room_vnum   from;
    room_vnum   to;
    char*       exit_msg;
    char*       enter_msg;
    char*       command;
    char*       argument;
    bool        can_look;
  } beleport[NUM_PORTERS] = {
    { 1545,     1554,
      "$n swims into a crate.",
      "$n swims in through a crack in the crate.",
      "enter",
      "crate", TRUE },
    { 1554,     1545,
      "$n swims out of the crate.",
      "$n swims out through a crack in the crate.",
      "exit",
      NULL, FALSE }
    /* expandable...                                       *
     * note that if you use a command not in the regular   *
     * command list, you have to add it with a do_not_here *
     * or some other similar command pointer  (e.g., exit) */
  };

  /* make sure we're in a valid room. */
  for (i = 0; i <= NUM_PORTERS; i++) {
    if (world[IN_ROOM(ch)].number == beleport[i].from)
      break;
    if (i == NUM_CRATES) {
      sprintf(buf, "Invalid beleporter room #%d, invalid spec_assign!",
world[IN_ROOM(ch)].number);
      mudlog(buf, BRF, LVL_IMPL, TRUE);
      return (FALSE);
    }
  }
  if the command isn't the required one, or if it isn't look is invalid or

  if (!CMD_IS(beleport[i].command) && !CMD_IS("look"))
    return (FALSE);

  one_argument(argument, arg);

  if (beleport[i].argument && !is_abbrev(arg, beleport[i].argument))
    return (FALSE);

  if (CMD_IS("look")) {
    if (beleport[i].can_look == FALSE)
      return (FALSE);
    GET_WAS_IN(ch) = IN_ROOM(ch);
    char_from_room(ch);
    char_to_room(ch, real_room(beleport[i].to));
    look_at_room(ch, 1);
    char_from_room(ch);
    char_to_room(ch, GET_WAS_IN(ch));
    return (TRUE);
  } else {
    act(beleport[i].exit_msg, FALSE, ch, 0, 0, TO_ROOM);
    char_from_room(ch);
    char_to_room(ch, real_room(beleport[i].to));
    act(beleport[i].enter_msg, FALSE, ch, 0, 0, TO_ROOM);
    look_at_room(ch, 0);
    return (TRUE);
  }

  /* should never get this far... */
  return (FALSE);
}


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



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