Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
WoW
Talk
English
Views
Read
Edit
History
More
Search
Navigation
Home
Random page
Help using wiki
Editions
for WoW
for WildStar
for Solar2D
Documentation
for WoW
for WildStar
Reference
WoW
⦁ FrameXML
⦁ AddOns
⦁ API
⦁ WoW Lua
WildStar
⦁ AddOns
⦁ API
⦁ WildStar Lua
Engine
Tools
What links here
Related changes
Special pages
Page information
Site
Recent Changes
Editing
WoW:API CastSpellByName
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{wowapi}} {{protectedapi|2.0.1|For alternatives, try [[API_SecureTemplates|Secure Template]] or the new [[Conditional slash commands#/cast|/cast]].}} CastSpellByName(spellName{, onSelf}); ==Arguments== :;name : String - Name of the spell to cast. Rank is optional, if omitted, highest possible is picked automatically. :;onSelf : Boolean - Should the spell be cast on the player (vs target)? If no target exists and the onSelf evaluates to false, cursor is switched to casting mode. ==Example== CastSpellByName("Flash Heal(Rank 2)"); -- Cast Flash Heal (Rank 2) on target. CastSpellByName("Flash Heal"); -- Cast Flash Heal (Highest rank) on target. CastSpellByName("Flash Heal",1); -- Cast Flash Heal (Highest rank) on self. ==Notes== To cast spells that contains parentheses in the spell name, such as "Create Healthstone (Major)" and "Faerie Fire (Feral)", it's necessary to either specify rank or add () to the end of the spell name, like: CastSpellByName("Faerie Fire (Feral)()"); You might encounter difficulties when using this on a localized version of WoW. * See the [[HOWTO:_Localize_an_AddOn#Unicode|Unicode part]] of the Localization HOWTO for more details about editing a source file containing localized strings. * This problem does only appear when working with Lua source files. When you're using macros, inside the WoW client, it should work in unicode directly. * You ''can'' still use this function outside of secure code to open trade skill windows and to summon non-combat pets and mounts.
Summary:
Please note that all contributions to AddOn Studio are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
AddOn Studio Wiki:Copyrights
for details).
Submissions must be written by you, or copied from a public domain or similar free resource (see
AddOn Studio Wiki:Copyrights
for details).
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Ambox
(
edit
)
Template:Apinav
(
edit
)
Template:Editlink
(
edit
)
Template:Protectedapi
(
edit
)
Template:Tocright
(
edit
)
Template:Wowapi
(
edit
)