A function from MWSE update by Merzasphor.
Iterates through the target's spell list. Call with curr = 0 to retrieve the head of the list. This only works for NPCs and the player.
SyntaxEdit
totalSpellCount (long) spellId (string ref) name (string ref) type (short) cost (short) numEffects (short) flags (long) next (long): ref->xSpellList curr (long)
totalSpellCount: total number of spells the target knows
next: reference to the next spell in the list. next = 0 when at the end of the list.
ExampleEdit
; Displays the player's spells one at a time. float time long pcRef long totalSpells long spellId long name short type short cost short effects long flags long next set time to ( time + GetSecondsPassed ) if ( time > 7 ) set time to 0 else return endif setx pcRef to xGetRef "player" setx totalSpells spellId name type cost effects flags next to pcRef->xSpellList next xMessageFix "TS: %d ID: %s N: %s T: %d C: %d E: %d F: %d" totalSpells spellId name type cost effects flags MessageBox "Yet such is oft the course of deeds that move the wheels of the world: small hands do them because they must, while the eyes of the great are elsewhere."