no edit summary
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
Casts spell | {{wowapi}} | ||
{{protectedapi|2.0.1|For alternatives, try [[API_SecureTemplates|Secure Templates]] or the new [[Conditional slash commands#/cast|/cast]].}} | |||
Casts a specificed spell | |||
CastSpell( | CastSpell(spellID, spellbookType); | ||
==Arguments== | |||
:;spellID : Integer - Spell ID. | :;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== | |||
CastSpell(1, "spell"); | |||
CastSpell( 1, "spell"); | |||
;''Result'' | ;''Result'' | ||
:;Casts the first spell listed in the spellbook (usually Alchemy or Attack). | :;Casts the first spell listed in the spellbook (usually Alchemy or Attack). | ||
==Note== | |||
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. | |||