Class StrictMacro

BALLS macro builder for direct submission to KoL. Create a new macro with new Macro() and add steps using the instance methods. Uses a fluent interface, so each step returns the object for easy chaining of steps. Each method is also defined as a static method that creates a new Macro with only that step. For example, you can do Macro.skill('Saucestorm').attack().

Hierarchy (view full)

Constructors

Properties

components: string[] = []
name: string = MACRO_NAME
cachedAutoAttacks: Map<string, string> = ...
cachedMacroIds: Map<string, number> = ...
SAVED_MACRO_PROPERTY: string = "libram_savedMacro"

Methods

  • Adds an "abort" step to this macro, with a warning message to print

    Parameters

    • warning: string

      The warning message to print

    Returns this

    This object itself.

  • Conditionally add a step to a macro based on a condition evaluated at the time of building the macro.

    Parameters

    • condition: boolean

      The JS condition.

    • ifTrue: string | Macro

      Continuation to add if the condition is true.

    • OptionalifFalse: string | Macro

      Optional input to turn this into an if...else statement.

    Returns this

    This object itself.

  • Add an "if" statement to this macro.

    Parameters

    • condition: PreBALLSPredicate

      The BALLS condition for the if statement.

    • ifTrue: string | Macro

      Continuation if the condition is true.

    Returns this

    This object itself.

  • Create an if_ statement based on what holiday of loathing it currently is. On non-holidays, returns the original macro, unmutated.

    Parameters

    • macro: Macro

      The macro to place in the if_ statement

    Returns this

    This macro with supplied macro wapped in if statement matching holiday wanderers

  • Add an "if" statement to this macro, inverting the condition.

    Parameters

    • condition: PreBALLSPredicate

      The BALLS condition for the if statement.

    • ifTrue: string | Macro

      Continuation if the condition is true.

    Returns this

    This object itself.

  • Create an if_ statement based on what holiday of loathing it currently is. On non-holidays, returns the original macro, with the input macro appended.

    Parameters

    • macro: Macro

      The macro to place in the if_ statement.

    Returns this

    This macro with supplied macro wrapped in if statement matching monsters that are not holiday wanderers

  • Add one or more item steps to the macro.

    Parameters

    • Rest...items: (Item | [Item, Item])[]

      Items to use. Pass a tuple [item1, item2] to funksling.

    Returns this

    This object itself.

  • Gives your macro a new name to be used when saving an autoattack.

    Parameters

    • name: string

      The name to be used when saving as an autoattack.

    Returns this

    The macro in question

  • Add a repeat step to the macro.

    Parameters

    • Optionalcondition: PreBALLSPredicate

      The BALLS condition for the repeat statement, optional.

    Returns this

    This object itself.

  • Save a macro to a Mafia property for use in a consult script.

    Returns void

  • Renames the macro, then sets it as an autoattack.

    Parameters

    • name: string

      The name to save the macro under as an autoattack.

    Returns void

  • Add one or more skill cast steps to the macro.

    Parameters

    • Rest...skills: Skill[]

      Skills to cast.

    Returns this

    This object itself.

  • Statefully add one or several steps to a macro.

    Parameters

    • Rest...nextSteps: (string | Macro)[]

      The steps to add to the macro.

    Returns this

    This object itself.

  • Submit the built macro to KoL. Only works inside combat.

    Returns string

    Contents of the fight page after macro submission

  • Add one or more item steps to the macro, where each step checks to see if you have the item first.

    Parameters

    • Rest...items: (Item | [Item, Item])[]

      Items to try using. Pass a tuple [item1, item2] to funksling.

    Returns this

    This object itself.

  • Add one or more skill cast steps to the macro, where each step checks if you have the skill first.

    Parameters

    • Rest...skills: Skill[]

      Skills to try casting.

    Returns this

    This object itself.

  • Add one or more skill-cast-and-repeat steps to the macro, where each step checks if you have the skill first.

    Parameters

    • Rest...skills: Skill[]

      Skills to try repeatedly casting.

    Returns this

    This object itself.

  • Add a "while" statement to this macro.

    Parameters

    • condition: PreBALLSPredicate

      The BALLS condition for the while statement.

    • contents: string | Macro

      Loop to repeat while the condition is true.

    Returns this

    This object itself.

  • Create a new macro with an "abort" step.

    Type Parameters

    Parameters

    • this: Constructor<T>

    Returns T

    This object itself.

  • Create a new macro with an "abort" step to this macro, with a warning message to print

    Type Parameters

    Parameters

    • this: Constructor<T>
    • warning: string

      The warning message to print

    Returns T

    This object itself.

  • Create a new macro with an attack step.

    Type Parameters

    Parameters

    • this: Constructor<T>

    Returns T

    This object itself.

  • Create a new macro with a condition evaluated at the time of building the macro.

    Type Parameters

    Parameters

    • this: Constructor<T>
    • condition: boolean

      The JS condition.

    • ifTrue: string | Macro

      Continuation to add if the condition is true.

    • OptionalifFalse: string | Macro

      Optional input to turn this into an if...else statement.

    Returns T

    This object itself.

  • Create a new macro with an "if" statement.

    Type Parameters

    Parameters

    • this: Constructor<T>
    • condition: PreBALLSPredicate

      The BALLS condition for the if statement.

    • ifTrue: string | Macro

      Continuation if the condition is true.

    Returns T

    This object itself.

  • Create a new macro starting with an ifHolidayWanderer step.

    Type Parameters

    Parameters

    • this: Constructor<T>
    • macro: Macro

      The macro to place inside the if_ statement

    Returns T

    New macro with supplied macro wrapped in if statement matching holiday wanderers

  • Create a new macro with an "if" statement, inverting the condition.

    Type Parameters

    Parameters

    • this: Constructor<T>
    • condition: PreBALLSPredicate

      The BALLS condition for the if statement.

    • ifTrue: string | Macro

      Continuation if the condition is true.

    Returns T

    This object itself.

  • Create a new macro starting with an ifNotHolidayWanderer step.

    Type Parameters

    Parameters

    • this: Constructor<T>
    • macro: Macro

      The macro to place inside the if_ statement

    Returns T

    New macro with supplied macro wrapped in if statement matching monsters that are not holiday wanderers

  • Create a new macro with one or more item steps.

    Type Parameters

    Parameters

    • this: Constructor<T>
    • Rest...items: (Item | [Item, Item])[]

      Items to use. Pass a tuple [item1, item2] to funksling.

    Returns T

    This object itself.

  • Load a saved macro from the Mafia property.

    Type Parameters

    Parameters

    • this: Constructor<T>

    Returns T

    Loaded macro text

  • Parameters

    • condition: PreBALLSPredicate

      The BALLS condition or a type to make a condition for (Monster, Item, Skill, etc.)

    Returns string

    The BALLS condition string

  • Creates a new Macro with a name other than the default name.

    Type Parameters

    Parameters

    • this: Constructor<T>
    • name: string

      The name to assign this macro.

    Returns T

    A new Macro with the assigned name.

  • Create a new macro with an "runaway" step.

    Type Parameters

    Parameters

    • this: Constructor<T>

    Returns T

    This object itself.

  • Create a new macro with one or more skill cast steps.

    Type Parameters

    Parameters

    • this: Constructor<T>
    • Rest...skills: Skill[]

      Skills to cast.

    Returns T

    This object itself.

  • Statefully add one or several steps to a macro.

    Type Parameters

    Parameters

    • this: Constructor<T>
    • Rest...nextSteps: (string | Macro)[]

      The steps to add to the macro.

    Returns T

    This object itself.

  • Create a new macro with one or more item steps, where each step checks to see if you have the item first.

    Type Parameters

    Parameters

    • this: Constructor<T>
    • Rest...items: (Item | [Item, Item])[]

      Items to try using. Pass a tuple [item1, item2] to funksling.

    Returns T

    This object itself.

  • Create a new macro with one or more skill cast steps, where each step checks if you have the skill first.

    Type Parameters

    Parameters

    • this: Constructor<T>
    • Rest...skills: Skill[]

      Skills to try casting.

    Returns T

    This object itself.

  • Create a new macro with one or more skill-cast-and-repeat steps, where each step checks if you have the skill first.

    Type Parameters

    Parameters

    • this: Constructor<T>
    • Rest...skills: Skill[]

      Skills to try repeatedly casting.

    Returns T

    This object itself.

  • Create a new macro with a "while" statement.

    Type Parameters

    Parameters

    • this: Constructor<T>
    • condition: PreBALLSPredicate

      The BALLS condition for the while statement.

    • contents: string | Macro

      Loop to repeat while the condition is true.

    Returns T

    This object itself.