Powered by MediaWiki

  Page  Discussion  View source  History 

Combat Macros

From TheKolWiki

Commonly called BALLS (Basic Automated Loathing Language Scripts), the Combat Macro system was introduced on April 20, 2010. Its design intent is to reduce the amount of real life time spent during combat.

Players may create combat macros by going to their account menu, clicking "Combat", then selecting "Manage Your Combat Macros". From there players may also edit existing macros. This page is intended to be an API-like (Application Programming Interface) guide to show the various commands that you can execute within a combat macro.

Contents

Language Gotchas

Linebreaks matter for the structure of the language. A statement cannot span multiple lines, it must all be on one line to be interpreted correctly. So a statement such as:

 if monstername beanbat || monstername ratbat || monstername octorok
     skill saucegeyser
 endif

is a legal set of statements. However:

 if   monstername beanbat 
   || monstername ratbat 
   || monstername octorok
     skill saucegeyser
 endif

is not a legal set of statements, because the conditional portion of the if statement is not all on one line.

The semicolon(;) is treated the same as a line break character. You can use multiple commands on the same line using semicolons.

 abort hpbelow 20; skill entangling noodles; attack; repeat

is equal to

 abort hpbelow 20
 skill entangling noodles
 attack
 repeat

You cannot put a semicolon inside a quoted string, as it would interpret anything after the semicolon as separate commands.

Meta-Commands

  • A Meta Command is a command which doesn't really do anything for flow control, providing actions, or decision making. These commands can be anywhere in the script.

icon [image]

  • You can set the icon that will be used for your combat macro in the CAB to any item image within KoL. You'll need to know the graphic name of the item – click on the item to see its description box, then right-click on the picture and choose to view image information – and then simply add the line "icon [imagename]" to your macro, not including the .gif suffix.

scrollwhendone

  • Automatically scrolls to the bottom of the page.

Basic Commands

  • The basic commands are those which actually perform an action on your behalf, be it attacking a monster, or healing yourself, or running away like a sissy.

attack

  • Performs a normal attack on the monster with your current weapon.

jiggle

  • Jiggle your chefstaff.

runaway

  • Runs away from the monster. You gutless worm.

skill [skill name or skill ID]

  • Executes the skill named. Fuzzy matching works, but only on the first part of the skill name. So "skill entangling" would work, but "skill noodles" would not.
  • If you don't have the skill, or lack the MP to cast it, the macro will abort.
  • cast may be used instead of skill.

summonspirit

  • Tries to summon your current pasta ghost.
  • If you can't summon the ghost for whatever reason – wrong class, too many summons today, no ghost – the summon will not take place, but the macro will NOT abort.

pickpocket

  • Attempts to pickpocket the monster.
  • If you don't have the pickpocket skill, or don't have the jump on the monster, the pickpocket will not fire, but the macro will not abort.

use [item1] [,item2]

  • Uses a combat item (or funkslings two items) against the monster.
  • Just like with skill, you can use the item name or item ID. Once again, when using item names, you can use fuzzy matching, but only on the start of the item name. So "use blowout" won't work, but "use divine blow" will. (Divine blow, hee! Ahem. Winners don't use drugs.)
  • If you don't have any of the items you're trying to use – or if you try to funksling the same item twice, but only have one of them – the macro will abort.
  • Item names must always be separated by commas when two items are defined.

Macro Control Commands

  • Control commands help control the logical flow of the script. They provide functionality like conditional branching, looping, jumping, and labeling.

abort [predicate]

  • When defined with a predicate, defines a condition that will cause the macro to return control to the player if that condition is encountered at any time during the macro's execution.
  • At every step of the macro, ALL abort conditions that have been defined to date are checked, and the macro aborts if any of those conditions are true.

repeat [predicate]

  • When listed without a predicate, continues to repeat the previous action until the macro aborts.
  • When listed with a predicate, continues to repeat the previous action as long as the predicate condition is found to be true.

mark [name]

  • Defines a tag for a place in the macro where you will want to return at a later time.
  • Example: mark a defines the name "a" for later use via the "goto" command (see below).
  • Do not use mark to define the same name twice! The second instance of that name will never be jumped to. Er, will never be visited by a goto command.

goto [name] [predicate]

  • Set the macro to start executing commands just after a name previously defined with mark.
  • If used with a predicate, the jump will only take place if the predicate is true.

while [predicate] ... endwhile

  • "While" and "endwhile" are like bookends that are placed around a series of macro commands. All of the commands will be executed repeatedly as long as the predicate statement is true.

if [predicate] ... endif

  • "If" and "endif" are also bookends that are placed around a series of macro commands. These commands will be executed once (not repeatedly) as long as the predicate condition is true.

sub [name] ... endsub

  • "Sub" and "endsub" are also like bookends placed around a series of macro commands. The commands within these bookends are called a subroutine. A subroutine's commands are not executed as part of the normal flow of the script, but are only executed when explicitly referenced elsewhere in the macro with "call".

call [name]

  • Calls a subroutine which is defined by "sub [name]".

Boolean Logic Connectors

  • Boolean Logic constructs help you by allowing you to chain together multiple conditions for a single Control Statement.

!

  • ! means "NOT". You use this at the start of a predicate to indicate that you're testing whether the condition is NOT present. So for example, a normal predicate might be "hpbelow 50" ... this will evaluate as true if the player's hit points are lower than 50. If you preface this with a bang (kapow!), as "!hpbelow 50", it will evaluate as true if the player's hit points are 50 or higher.

&&

  • && means "AND". When you connect two predicates with an AND, the collective predicate will be set to true only if both predicates are true. For example, let's say your current HP is 40 and your current MP is 60. The following predicate will evaluate as false: "hpbelow 50 && mpbelow 50". Even though the first predicate is true, the second is false, so the whole enchilada ends up being false.

||

  • || means "OR" – and please note that those aren't uppercase is. They're vertical lines, known as "pipes", which you get by typing shift-backslash on a Windows keyboard. When you connect two predicates with an OR, the collective predicate will be set to true if either predicate is true. Going back to our previous example, where your current HP is 40 and your current MP is 60, the following predicate will evaluate as true: "hpbelow 50 || mpbelow 50". Since the first predicate is true, the entire predicate group is declared to be true, even though the second bit is as false as Dick Cheney selling Girl Scout cookies.

( ... )

  • Conditions inside parentheses will get tested first, and grouped into a single evaluated predicate before the rest of the group is tested. This allows you to do some more complicated bits of logic that will make you a tiny god of gameplay automation, and will probably not help you get a date this weekend.

Predicates

  • Predicates are other calls you can make to the API, these are meant to help you by giving you the ability to look at your character's state, or the state of the combat.

times [x]

  • Evaluates as true if the condition has been checked X or more times.

hpbelow [x]

  • Evaluates as true if the player's HP is below the number expressed by X.

hppercentbelow [x]

  • Evaluates as true if the player's HP is below the percentage expressed by X as a value of the player's max HP. (Example: if your maximum HP is 200, "hppercentbelow 25" will be true if your current HP is 50 or lower.)

mpbelow [x]

  • Evaluates as true if the player's MP is below the number expressed by X.

mppercentbelow [x]

  • Evaluates as true if the player's MP is below the percentage expressed by X as a value of the player's max MP.

didcritical [x]

  • Evaluates as true if the player has performed X critical hits or more during this fight.
  • Once this condition has been evaluated as true, the "# of critical hits" counter resets to zero.

beenhit [x]

  • Evaluates as true if the player has been hit by the monster X or more times during this fight.
  • Once this condition has been evaluated as true, the "# of hits by monster" counter resets to zero.

missed [x]

  • Evaluates as true if the player has missed the monster X times or more when using a normal attack during this fight. Fumbles and glancing blows both count as misses.
  • Once this condition has been evaluated as true, the "# of missed attacks" counter resets to zero.

familiarattacked [x]

  • Evaluates as true if the player's familiar has done damage or deleveled the monster X or more times during this fight.
  • Once this condition has been evaluated as true, the "# of familiar attacks" counter resets to zero.

gotjump

  • Evaluates as true if the player got the jump on the monster at the start of the fight.

pastround [x]

  • Evaluates as true if the current combat round number is greater than X. For example, "pastround 11" will be true on combat round 12 and higher.

haseffect [effect name or ID]

  • Evaluates as true if the player has the specified effect active. You can specify the effect to be checked using an effect ID, or an effect name.
  • Once again, you can use a partial effect name, but only with an initial match. So "haseffect whatsit" won't ever work, but "haseffect all covered" will test for the presence of the effect "All Covered in Whatsit".
  • Note that haseffect cannot identify intrinsic effects.

hascombatitem [item name or ID]

  • Evaluates as true if the player has any number of the indicated combat item. Second verse, same as the first: you can specify an item ID, or an item name.
  • Once again, you can use a partial item name, but only with an initial match. So "hascombatitem tooth" won't ever work, but "hascombatitem seal tooth" will test for the presence of the Seal Tooth.

match [string]

  • Evaluates as true if the specified string is found anywhere on the fight page during the previous round of combat only. You can use this to check for specific monster attacks, familiar actions, effects acquired, etc. (Note that the match predicate checks against HTML, not plaintext, so be careful if the string you're looking for contains any HTML tags etc.)
  • If your string contains spaces, you must enclose it within quotation marks. Currently, you cannot match a string that contains a quotation mark. We all feel your pain.
  • Use the * wildcard between foo and bar (e.g., "match foo*bar") to determine if the page contains strings foo and bar in that order, separated by any other text.

monstername [string]

  • Evaluates as true if the specified string matches the monster you are fighting.
  • Once again, you can use the * wildcard for partial matches on monster names. Example: "monstername *vegan chef" will return true if you are fighting any of the vegan chefs (filthy vegan chef, crusty vegan chef, or dirty vegan chef).

hasskill [skill name or ID]

  • Evaluates as true if the skill is available for use, as deemed by the combat drop-down selection boxes.
  • This will evaluate to false if you have the skill, but do not have the MP to use it.

happymediumglow [medium color]

  • Evaluates as true if your Happy Medium's aura color matches the specified color exactly.
  • The options that it'll recognize are none, blue, orange, and red.
  • This will work even if your Medium is in your Terrarium.

monsterhpabove [x]

  • Evaluates as true if monster HP is above X.
  • Requires Monster Manuel to provide HP information.

monsterhpbelow [x]

  • Evaluates as true if monster HP is below X.
  • Requires Monster Manuel to provide HP information.

sealclubber

  • Evaluates as true if current character class matches.

turtletamer

  • Evaluates as true if current character class matches.

pastamancer

  • Evaluates as true if current character class matches.

sauceror

  • Evaluates as true if current character class matches.

discobandit

  • Evaluates as true if current character class matches.

accordionthief

  • Evaluates as true if current character class matches.

muscleclass

  • Evaluates as true if current character class matches.

mysticalityclass

  • Evaluates as true if current character class matches.

moxieclass

  • Evaluates as true if current character class matches.

snarfblat [x]

  • Evaluates as true if combat is taking place in zone with ID [x].

Notes

  • Macros will automatically abort when facing bosses or heroes.
  • It is possible to use comments (ignored by the game) by starting a line with a hash (#) symbol.
  • Trying to delete a macro without checking the confirm box:
You must click the box to confirm your intent to destroy your lovingly hand-crafted artisan macro.
This page was last modified on 12 February 2014, at 17:13.
This page has been accessed 31,202 times.
About TheKolWiki  Disclaimers
© 2005 - 2014 Coldfront L.L.C.
 
About Coldfront | Privacy Policy