Re: Trying to access room connected to room

From: Skylar (skylar@acy.digex.net)
Date: 04/04/95


On Tue, 4 Apr 1995, Scott Francis wrote:

> Hey I'm sure this is kinda trivial, but I have a question.  I'm trying to 
> make a multiroom scan command and am having trouble accessing rooms past 
> those that are immediately connecting to the character.  
>  
> I am trying to do something similar to
> EXIT(ch,(EXIT(ch,door))->to_room)->to_room) to get there..but it doesn't seem
> to work....any suggestions would be greatly appreciated.....
> 

I started to reply to this, and ended up writting my own scan command.
I'll post it, in case you might find it useful at all...

--snip--
ACMD(do_scan)
{

  int dir, dist, max_dist = 5;          /* set max_dist to your needs */  
  int original_location = ch->in_room;  /* save room to put them back */

  if (!*argument) {
    send_to_char("Scan which direction?\r\n", ch);
    return;
  }

  skip_spaces(&argument);

  if ((dir = search_block(argument, dirs, FALSE)) < 0) {
    send_to_char("Thats not a direction!\r\n", ch);
    return;
  }

  if (!CAN_GO(ch, dir)) {          /* closed or non-existant exit... */
    look_in_direction(ch, dir);
    return;
  }

  sprintf(buf, "$n scans the terrain %s.", dirs[dir]);
  act(buf, 0, ch, 0, 0, TO_ROOM); 

  for (dist=1; dist < max_dist; dist++)
    if (CAN_GO(ch, dir)) {
      ch->in_room = world[ch->in_room].dir_option[dir]->to_room;
      sprintf(buf, "You scan %s, and see...\r\n", dirs[dir]);
      send_to_char(buf, ch);
      look_at_room(ch, 0);
    }
  ch->in_room = original_location;
}
--snip--

Hope that helps...

                        -Skylar



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