[CODE] ARg these damn uilds be killin me!

From: Chuck Reed (creed@I-55.COM)
Date: 11/24/97


**************WARNING!!!!!!  Before reading this, IT IS
LONG!***************************

Arg!  I have been working on this guild special to no avail!  I have a
struct of:

a) struct new_guild_info {
     int guild_room;
     int class;
    }

b) struct new_guild_info guilds[] = {
   {330, CLASS_THIEF},
   {340, CLASS_PALADIN},
   {-1,-1}
  };

and I am using this special procedure for guilds:

SPECIAL(guild)
{
  int found, skill_num, percent,i;

  extern struct spell_info_type spell_info[];
  extern struct int_app_type int_app[];

  found = FALSE;
  if (IS_NPC(ch))
    return 0;
  if (!CMD_IS("practice") && !CMD_IS("gain"))
    return 0;


for(i=0;guilds[i].class != -1;i++)
    if (GET_CLASS(ch) == guilds[i].class && world[ch->in_room].number ==
    guilds[i].guild_room) {
         found = TRUE;
         continue;
     }else
        i++;


if(CMD_IS("practice") && found == TRUE) {
  skip_spaces(&argument);

  if (!*argument) {
    list_skills(ch);
    return 1;
  }
  if (GET_PRACTICES(ch) <= 0) {
    send_to_char("You do not seem to be able to practice now.\r\n", ch);
    return 1;
  }

  skill_num = find_skill_num(argument);

  if (skill_num < 1 ||
      GET_LEVEL(ch) < spell_info[skill_num].min_level[(int) GET_CLASS(ch)]) {
    sprintf(buf, "You do not know of that %s.\r\n", SPLSKL(ch));
    send_to_char(buf, ch);
    return 1;
  }
  if (GET_SKILL(ch, skill_num) >= LEARNED(ch)) {
    send_to_char("You are already learned in that area.\r\n", ch);
    return 1;
  }
  send_to_char("You practice for a while...\r\n", ch);
  GET_PRACTICES(ch)--;

  percent = GET_SKILL(ch, skill_num);
  percent += MIN(MAXGAIN(ch), MAX(MINGAIN(ch), int_app[GET_INT(ch)].learn));

  SET_SKILL(ch, skill_num, MIN(LEARNED(ch), percent));

  if (GET_SKILL(ch, skill_num) >= LEARNED(ch))
    send_to_char("You are now learned in that area.\r\n", ch);

  return 1;
}

else if(CMD_IS("gain") && found == TRUE) {
  if(GET_EXP(ch) < exp_to_level(ch)) {
    send_to_char("You need more experience to level.\r\n", ch);
    return 0;
  }
  else if(GET_EXP(ch) >= exp_to_level(ch)) {
    if(GET_LEVEL(ch) >= (LVL_IMMORT - 1)) {
      send_to_char("You can't gain anymore levels!\r\n", ch);
    return 0;
       }
    }
    else if(GET_LEVEL(ch) < (LVL_IMMORT - 1)) {
      GET_LEVEL(ch) += 1;
      advance_level(ch);
      send_to_char("You gain a level!\r\n", ch);
      return 1;
     }

  }
else
     return FALSE;
}

It won't recognize a person in their guild.  Any ideas?

Chuck Reed


     +------------------------------------------------------------+
     | 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