WoW API: CastSpell

From AddOn Studio
Revision as of 04:45, 15 August 2023 by Move page script (talk | contribs) (Move page script moved page API CastSpell to API CastSpell without leaving a redirect)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

WoW API < CastSpell

Casts a specificed spell

CastSpell(spellID, spellbookType);

Arguments[edit]

spellID
Integer - Spell ID.
spellbookType
String - Spellbook type. Valid values are "spell" (BOOKTYPE_SPELL) and "pet" (BOOKTYPE_PET). All players use "spell". Hunters and Warlocks may have additional tabs on the bottom when pets are summoned. Warlocks have Demon, which corresponnds to "pet" spellbook type.

Example[edit]

CastSpell(1, "spell");
Result
Casts the first spell listed in the spellbook (usually Alchemy or Attack).


Note[edit]

Use "spell" or SpellBookFrame.booktype as the spellbookType for any non-pet spell. The id is counted from 1 through all spell types (tabs on the right side of SpellBookFrame). Pet spells also start from 1. (See example above). The CastSpell function can not be used outside Blizzard-signed code except when "casting" trade skills (e.g. Cooking, Alchemy, etc.).