WoW:API CastSpell: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
mNo edit summary
m (Move page script moved page API CastSpell to API CastSpell without leaving a redirect)
 
(8 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<center>'''CastSpell''' ''-Documentation by Lorrick-''</center>
{{wowapi}}
{{protectedapi|2.0.1|For alternatives, try [[API_SecureTemplates|Secure Templates]] or the new [[Conditional slash commands#/cast|/cast]].}}
Casts a specificed spell


Returns information about the specified spellbook tab.
CastSpell(spellID, spellbookType);


CastSpell({spellID}, {spellbookTabNum});
==Arguments==


----
;''Arguments''
:( spellID )
:;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.


:( spellbookTabNum )
==Example==
 
  CastSpell(1, "spell");
:;spellbookTab : Integer - Spellbook tab to retrieve information for. Valid values are 1 through MAX_SKILLLINE_TABS(8).
 
----
;''Returns''
 
:;??
 
----
;''Example''
 
SPELLBOOK_TAB_GENERAL = 1;
  CastSpell( 1, SPELLBOOK_TAB_GENERAL );
 


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


:;Casts the first spell listed on the general tab of the spellbook.
----
;''Description''
: Cast specified spell.
----
;''Note''


: Just use SpellBookFrame.bookType as the spellbookTabNum for any spell. the id is then just counted from the beginning through all tabs. the CastSpell function can only be used in OnClick functions. 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)
==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 except when "casting" trade skills (e.g. Cooking, Alchemy, etc.).
{{Template:WoW API}}
[[Category:API Spell Functions|CastSpell]]

Latest revision as of 04:45, 15 August 2023

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.).