WoW:API CastSpell

From AddOn Studio
Revision as of 16:26, 21 November 2006 by WoWWiki>WoWWiki-Sere
Jump to navigation Jump to search

Casts spell under spellbookType with ID spellID.

CastSpell({spellID}, {spellbookType});

Arguments
( spellID )
spellID
Integer - Spell ID.
( spellbookType )
spellbookType
String - Spellbook type. Valid values are "spell" and "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.

Returns
nil

Example
CastSpell( 1, "spell");


Result
Casts the first spell listed in the spellbook (usually Alchemy or Attack).

Example
CastSpell( 1, "pet");


Result
Casts the first pet spell listed in the spellbook (usually Blood Pact if you control an Imp).

Description
Cast specified spell.

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 only be used in OnClick functions or in bindings.xml. [Obsolete: Another way is to use it in a Slash command and then the user makes a macro out of it and clicks on it. (seems WoW only allows this when a mouseclick / key input has initiated it)]

Template:WoW API