Re: Go keyword

From: Brandon Brown (ViperBrd@aol.com)
Date: 06/05/99


<< Hey. Im havin some trouble with a new cool command im tryin to write. It
is a
 go command so when a player is in a room and say there is an alley mentioned
 in the room description, the player can type "go alley" and the command will
 take him to the alley. >>


I'm not quite sure if this is anything like what you have, but this code has
worked fine for me:


ACMD(do_go)
{
int was_in;

one_argument(argument, arg);

if (!(*arg)){
send_to_char("Go where?\r\n", ch);
return;
}


if (EXIT(ch, GO))
  if (isname(arg, world[ch->in_room].dir_option[GO]->keyword)) {

if (AFF_FLAGGED(ch, AFF_CHARM) && ch->master && ch->in_room ==
ch->master->in_room) {
 send_to_char("The thought of leaving your master makes you weep.\r\n",
ch);
    act("$n bursts into tears.", FALSE, ch, 0, 0, TO_ROOM);
    return;
  }

  if (ROOM_FLAGGED(EXIT(ch, GO)->to_room, ROOM_GODROOM) &&
        GET_LEVEL(ch) < LVL_GRGOD) {
    send_to_char("You aren't godly enough to use that room!\r\n", ch);
    return;
}
if (IS_SET(ROOM_FLAGS(EXIT(ch, GO)->to_room), ROOM_TUNNEL) &&
        num_pc_in_room(&(world[EXIT(ch, GO)->to_room])) > 1) {
      send_to_char("There isn't enough room there for more than one
person!\r\n", ch);
     return;
    }


if (EXIT(ch, GO)->general_description) {
if (!IS_NPC(ch))
sprintf(buf2, "$n %s %s", GET_LASTNAME(ch), (EXIT(ch,
GO)->general_description));
else sprintf(buf2, "$n %s", (EXIT(ch, GO)->general_description));
act(buf2, TRUE, ch, 0, 0, TO_ROOM);
}

if (!(EXIT(ch, GO)->general_description)){
if (!IS_NPC(ch))
      sprintf(buf2, "$n %s walks to %s %s.", GET_LASTNAME(ch), AN(EXIT(ch,
GO)->keyword), EXIT(ch, GO)->keyword);
else sprintf(buf2, "$n walks to %s %s.",AN(EXIT(ch, GO)->keyword),
EXIT(ch, GO)->keyword);
      act(buf2, TRUE, ch, 0, 0, TO_ROOM);

}
    was_in = ch->in_room;
    char_from_room(ch);
    char_to_room(ch, world[was_in].dir_option[GO]->to_room);

if (!IS_NPC(ch))
       sprintf(buf, "$n %s has arrived.", GET_LASTNAME(ch));
else sprintf(buf, "$n has arrived.");
      act(buf, TRUE, ch, 0, 0, TO_ROOM);

sprintf(buf2, "You walk to %s %s.\r\n",AN(arg), arg);
send_to_char(buf2, ch);

if (ch->desc != NULL)
      look_at_room(ch, 0);
if (IS_SET(ROOM_FLAGS(ch->in_room), ROOM_DEATH)) {
    if (GET_LEVEL(ch) < LVL_IMMORT) {
      log_death_trap(ch);
      death_cry(ch);
      extract_char(ch);
    GET_LOADROOM(ch)=NOWHERE;
    save_char(ch,NOWHERE);
    }
  }

return;
}
send_to_char("I don't see that here.", ch);
}


I might've missed something in there... TimeTraveller's code allows for three
GO exits, but to save space, I only snippeted out for the one there.

---
B. Brown
WebMaster, CircleMUD WTFaq
http://developer.circlemud.org/docs/wtfaq/

TimeTraveller - "Lost in Time, and Loving it!"
http://www.digital-genesis.com/~uasoft/


     +------------------------------------------------------------+
     | 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