View Single Post
05-28-18, 05:11 AM   #6
aallkkaa
A Warpwood Thunder Caller
 
aallkkaa's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2017
Posts: 98
Ok, I know at least some if not all the people who replied here are far more knowledgeable Lua coders than myself (and in other languages too, I'm sure) , but regarding WoW macros, there were some inaccuracies in their readings of the OP's macro (possibly due to some confusion with Lua conventions?)

Breaking it down:
  • [] Square brackets are used to set a condition within themselves. There are several different types of tests and there is a particular one that is different from all the others, namely the next one on this list:
  • @ "At" (I don't know the actual name of the character in English) This is used inside square brackets (and only inside) to both:
    1. Set the unit the remainder of the tests should be applied against, and
    2. Have the /cast (or /castsequence or /use) be used on said unit (you may do this without any other "tests").
    At any rate, "the other tests" are the ones used inside the same square-brackets closure.
  • ---
  • INSIDE BRACKETS:
    • , Comma means AND;
    • / Slash means OR. There is an exception: [talent:1/1] means talent at row 1 and column 1 (more recent test than most all others; somehow Blizzard thought it a good idea to reuse the same character in a different context to convey a different meaning)
  • BETWEEN BRACKETS
    • [ ] [ ] One pair of brackets (conditions) after the other (spaces optional) means OR;
    • ; Semicolon means ELSE
  • TL;DR: You can use AND only inside a condition (pair of brackets). You can use OR both inside a condition and between conditions. You can use ELSE only between conditions (ELSEIF would be "; [condition]".


That being said, here is what Xancepants' original macro was doing:
*
Code:
/cast [mod:shift,@arena1];[mod:ctrl,@arena2];[mod:alt,@arena3]Cyclone
Does nothing if you hold the shift or ctrl keys down (as there is nothing between the condition [condition] and the semicolon. Would cast cyclone if you held down alt.

*
Code:
[harm]Solar Wrath;Lifebloom
Would cast Solar Wrath if your target were one you could cast harmful abilities on, or Lifebloom otherwise.

*
Code:
/cast [mod:ctrlshift,@focus]Cyclone
Would ERROR on mod:ctrlshift, thus do nothing. Incidentally, it would also almost never do anything if the condition were properly set ( [mod:ctrl,mod:shift,@focus]Cyclone ) because you would be under the GCD triggered by either Solar Wrath or Lifebloom when the macro came to that point (I'm assuming none of the three spells is off the GCD). The only case it would do something were if your target was not one you could harm and you didn't have auto selfcast on (where it would cast Lifebloom on yourself if you had no valid target for it).


This should work as intended:
Code:
#showtooltip
/cast [mod:ctrl,mod:shift,@focus][mod:shift,@arena1][mod:ctrl,@arena2][mod:alt,@arena3]Cyclone;[harm]Solar Wrath;Lifebloom
Do note you need to put [mod:ctrl,mod:shift] before [mod:shift] and [mod:ctrl], because otherwise those conditions will be evaluated to true and the macro execution will jump straight forward to the action to be performed, never reading the conditions that followed the first one that evaluated to true.

Last edited by aallkkaa : 05-28-18 at 05:12 AM. Reason: Fixed messed up tags
  Reply With Quote