Page 1 of 2
1
2
LastLast
  1. #1
    Deleted

    Macro syntax guide

    This guide is intended to give a quick and easy introduction to basic macro syntax. This should enable you to create various macros for your own use without having to wait for forum responses.

    The start of every macro is a slash command. For the purpose of this guide, we will be using /cast. However, any slash command that accepts macro options can be used.

    This is how your basic macro looks like:

    Code:
    #showtooltip
    /cast Spell1
    This macro contains of two lines. The first line is preceded by a #. This means it contains display information for bar addons.
    The line #showtooltip means that the tooltip for the first spell in the macro should be displayed on mouseover, and if the icon is set to the question mark icon, it will also update accordingly.

    The second line is the main macro. /cast Spell1 is a slash command that would cast the spell named "Spell1".

    Next, we have to get to the "intelligent" part of the macro.

    Macro options

    Every macro option specified in brackets is a if statement. The argument right after the brackets is the argument used if the macro option is met, a semicolon is a logical ELSE(IF) statement.
    If the options for the first argument are met, the rest of the line is never interpreted. The first match will always be used.

    Code:
    #showtooltip
    /cast [option]Spell1; Spell2
    If [option] is met (returns true), Spell1 is cast - otherwise Spell2 is cast.

    This can be expanded:
    Code:
    #showtooltip
    /cast [option1]Spell1; [option2]Spell2; Spell3
    If [option1] is met, it casts Spell1, otherwise if option2 is met, it casts Spell2, otherwise it casts spell3.

    You can also chain together multiple macro options as a logic AND by using a comma.
    Code:
    #showtooltip
    /cast [option1, option2]Spell1; [option3]Spell2; Spell3
    If both option1 and option2 are met, Spell1 is cast. Otherwise, if option3 is met, Spell2 is cast. Otherwise, Spell3 is cast.

    You can chain multiple options together by simply listing them one after another.
    Code:
    #showtooltip
    /cast [option1][option2]Spell1; Spell2
    If either option1 or option2 is met, Spell1 is cast. If neither is met, Spell2 is cast.

    Any option can be reversed by adding "no" in front of it.
    Code:
    #showtooltip
    /cast [nocombat]Spell1; Spell2
    Cast Spell1 if [combat] is not true, otherwise cast Spell2.
    This is equivalent to:
    Code:
    #showtooltip
    /cast [combat]Spell2; Spell1
    Some options have sub-options. For example, the [mod] option has three sub-options. shift, alt and ctrl. If you just specify [mod], that means that any of the sub-options needs to be true in order for the option to be true.
    You can specify a specific sub-option that needs to be met by using the following syntax:
    Code:
    [option:suboption]
    If you only want to cast Spell1 while shift is down, use this:
    Code:
    #showtooltip
    /cast [mod:shift]Spell1; Spell2
    Now you can use what I described above to stick together all kinds of constructs.
    Code:
    #showtooltip
    /cast [mod:shift, combat]Spell1; [mod:shift]Spell2; [combat]Spell3; Spell4
    If shift is down during combat, cast Spell1. If shift is down but we are not in combat (otherwise Spell1 would have been cast, this is why we don't have to specify [nocombat]), cast Spell2. If we are in combat but shift is not down (otherwise Spell1 would have been cast, this is why we don't do [nomod:shift]), Spell3 is cast. If we are neither in combat nor shift is down (either combination of those would trigger one of the earlier ones), Spell4 is cast.
    Last edited by mmocba105e19de; 2011-06-26 at 04:06 PM.

  2. #2
    Deleted
    nice explanation. however, i'm missing a bit about the /run command. it could be useful for those that are a bit more advanced.

  3. #3
    Deleted
    /run runs a given Lua script. That's Lua syntax, not macro syntax (/run does not accept any macro options).
    Last edited by mmocba105e19de; 2011-12-02 at 04:21 PM.

  4. #4
    Deleted
    Does the /run even exist anymore?

  5. #5
    Deleted
    Of course.

  6. #6
    Might want to point users to http://www.macroexplain.com/ Does a great job of explaining what a macro does (and could be used to check whether something will run the way the user wants it to, by following the logic in simple english. (I use it as a length test as well)

  7. #7
    Deleted
    Well i had problems with /run no idea why tho..

  8. #8
    Deleted
    The Ask it! Macro thread could probably help you.

  9. #9
    Good thread. I had always wondered exactly how the logic worked in the macro stuff. Never really bothered to look into it. Thanks Treeston!

    Brusalk - Awesome resource!

    I don't care if you're bad, just don't be a bitch... word.

  10. #10
    Deleted
    I haven't checked absolutely everything everywhere, i.e. documentation, but is it possible to cast a spell in only a macro using its "spell id"? I ask because it seems that in some situations (namely tanking since at least patch 4.0.3a) the names of player spells and vehicle commands overlap/identical and seem to result in a shared cooldown of the two spells. It made me wonder if it would be possible to guarantee calling a player spell by using its "spell id"? Not that I expect the command to somehow be off the shared cooldown just because you can identify it precisely, but it may be worth a try.

  11. #11
    Deleted
    Code:
    /cast spell:00000
    This, possibly. (00000 is the ID, obviously). Unsure if it actually will work.

  12. #12
    Try [@mouseover]

  13. #13
    Nice info, thx.

  14. #14

  15. #15
    Deleted
    Thx alot!!!

  16. #16
    Deleted
    one question, is there a simple way to negate an option?
    For example, there is [nopet]. If I want an action to be executed every time i DO have a pet (WL), the only way I know how is all of [pet:Felhunter][pet:Succubus][pet:imp] etcetc. If e.g. "!" was used to negate options, I could just use [!nopet]. Is there anything lilke this?
    Last edited by mmocdd8e41448a; 2011-03-24 at 12:01 PM.

  17. #17
    Deleted
    Just use [pet]?

  18. #18
    Deleted
    Quote Originally Posted by Treeston View Post
    Just use [pet]?
    D'OH!
    actually now that you pointed it out, it's totally clear to me that pet:Imp etc are just suboptions and [pet] works. didn't see that before^^ but now, [!nopet] looks a little stupid^^

    But I still would be interested if a negation is possible. the example I gave, though, was obviously not useful^^

  19. #19
    The no part is the negation. [dead] -> [nodead], [exists] -> [noexists], etc. It works with all conditionals. Conversely, to negate [nodead], [noexists], etc, just remove the no.

  20. #20
    Deleted
    Quote Originally Posted by Renowned View Post
    The no part is the negation. [dead] -> [nodead], [exists] -> [noexists], etc. It works with all conditionals.
    All right, thanks. Actually after that stupid example I gave, I also couldn't think of any other that couldnt be solved by [noXXX]. I'll be back if I can .
    Last edited by mmocdd8e41448a; 2011-03-24 at 12:46 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •