m (→Notes: CastSpellByName("<trade skill name>") still opens the trade skill as expected (on live and PTR).) |
mNo edit summary |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{wowapi}} {{protectedapi|Use the "spell" action type of [[SecureActionButtonTemplate]] or the [[MACRO cast|/cast]] slash command.|hw=2}} |
||
− | {{wowapi}} |
||
+ | Casts the specified spell. |
||
− | {{protectedapi|2.0.1|For alternatives, try [[API_SecureTemplates|Secure Template]] or the new [[Conditional slash commands#/cast|/cast]].}} |
||
⚫ | |||
− | |||
⚫ | |||
==Arguments== |
==Arguments== |
||
− | + | ; name : String - Name of the spell to cast, e.g. "Alchemy". |
|
− | + | ; target : String - [[unitId|unit]] to cast the spell on. If omitted, "target" is assumed for spells that require a target. |
|
− | |||
− | ==Example== |
||
+ | == Details == |
||
− | 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. |
||
− | == |
+ | == Patch history == |
+ | {{Patch 2.0.1|note=Protected.}} |
||
− | 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. |
||
⚫ |
Revision as of 03:01, 13 January 2013
Automated updating of API pages at this location, to reflect patch changes, has ceased from 10.1.7 onwards. |
This function is protected.
|
Casts the specified spell.
CastSpellByName("spellName"[, "target"])
Arguments
- name
- String - Name of the spell to cast, e.g. "Alchemy".
- target
- String - unit to cast the spell on. If omitted, "target" is assumed for spells that require a target.
Details
- You can still use this function to open trade skill windows and to summon mounts even from a tainted execution path.
Patch history
Patch 2.0.1 (2006-12-05): Protected.