Re: [CODE] Find Familiar

From: George (greerga@CIRCLEMUD.ORG)
Date: 12/07/97


On Sun, 7 Dec 1997, Chuck Reed wrote:

>  if(GET_LEVEL(ch) >= 15 && GET_LEVEL(ch) <= 24)
>      rnum = 10099;
>   else if(GET_LEVEL(ch) >= 25 && GET_LEVEL(ch) <= 30)
>      rnum = 10098;
>   else if(GET_LEVEL(ch) >= 31 && GET_LEVEL(ch) <= 40)
>      rnum = 10097;
>   else if(GET_LEVEL(ch) >= 41 && GET_LEVEL(ch) <= 45)
>      rnum = 10096;
>   else if(GET_LEVEL(ch) >= 46 && GET_LEVEL(ch) <= 55)
>      rnum = 10095;
>   else if(GET_LEVEL(ch) >= 56)
>      rnum = 10094;

struct {
  int low;
  int high;
  int mob;
} familiar = {
  { 15, 24, 10099 },
  { ... },
  { 46, 55, 10095 },
  { 56, LVL_IMPL, 10094 }
}

  for (i = 0; familiar[i].high != LVL_IMPL; i++)
    if (GET_LEVEL(ch) >= familiar[i].low && GET_LEVEL(ch) <= familiar[i].high)
      number = familiar[i].mob;

  if (number == -1)
    do_error_stuff

Make sure you have 'int number = -1;' and 'int i;'

>if ((rnum = real_mobile(number)) < 0) {
>      send_to_char("There is no monster with that number.\r\n", ch);
>      return;
>    }

You are assigning the 'rnum' variable above and trying to use 'number' to
calculate the mobile's real number instead.

--
George Greer  -  Me@Null.net   | Genius may have its limitations, but stupidity
http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



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