track loop

JMPST33@vms.cis.pitt.edu
Date: 03/07/94


Ack.....I have been tyying a simple little procedure with track to get it
to loop back and work like a hunt command to take a char directly to a 
vict....i've tested it a few times but for some reason whenever I try to
"track master" it sends the game into an endless loop and just hangs...until I
kill the process....
      Well this is the code...anyone got any suggestions??

ACMD(do_track)
{
 ACMD(do_move);
 extern struct char_data *character_list;

 struct char_data *vict;
   int dir;
   int f;

   one_argument(argument, arg);
   if (!*arg) {
      send_to_char("Whom are you trying to track?\n\r", ch);
      return;
   }

   if (!(vict = get_char_vis(ch, arg))) {
      send_to_char("No-one around by that name.\n\r", ch);
      return;
   }
   while (f == 0) {

   dir = find_first_step(ch->in_room, vict->in_room);

   switch(dir) {
      case BFS_ERROR:
         send_to_char("Hmm.. something seems to be wrong.\n\r", ch);
         break;
      case BFS_ALREADY_THERE:
         send_to_char("You have found your target!!\n\r", ch);
         f = 1;
         break;
      case BFS_NO_PATH:
         sprintf(buf, "You can't sense a trail to %s from here.\n\r",
                HMHR(vict));
         send_to_char(buf, ch);
         break;
      default:
         /* if you want to make this into a skill instead of a command,
            the next few lines make it give you a random direction if you
            fail the random skill roll.
         */

#ifdef TRACK_IS_SKILL
         {
            int num;

            num = number(0, 101);
            if (SKILL(ch, SKILL_TRACK) < num)
               do { dir = number(0, NUM_OF_DIRS-1); } while (!CAN_GO(ch, dir));
         }
#endif

         sprintf(buf, "You sense a trail %s from here!\n\r", dirs[dir]);
         send_to_char(buf, ch);
         do_move(ch, "", dir+1, 0);
         f = 0;
         sprintf(buf,  "\n\rYou're hot on the trail now!\n\r\n\r");
         send_to_char(buf, ch);
     }
  }


}

Thanks to anyone with a helping hand in advance.....
                                                    Joey@Mission



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