Page 1 of 1

BUG: $char(book,spellname)

Posted: Fri Nov 07, 2003 2:44 pm
by chickenisgoot
If a spell is towards the back of the spellbook (on page 49/50 for sure), $char(book,spellname) returns null. If I move the spell to page 1, it returns the correct value.

Posted: Fri Nov 07, 2003 3:47 pm
by MacroFiend
The $char(book,xxx) command only parses through the first 250 spells in the spell book. Below is the correction as of the 11/5 patch (spellbook is 0x200 long in charinfo) This should allow you to search through the entire spell book by name or slot number.

Code: Select all

            if (Gem==0 && szArg[0]!='0') {
                if (szArg[0]=='"') szArg++;
                DWORD sp;
                for (sp=0;sp<[color=red]512[/color];sp++) {
                    if (pCharInfo->SpellBook[sp] != 0xFFFFFFFF) {
                        PCHAR SpellName = GetSpellByID(pCharInfo->SpellBook[sp]);
                        if (!strnicmp(szArg,SpellName,strlen(SpellName))) {
                            itoa(sp+1,szTemp,10);
                        }
                    }
                }
            } else {
                if (Gem>0 && Gem<[color=red]512[/color]) {
                    if (pCharInfo->SpellBook[Gem-1] != 0xFFFFFFFF) {

Posted: Thu Nov 13, 2003 1:24 am
by dont_know_at_all
CVSed.

Posted: Thu Nov 13, 2003 7:44 am
by NotSoCSharp
I wrote a little macro to dump all the spells in my spell book to a log file with the spell id, spell name, and spell level. Everything worked great except these spells show a spell id of -1 and a spell level of -1. Not sure if this is the case with any of the other LDoN spells. Anyone else see this??


Wuggan's Greater Appraisal
Wuggan's Greater Discombobulation
Wuggan's Greater Extrication

Posted: Thu Nov 13, 2003 1:30 pm
by dont_know_at_all
Spell ids are 0 to 4497.

0xffffffff or -1 means there is no spell in that slot.

Posted: Thu Nov 13, 2003 2:53 pm
by NotSoCSharp
Thats the thing. The spells are in the slot. I don't dump them if the function returns NULL. These spells are in the book but return -1 for those values.

Posted: Thu Nov 13, 2003 3:11 pm
by dont_know_at_all
Post your macro.

Posted: Thu Nov 13, 2003 3:15 pm
by NotSoCSharp
Here ya go. These spells do not return NULL so they get dumped into the log with -1 for spell id and level. All the other spells show up just fine.

Let me know if you see anything I am missing.

Code: Select all


#turbo

Sub Main

    /declare i local
    
    /mqlog clear
    /for i 1 to 512
       /if "$char(book,@i)"=="NULL" /goto :End
       /mqlog "$spell("$char(book,@i)",id) , $char(book,@i) , $spell("$char(book,@i)",level)"
    :End
    /next i
/return


Posted: Tue Dec 02, 2003 11:10 am
by NotSoCSharp
This appears to still be a problem in MQ2. Someone may want to move this thread to the MQ2 area.

MQ2Parms.cpp:

Code: Select all

            if (Gem==0 && szArg[0]!='0') {
                if (szArg[0]=='"') szArg++;
                DWORD sp;
                for (sp=0;sp<[color=red]250[/color];sp++) {
                    if (pCharInfo->SpellBook[sp] != 0xFFFFFFFF) {
                        PCHAR SpellName = GetSpellByID(pCharInfo->SpellBook[sp]);
                        if (!strnicmp(szArg,SpellName,strlen(SpellName))) {
                            itoa(sp+1,szTemp,10);
                        }
                    }
                }
            } else {
                if (Gem>0 && Gem<[color=red]251[/color]) {
                    if (pCharInfo->SpellBook[Gem-1] != 0xFFFFFFFF) {
                        strcpy(szTemp,GetSpellByID(pCharInfo->SpellBook[Gem-1]));
                    } else {
                        strcpy(szTemp,"NULL");
                    }
                } else {
                    strcpy(szTemp,"NULL");
                }
            }

Posted: Mon Dec 08, 2003 8:41 am
by NotSoCSharp
Anyone know if this got fixed in MQ2? I have a macro that needs this is why I am asking. I did fix it myself but it would be nice if it were put in the CVS/ZIP.

Thanks!

Posted: Mon Dec 08, 2003 3:36 pm
by dont_know_at_all
CVSed.