[code] help with forget

From: Brian Williams (BDoggGBBH@aol.com)
Date: 07/18/99


This segment of code is from my memorization code, but for some reason
"forget all" won't work.  If anyone can help me, I would be very grateful.
Here is the code:
ACMD(do_forget)
{
  int spellnum, slot;

  if (IS_NPC(ch))
    return;

  if (!IS_CLERIC(ch) && !IS_MAGIC_USER(ch)) {
    send_to_char("Duh, forget what?\r\n", ch);
    return;
  }

  if (!*argument) {
    send_to_char("You forgot what you were trying to forget.\r\n", ch);
    return;
  }

  if (is_abbrev(argument, "all")) {
    spellnum = find_skill_num(argument);

    if (spellnum <= 0 || spellnum > MAX_SPELLS) {
      send_to_char("You never knew that in the first place!\r\n", ch);
      return;
    }

    for (slot = 0; slot < MAX_MEMMED; slot++)
      if (MEMORIZING(ch, slot) == spellnum) {
        sprintf(buf, "You forget %s.\r\n",
spell_info[MEMORIZING(ch,slot)].name);
        send_to_char(buf, ch);
        cleanup_memorizing(ch);
        return;
      }

    for (slot = 0; slot < MAX_MEMMED; slot++)
      if (MEMORIZED(ch, slot) == spellnum) {
        sprintf(buf, "You forget %s.\r\n", spell_info[MEMORIZED(ch,
slot)].name);
        send_to_char(buf, ch);
        spell_from_memory(ch, slot);
        return;
      }
    send_to_char("You never knew that in the first place!\r\n", ch);
  } else {
    for (slot = 0; slot < MAX_MEMMED; slot++) {
      MEMORIZED(ch, slot) = 0;
      MEMORIZING(ch, slot) = 0;
      MEMTIME(ch, slot) = 0;
    }
    IS_MEMMING(ch) = FALSE;
    send_to_char("You forget all your spells.\r\n", ch);
    return;
  }
  return;
}

B


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



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