WoW:MACRO cast: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Added the talent condition.)
(Backwards numbers)
Line 15: Line 15:


== Arguments ==
== Arguments ==
:;optionset : List of options below, separated by commas, enclosed in [ ]
:;optionset
:;spellname : Name of the spell to cast
:: List of options below, separated by commas, enclosed in [ ]
:;item : The name of the item to be used.
:;spellname
:;[[BagId]] : The bag the item is in (0 is backpack, etc...)
:: Name of the spell to cast
:;slot : The slot number, starting at 1.
:;item
:;[[InventorySlotId | InvSlot]] : The slot on your character in which to use an item.
:: The name of the item to be used.
:;[[BagId]]
:: The bag the item is in (0 is backpack, etc...)
:;slot
:: The slot number, starting at 1.
:;[[InventorySlotId | InvSlot]]
:: The slot on your character in which to use an item.


=== Optionset ===
=== Optionset ===
You may use "no" in front of any of these to invert the logic result. All of the options below except '''target''' are actually ''conditions'' that the script will check before casting the spell. If ''any'' of the conditions in a set are false, the script will move on to the next option set, or the next semicolon (;) if there are no more; if all of the conditions in a set are true, the script will ignore any more option sets and cast '''spellname'''. Once it successfully casts a '''spellname''', the rest of that line is ignored (see Examples at bottom).
You may use "no" in front of any of these to invert the logic result. All of the options below except '''target''' are actually ''conditions'' that the script will check before casting the spell. If ''any'' of the conditions in a set are false, the script will move on to the next option set, or the next semicolon (;) if there are no more; if all of the conditions in a set are true, the script will ignore any more option sets and cast '''spellname'''. Once it successfully casts a '''spellname''', the rest of that line is ignored (see Examples at bottom).


Because '''target=''' is a command (not a condition), you can use multiple option sets to automatically cast the spell on the appropriate target (see Examples at bottom).
Because '''target=''' is a command (not a condition), you can use multiple option sets to automatically cast the spell on the appropriate target (see Examples at bottom).


;actionbar ⇔ bar : If you are using this particular actionbar. You must specify actionbar:# (#=action bar number).
;actionbar ⇔ bar
:;button ⇔ btn : If you clicked a particular button to cast the spell (button:#, where #=1-5, LeftButton, MiddleButton, RightButton, Button4, or Button5).
: If you are using this particular actionbar. You must specify actionbar:# (#=action bar number).
:;channeling : If you are channeling a spell. You may optionally specify a specific spell using spell:''spellname''.
:;button ⇔ btn
:;combat : If you are in combat.
:: If you clicked a particular button to cast the spell (button:#, where #=1-5, LeftButton, MiddleButton, RightButton, Button4, or Button5).
:;dead : If the target is dead.
:;channeling
:;equipped ⇔ worn : If you are currently equipping a specific item, item of a particular class or subclass, or have an item in a particular slot. (ex. equipped:item, see below for details).
:: If you are channeling a spell. You may optionally specify a specific spell using spell:''spellname''.
:;exists : If the target exists (case insensitive).
:;combat
:;flyable : If you are in an area where flying is allowed.
:: If you are in combat.
:;flying : If you are flying.
:;dead
:;group : If you are in a group. You may optionally specify group:party or group:raid.
:: If the target is dead.
:;harm ⇔ nohelp : If target is hostile.
:;equipped ⇔ worn
:;help ⇔ noharm : If target is friendly.
:: If you are currently equipping a specific item, item of a particular class or subclass, or have an item in a particular slot. (ex. equipped:item, see below for details).
:;indoors : If your are indoors (anywhere you cannot mount is considered indoors).  
:;exists
:;modifier ⇔ mod : If the click is modified with shift, ctrl, or alt. You may optionally specify which one by using modifier:key (key=shift, ctrl, or alt).
:: If the target exists (case insensitive).
:;mounted : If you are mounted.
:;flyable
:;outdoors : You are outdoors (anywhere you can mount is considered outdoors).  
:: If you are in an area where flying is allowed.
:;party : If the target is in your party.
:;flying
:;pet : If your pet exists. You may optionally specify a type of pet (pet:type, where type=cat,boar,ravager,etc...)
:: If you are flying.
:;raid : If the target is in your raid.
:;group
:;[[Stance|stance ⇔ form]] : If you are in a particular stance. May also use stance:# to specify a particular stance (#=stance number).
:: If you are in a group. You may optionally specify group:party or group:raid.
:;spec : If you are using the specified talent specialization (spec:1 or spec:2).
:;harm ⇔ nohelp
:;talent<row>/<col> : If you are using the specified talent (talent:1/1 to talent:3/6).
:: If target is hostile.
:;stealth : If you are stealthed.
:;help &hArr; noharm
:;swimming : If you are swimming.
:: If target is friendly.
:;target=[[UnitId]] &hArr; @[[UnitId]]: Casts on a specific target without changing your current target (see table below).
:;indoors
:;unithasvehicleui : If the target of the macro has a vehicle UI.
:: If your are indoors (anywhere you cannot mount is considered indoors).
:;vehicleui : If the player has a vehicle UI.
:;modifier &hArr; mod
:: If the click is modified with shift, ctrl, or alt. You may optionally specify which one by using modifier:key (key=shift, ctrl, or alt).
:;mounted
:: If you are mounted.
:;outdoors
:: You are outdoors (anywhere you can mount is considered outdoors).
:;party
:: If the target is in your party.
:;pet
:: If your pet exists. You may optionally specify a type of pet (pet:type, where type=cat,boar,ravager,etc...)
:;raid
:: If the target is in your raid.
:;[[Stance|stance &hArr; form]]
:: If you are in a particular stance. May also use stance:# to specify a particular stance (#=stance number).
:;spec
:: If you are using the specified talent specialization (spec:1 or spec:2).
:;talent<row>/<col>
:: If you are using the specified talent (talent:1/1 to talent:6/3).
:;stealth
:: If you are stealthed.
:;swimming
:: If you are swimming.
:;target=[[UnitId]] &hArr; @[[UnitId]]
:: Casts on a specific target without changing your current target (see table below).
:;unithasvehicleui
:: If the target of the macro has a vehicle UI.
:;vehicleui
:: If the player has a vehicle UI.


=== Spellname ===
=== Spellname ===
As of [[Patch 2.3.2]] cast command toggles toggleable abilities on and off. Prefixing the name with an exclamation mark prevents this.
As of [[Patch 2.3.2]] cast command toggles toggleable abilities on and off. Prefixing the name with an exclamation mark prevents this.


Examples of toggleable abilities are Stealth and Shoot.
Examples of toggleable abilities are Stealth and Shoot.


===Item Types for equipped===
===Item Types for equipped===
:;Slots:Two-Hand,Bag,Shirt,Chest,Back,Feet,Finger,Hands,Head,Held In Off-hand,Legs,Neck,Ranged,Chest,Off Hand,Shoulder,Tabard,Thrown,Trinket,Waist,One-Hand,Main Hand,Off Hand,Wrist
:;Slots
:;Item Types:Armor,Container,Projectile,Quiver,Weapon
::Two-Hand,Bag,Shirt,Chest,Back,Feet,Finger,Hands,Head,Held In Off-hand,Legs,Neck,Ranged,Chest,Off Hand,Shoulder,Tabard,Thrown,Trinket,Waist,One-Hand,Main Hand,Off Hand,Wrist
:;Item Sub-Types: Cloth,Idols,Leather,Librams,Mail,Miscellaneous,Shields,Totems,Plate,Bag,Enchanting Bag,Engineering Bag,Herb Bag,Soul Bag,Arrow,Bullet,Ammo Pouch,Quiver,Bows,Crossbows,Daggers,Guns,Fishing Pole,Fist Weapons,Miscellaneous,One-Handed Axes,One-Handed Maces,One-Handed Swords,Polearms,Staves,Thrown,Two-Handed Axes,Two-Handed Maces,Two-Handed Swords,Wands
:;Item Types
::Armor,Container,Projectile,Quiver,Weapon
:;Item Sub-Types
:: Cloth,Idols,Leather,Librams,Mail,Miscellaneous,Shields,Totems,Plate,Bag,Enchanting Bag,Engineering Bag,Herb Bag,Soul Bag,Arrow,Bullet,Ammo Pouch,Quiver,Bows,Crossbows,Daggers,Guns,Fishing Pole,Fist Weapons,Miscellaneous,One-Handed Axes,One-Handed Maces,One-Handed Swords,Polearms,Staves,Thrown,Two-Handed Axes,Two-Handed Maces,Two-Handed Swords,Wands


===Unit Types for target===
===Unit Types for target===
All occurrences of # correlate to a numerical position in the group. You may combine them together, as well. (ex. pettarget)
All occurrences of # correlate to a numerical position in the group. You may combine them together, as well. (ex. pettarget)
:target
:target
:player
:player
Line 79: Line 115:
:npc - this means the target is an NPC. Note: "npc" is only valid if you are currently interacting with the NPC (e.g. the quest, flight path, merchant, gossip, or bank frame is open).
:npc - this means the target is an NPC. Note: "npc" is only valid if you are currently interacting with the NPC (e.g. the quest, flight path, merchant, gossip, or bank frame is open).


;See also: [[UnitId]]
;See also
: [[UnitId]]


== Examples ==
== Examples ==
Line 86: Line 123:


*This will cast Flash Heal on target; but it will cast it on yourself if your target is hostile, or dead, or you have no target, or if you right-click the button.
*This will cast Flash Heal on target; but it will cast it on yourself if your target is hostile, or dead, or you have no target, or if you right-click the button.
  /cast [target=self, btn:2][target=focus, help, nodead, exists][target=player] Flash Heal  
  /cast [target=self, btn:2][target=focus, help, nodead, exists][target=player] Flash Heal
: Let's analyze:  
: Let's analyze:
  ...[target=player, btn:2]...  
  ...[target=player, btn:2]...
: The script sets the target of the spell to yourself, and checks to see if you right-clicked. If you did, it skips the next two option sets and casts Flash Heal, keeping the '''target''' it set (you). If you didn't r-click, it checks the next option set:
: The script sets the target of the spell to yourself, and checks to see if you right-clicked. If you did, it skips the next two option sets and casts Flash Heal, keeping the '''target''' it set (you). If you didn't r-click, it checks the next option set:
  ...[target=focus, help, nodead, exists]...
  ...[target=focus, help, nodead, exists]...
: It sets the target of the spell to whatever your current target (focus) is. If the target is friendly ('''help''') AND it's alive ('''nodead''') AND you actually have something selected ('''exists'''), then it skips the next option set and casts Flash Heal, again keeping the target it set (focus). Otherwise, if any of those conditions are not true, it checks the next option set:
: It sets the target of the spell to whatever your current target (focus) is. If the target is friendly ('''help''') AND it's alive ('''nodead''') AND you actually have something selected ('''exists'''), then it skips the next option set and casts Flash Heal, again keeping the target it set (focus). Otherwise, if any of those conditions are not true, it checks the next option set:
  ...[target=player]
  ...[target=player]
: Since there are no conditions in this set, it just casts Flash Heal, again keeping the target it just set (you).
: Since there are no conditions in this set, it just casts Flash Heal, again keeping the target it just set (you).

Revision as of 01:38, 29 March 2015

Slash commands



Casts the first spell for which the options are true.

/cast optionset spellname; optionset spellname; ...
/cast item
/cast BagId slot
/cast InvSlot

Aliases

cast
spell
use

Arguments

optionset
List of options below, separated by commas, enclosed in [ ]
spellname
Name of the spell to cast
item
The name of the item to be used.
BagId
The bag the item is in (0 is backpack, etc...)
slot
The slot number, starting at 1.
InvSlot
The slot on your character in which to use an item.

Optionset

You may use "no" in front of any of these to invert the logic result. All of the options below except target are actually conditions that the script will check before casting the spell. If any of the conditions in a set are false, the script will move on to the next option set, or the next semicolon (;) if there are no more; if all of the conditions in a set are true, the script will ignore any more option sets and cast spellname. Once it successfully casts a spellname, the rest of that line is ignored (see Examples at bottom).

Because target= is a command (not a condition), you can use multiple option sets to automatically cast the spell on the appropriate target (see Examples at bottom).

actionbar ⇔ bar
If you are using this particular actionbar. You must specify actionbar:# (#=action bar number).
button ⇔ btn
If you clicked a particular button to cast the spell (button:#, where #=1-5, LeftButton, MiddleButton, RightButton, Button4, or Button5).
channeling
If you are channeling a spell. You may optionally specify a specific spell using spell:spellname.
combat
If you are in combat.
dead
If the target is dead.
equipped ⇔ worn
If you are currently equipping a specific item, item of a particular class or subclass, or have an item in a particular slot. (ex. equipped:item, see below for details).
exists
If the target exists (case insensitive).
flyable
If you are in an area where flying is allowed.
flying
If you are flying.
group
If you are in a group. You may optionally specify group:party or group:raid.
harm ⇔ nohelp
If target is hostile.
help ⇔ noharm
If target is friendly.
indoors
If your are indoors (anywhere you cannot mount is considered indoors).
modifier ⇔ mod
If the click is modified with shift, ctrl, or alt. You may optionally specify which one by using modifier:key (key=shift, ctrl, or alt).
mounted
If you are mounted.
outdoors
You are outdoors (anywhere you can mount is considered outdoors).
party
If the target is in your party.
pet
If your pet exists. You may optionally specify a type of pet (pet:type, where type=cat,boar,ravager,etc...)
raid
If the target is in your raid.
stance &hArr; form
If you are in a particular stance. May also use stance:# to specify a particular stance (#=stance number).
spec
If you are using the specified talent specialization (spec:1 or spec:2).
talent<row>/<col>
If you are using the specified talent (talent:1/1 to talent:6/3).
stealth
If you are stealthed.
swimming
If you are swimming.
target=UnitId ⇔ @UnitId
Casts on a specific target without changing your current target (see table below).
unithasvehicleui
If the target of the macro has a vehicle UI.
vehicleui
If the player has a vehicle UI.

Spellname

As of Patch 2.3.2 cast command toggles toggleable abilities on and off. Prefixing the name with an exclamation mark prevents this.

Examples of toggleable abilities are Stealth and Shoot.

Item Types for equipped

Slots
Two-Hand,Bag,Shirt,Chest,Back,Feet,Finger,Hands,Head,Held In Off-hand,Legs,Neck,Ranged,Chest,Off Hand,Shoulder,Tabard,Thrown,Trinket,Waist,One-Hand,Main Hand,Off Hand,Wrist
Item Types
Armor,Container,Projectile,Quiver,Weapon
Item Sub-Types
Cloth,Idols,Leather,Librams,Mail,Miscellaneous,Shields,Totems,Plate,Bag,Enchanting Bag,Engineering Bag,Herb Bag,Soul Bag,Arrow,Bullet,Ammo Pouch,Quiver,Bows,Crossbows,Daggers,Guns,Fishing Pole,Fist Weapons,Miscellaneous,One-Handed Axes,One-Handed Maces,One-Handed Swords,Polearms,Staves,Thrown,Two-Handed Axes,Two-Handed Maces,Two-Handed Swords,Wands

Unit Types for target

All occurrences of # correlate to a numerical position in the group. You may combine them together, as well. (ex. pettarget)

target
player
pet
none - forces no target, even if auto-self casting is enabled.
focus
party#
partypet#
raid#
raidpet#
mouseover
npc - this means the target is an NPC. Note: "npc" is only valid if you are currently interacting with the NPC (e.g. the quest, flight path, merchant, gossip, or bank frame is open).
See also
UnitId

Examples

  • This will revive the pet if it is out and dead, call the pet if it is not out, or mend the pet if it is out and alive
/cast [target=pet,dead] Revive Pet; [nopet] Call Pet; Mend Pet
  • This will cast Flash Heal on target; but it will cast it on yourself if your target is hostile, or dead, or you have no target, or if you right-click the button.
/cast [target=self, btn:2][target=focus, help, nodead, exists][target=player] Flash Heal
Let's analyze:
...[target=player, btn:2]...
The script sets the target of the spell to yourself, and checks to see if you right-clicked. If you did, it skips the next two option sets and casts Flash Heal, keeping the target it set (you). If you didn't r-click, it checks the next option set:
...[target=focus, help, nodead, exists]...
It sets the target of the spell to whatever your current target (focus) is. If the target is friendly (help) AND it's alive (nodead) AND you actually have something selected (exists), then it skips the next option set and casts Flash Heal, again keeping the target it set (focus). Otherwise, if any of those conditions are not true, it checks the next option set:
...[target=player]
Since there are no conditions in this set, it just casts Flash Heal, again keeping the target it just set (you).