Lore archive · Warcraft Wiki, 2023 dump
API IsUsableSpell
Last wiki revision 2022-07-26
Determines whether a spell can be used by the player character. usable, noMana = IsUsableSpell(spell) = IsUsableSpell(index, bookType)
- usable: - True if the spell is usable, false otherwise. A spell might be un-usable for a variety of reasons, such as:
- The player hasn't learned the spell
- The player lacks required mana or reagents.
- Reactive conditions haven't been met.
- noMana: - True if the spell can not be cast due to low mana, false otherwise.
The following code snippet will check if the spell 'Healing Touch' can be cast: usable, nomana = IsUsableSpell("Curse of Elements"); if (not usable) then if (not nomana) then message("The spell cannot be cast"); else message("You do not have enough mana to cast the spell"); end else message("The spell may be cast"); end The following code snippet will check if the 20th spell in the player's spellbook is usable: usable, nomana = IsUsableSpell(20, BOOKTYPE_SPELL); print(GetSpellName(20, BOOKTYPE_SPELL) .. " is " .. (usable and "" or "not ") .. " usable.");
Source
https://warcraft.wiki.gg/wiki/API_IsUsableSpell · retrieved 2023-11-13 · CC BY-SA 4.0
Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.
This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.