Results 1 to 10 of 17

Thread: kMacro

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default kMacro

    Major Update

    For any previous users of kMacro, this latest version is completely different in functionality and usage. I felt the previous method, while functional, was far too frustrating from a usability standpoint when you wanted to have multiple, unique conditional checks and macros for the same parent macro. This new version has a system that attempts to alleviate that issue by (theoretically) allowing an infinite number of conditional checks and substitutions within the same single base parent macro. For a visual explanation (and much more detail of what you see in the addon), check out the new video tutorial at the bottom.

    The simplest use-case for kMacro now is as follows:

    1. You have a macro that you would like to automatically, conditionally change some or all parts of.
    2. Create an Instance of this parent macro in kMacro.
    3. Create the base Body text of the macro and insert any number of Insertion Points within the text.
    4. Create any number of matching Insert Chunks using the custom code syntax.
    5. Watch kMacro automatically insert your Insert Chunks into your base macro at the Insertion Points when appropriate.
    6. ???
    7. Profit

    Macro Body Text & Insertion Points

    The Body Text (or just Body) of your macro Instance is where most of your normal macro text will go. Typically you'll want to insert a fairly normal macro for the Body to begin, then decide where to place Insertion Points for dynamic content.

    Insertion Point

    Insertion Points are text strings placed anywhere within the Body text to indicate the location of the matching Insert Chunk.

    Insertion Point Syntax
    $ [ $ ]
    You may use any number of Insertion Points within your macro Body. When a matching Insert Condition is met, the appropriate Insert Chunk will be dynamically placed at that specified Insert Point location and your macro will be updated.

    Insertion Points are indexed or numbered from left to right in the Body text, therefore in the following example:

    /cast [mod:shift] $; [mod:ctrl] $; $
    ...we have 3 Insertion Points. #1 is after mod:shift, #2 after mod:ctrl, and #3 at the very end. Each Insertion Point is matched with the appropriate index of the Insert string specified below.


    Each macro Instance can have any number of Inserts specified. Simply start typing an Insert and hit "Accept" to create a new Insert (or conversely delete the text of an Insert to delete it entirely). Inserts use a custom syntax to greatly streamline the process of creating logical evaluations and from those conditions, determine what (if any) Insert Chunk text should be placed in the appropriate Insert Point location in your macro.

    The full syntax for Inserts is as follows:
    d [ . | s | t | + | / | ( | ) ] ? INSERT_TEXT [ . INSERT_TEXT ]
    The usage of each term will be explained in detail below, but the basic creation of an Insert requires two things: A set of Conditions, a separator (?), and a set of matching Insert Chunks.

    Thus, the most basic Insert you can create is:

    d ? Spell_Name
    The first/left half of the statement is the set of Conditions (which in this case is simply "d" for Default), and the right half is our set of matching Insert Chunks (simply the name of our spell we want to insert by default). The required separator character of a question mark splits them appropriately.

    d - Default: Specifies the Default condition that is used as a fallback if all other Conditions fail within this Insert.

    d ? Moonfire
    The above Insert indicates that by Default (which always evaluates to true), insert the Insert Chunk "Moonfire" into the matching Insertion Point.

    . - Period: A separator required to indicate the separation point of two unique Conditional strings or Insert Chunk strings. There must always be the same number of Conditional strings as Insert Chunks in any given Insert, which means both sides of the Insert should always contain the same number of Period separators.

    s# - Specialization: Indicates a specific Specialization for the player to have active for this Condition to be true (e.g. Protection, Balance, Destruction, etc.). The numerical value is the index of the Specialization as used in API_GetSpecializationInfo().

    d . s3 ? Moonfire . Mangle
    The above Insert has 2 Conditional strings and two matching Insert Chunks. The period separators on each side mark where each section is split, so that to the addon, the split actually looks like this:

    Index: 1 - Condition: d - Insert Chunk: Moonfire
    Index: 2 - Condition: s3 - Insert Chunk: Mangle

    kMacro attempts to find a "true" Condition within each Insert that is not a Default Condition first, and only falls back to the Default Condition Insert Chunk if no other Condition is found to be "true". Therefore, in the above example if we are Specialization #3, our Index#2 Condition will be "true" and thus our Insert Chunk will be "Mangle".

    t# - Talent: Indicates a specific Talent for the player to have active for this Condition to be true. Talents are numbered from the top left of your talent pane, going across the right, and then down each subsequent row. The numerical value is the index of the Talent as used in API_GetTalentInfo().

    d . s3 . t3 ? Moonfire . Mangle . Wild Charge
    Similar to the previous example, the above Insert now adds a third Index or set of Condition/Insert Chunks. Now we're also checking if we have Talent 3 enabled (Wild Charge for Druids) and if so, our Insert Chunk is the appropriate spell name. However, kMacro will only activate and utilize the Insert Chunk of the first non-Default Condition to evaluate "true" that it find -- therefore the above example may not always be appropriate. If you are simultaneously both Specialization 3 AND using Talent 3, the first "true" result will be used in your Insertion Point (in this case, Mangle is first).

    + - Plus [And]: A logical operator substitution for the Lua operator of the same name, and performs the same logical function. Useful for combining multiple Conditions into one logical verification.

    d . s3 + t3 ? Moonfire . Wild Charge
    In the above example, we've combined the two previous, separate Conditions of Specialization 3 and Talent 3 into one Conditional using our Plus "and" operator. Now if we have both Specialization 3 AND Talent 3, we use Insert Chunk "Wild Charge".

    / - Slash [Or]: Another logical operator substitution for the Lua operator of the same name that also performs the same logical function. Useful checking the logical status between multiple Conditions.

    d . s1 + t3 . s2 / s3 ? Moonfire . Wild Charge . Mangle
    In the above example, we are now using our Slash "or" operator to determine if we are either Specialization 2 or Specialization 3, and if either one, use Insert Chunk "Mangle".

    ( ) - Parentheses: Enclosed logical operators that function as they do in Lua as well, allowing forced logical groupings similar to mathematics or other languages.

    d . t3 + s2 / s3 ? Moonfire . Wild Charge
    The above example is how NOT to create a good Condition. When evaluated, our second Condition will actually check if both Talent 3 AND Specialization 2 are active, and if so use Insert Chunk "Wild Charge", but if Talent 3 is not active, it will check for Specialization 3 instead. This looks like this written out in code:

    t3 and s2 or s3
    Lua will evaluate that as follows:

    if (t3 == true) then 
       return (s2 == true)
       return (s3 == true)
    Whereas a common intention is actually this:

    if (t3 == true) and (s2 == true or s3 == true) then
       return true
    To resolve this, we need to use parenthesis, just like in a mathematics equation, to purposely specify logical chunks where necessary:

    d . t3 + (s2 / s3) ? Moonfire . Wild Charge
    Insert Chunks

    An Insert Chunk is simply a chunk of text or string that will be inserted into the appropriate Insert Point when the matching Condition evaluates to "true". An Insert Chunk can contain any valid WoW macro text or characters, up (theoretically) an entire macro string if desired.

    If you decide to use this thing and need additional help, don't hesitate!
    Last edited by Kulldam; 09-13-2012 at 08:14 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