In "newbie code question" Lady wrote:
> I installed a new spell. I put everything where it was
> supposed to go (const.c   magic.c   def_spell_fun in
> magic.h   fight.c).  It all compiled fine and dandy.
> The only thing is, it is not showing up in spell lists
> and I get the 'You don't know any spells of that name'
> error when trying to cast it. What did I overlook???

OK... forgive if too basic, but to start at the beginning:

grep your src/ for the error: You don't know any spells of that name

You'll notice I left the quotes and punctuation off. Be prepared to
search for "don't know any" in case the actual line in the code is
"$c don't know any $S of that name.\B\r"
(Windows users: go to Start; Find in Files, or use Find in your editor)

You should find something like:

        if ((sn = find_spell(ch,arg1)) < 1
        ||   skill_table[sn].spell_fun == spell_null
        ||   (!IS_NPC(ch) && ((ch->level < 
skill_table[sn].skill_level[ch->class]
        &&   ch->level < skill_table[sn].skill_level[ch->last])  /* for remorts 
*/
        ||   ch->pcdata->learned[sn] == 0)))
        {
>>              send_to_char( "You don't know any spells of that name.\n\r", ch 
>> );
                return;
        }

Now, we just go through this line by line until we find what sends you
that message. First we want to grep again for the find_spell() function.

int find_spell( CHAR_DATA *ch, const char *name )
{
        /* finds a spell the character can cast if possible */
        int sn, found = -1;

        if (IS_NPC(ch))
        return skill_lookup(name);

        for ( sn = 0; sn < MAX_SKILL; sn++ )
        {
                if (skill_table[sn].name == NULL)
                break;
                if (LOWER(name[0]) == LOWER(skill_table[sn].name[0])
                &&  !str_prefix(name,skill_table[sn].name))
                {
                        if ( found == -1)
                        found = sn;
                        if ((ch->level >= skill_table[sn].skill_level[ch->class]
                        ||  ch->level >= skill_table[sn].skill_level[ch->clast])
                        &&  ch->pcdata->learned[sn] > 0)
                        return sn;
                }
        }
        return found;
}

Reply via email to