scan function

From: Carter T. Shock (ctso@umiacs.UMD.EDU)
Date: 02/26/95


Quickie scan function for circle 2.2 code:

(implemented as a skill)
It includes the possibility of giving wrong answers.

ACMD(do_scan)
{
  int door;
  int found = 0, listflag = 0;
  int scan_room, misinform = 0;
  byte percent,prob;
  struct char_data *vict;
  char mesg[80];

  if(GET_SKILL(ch,SKILL_SCAN) == 0) {
    send_to_char("You have not learned this skill\n\r",ch);
    return;
  }
  act("$n scans the area.",1,ch,0,0,TO_ROOM);
  percent = MAX(1,number(1, 101) - GET_LEVEL(ch));
  prob = GET_SKILL(ch, SKILL_SCAN);
  if(percent > prob)
    misinform = 1;
  for (door = 0; door < NUM_OF_DIRS; door++) {
    listflag = 0;
    if (CAN_GO(ch, door))        {
      scan_room = world[ch->in_room].dir_option[door]->to_room;
      if(world[scan_room].people &&
         (!misinform || (number(0,50) < 20))) {
        for(vict = world[scan_room].people; vict; vict = vict->next_in_room) {
          if(CAN_SEE(ch,vict)) {
            found = 1;
            if(!listflag) {
              send_to_char(dirs[door],ch);
              send_to_char("\n\r",ch);
              listflag = 1;
            }
            act("\t$N",1,ch,0,vict,TO_CHAR);
          }
        }
      }
    }
  }
  if(!found)
    send_to_char("You sense that the adjacent rooms are empty\n\r",ch);
}



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