#define R_EXIT(n, door)  (world[n].dir_option[door])


#define SLIGHT_OK(sub, obj) \
   (!IS_AFFECTED(sub, AFF_BLIND) &&\
   (IS_LIGHT((obj)->in_room) || IS_AFFECTED((sub), AFF_INFRAVISION)))

#define SMORT_CAN_SEE(sub, obj)\
 (SLIGHT_OK(sub, obj) && INVIS_OK(sub, obj))

#define SIMM_CAN_SEE(sub, obj) \
   (SMORT_CAN_SEE(sub, obj) || PRF_FLAGGED(sub, PRF_HOLYLIGHT))

/* Can subject see character "obj"? */
#define SCAN_SEE(sub, obj) (SELF(sub, obj) || \
  ((GET_REAL_LEVEL(sub) >= GET_INVIS_LEV(obj)) && SIMM_CAN_SEE(sub,
obj)))
/* End of SCAN_SEE */

int ExitOk( int n, int aux, int tf )
{
  int x, m=n;

  for (x=0; xto_room != NOWHERE) &&
       (!IS_SET(R_EXIT(m, aux)->exit_info, EX_CLOSED)))
       m = R_EXIT(m, aux)->to_room;
    else
       return( FALSE );
  }
  return( TRUE );
}

int GetRoomNum( int n, int direction, int tf )
{
  int x, m=n;

  for (x=0; xto_room !=
NOWHERE) &&
       (!IS_SET(R_EXIT(m, direction)->exit_info, EX_CLOSED)))
       m = R_EXIT(m, direction)->to_room;
    else
       return( NOWHERE );
  }
  return( m );
}


void list_per(struct char_data * i, struct char_data * ch, char * dirr )
{
  if (IS_NPC(i) && i->player.short_descr )
    sprintf(buf, "%s%s%-30s\r\n", buf, dirr, i->player.short_descr );
  else
    sprintf(buf, "%s%s%s%-30s%s\r\n", buf, dirr, CCGRN(ch,C_SPR),
                  i->player.name, CCNRM(ch, C_SPR) ) ;
  return;
}


short list_pers(struct char_data * list, struct char_data * ch, char *
dirr )
{
  struct char_data *i;
  short bandera=0;

  for (i = list; i; i = i->next_in_room)
    if (ch != i)
      if (SCAN_SEE(ch, i))
      {
        bandera=1;
        list_per( i, ch, dirr );
      }
  return(bandera);
}

/* This defines the number of rooms that you can see... ten is too much,
but... :) */
#define MAX_SCAN 10

ACMD(do_scan)
{
  int door, x;
  char dirr[80];
  short bandera=0;

  dirr[0] = '\0';
  act("$n scans the area.", TRUE, ch, 0, 0, TO_ROOM);
  {
    strcpy( buf, "You scan the area:\r\n");
    strcpy( dirr, "[Right Here] " );
    bandera = list_pers(world[ch->in_room].people, ch, dirr );

    for (door = 0; door < NUM_OF_DIRS; door++)
      for (x=1; xin_room, door, x))
        {
          dirr[0] = '\0';
          sprintf( dirr, "[%-8s, square %2d] ", x, dirs[door] );
          bandera += list_pers(
world[GetRoomNum(ch->in_room,door,x)].people, ch, dirr );
          if (strlen(buf) > MAX_STRING_LENGTH - 30)
          {
            strcat(buf, "*** Truncated ***\r\n" );
            door = NUM_OF_DIRS+1;
          }
      }
    if (bandera == 0)
      sprintf( buf, "%sNobody.\r\n", buf );
  }
  page_string( ch->desc, buf, 1 );
}

    Source: geocities.com/timessquare/castle/4515

               ( geocities.com/timessquare/castle)                   ( geocities.com/timessquare)