KoLmafia Guide: Custom Combat Script

From Kolmafia
Revision as of 15:31, 19 January 2011 by imported>Pineapple of Despair
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Autoattacking is fine and all, but in many cases you want something a bit more sophisticated. Let's say we are a Disco Bandit, fighting the Giants in the Cloud Castle with plenty of MP regen. We want to use our Disco Bandit combo skill which makes the fight easier and gives us a 1 turn +30% meat buff. This would be a huge pain to do manually for every fight.

1) In the Mafia Frame, Click the 'Custom Combat' Bottom Tab when in the Adventure TopTab. You will see a script called "Default", and it has several lines: A [Default] folder-looking icon, followed by a 1: Special Action, and 2: Attack With Weapon.

Lesson5 default.png

This is what the script does:
When encountering a [default] monster or location, it will do any special action indicated under the Special box, as described in the last lesson. This includes Pickpocketing, or whatever.
On Round 2, it will Attack with Weapon.
On round 3 and beyond, it repeats the last action commanded, which in this case is Attack with Weapon. This continues until you have lost or won the fight.

2) We are gonna make our own script now! Click the NEW button at the bottom-right. Give it a name. This script is now selected instead of the "Default" custom script.

Note that we have the exact same 'default code' we saw in step 1. Note that [default] does NOT refer to the name of the script. It is simply a header referring to the series of actions it performs against a default monster or at a default location. In advanced scripts you can put in a [monster/location name] with special actions taken against just that monster or while fighting at just that location (Mafia automatically determines which of the two this is). This would be great for casting an elemental spell against a physical-resistant foe for example. For now, don't worry about it.

3) Click EDIT and modify our script. Go ahead and enter the following. For my example above, the script I described earlier would look like:

1: steal
2: skill disco dance of doom
3: skill disco dance II: electric boogaloo
4: attack

When you hit OK, it will interpret what you typed. For example, the keyword 'steal' turns into 'try to steal an item'. This script will pickpocket if applicable, do my 2 disco skills, then attack with weapon until end of combat.

Lesson5 DiscoAttack.png

A more flexible script would be to Use Special Action as the round 1 action. This would allow me to choose whether to pickpocket or not, based on what is in my Special box. For you, make the following script depending on your class:

line 1 - [default] (leave this line alone)
line 2 - 1: special action (leave this line alone too)
line 3 - add 2: skill <insert skill name here>
line 4 - 3: attack. (leave this line alone)

So really, all you did is add line 3 and renumber line 4 from 2: attack to 3: attack.

The only trick is to find the exact name of the desired skill. Pick one of your low-level skills like Clobber, Toss, a spell, Sing, or whatever your level 1 power is. Use your Relay Browser and click your top-left character profile to get the exact name. Type or Cut&Paste it in. Then hit OK.
The 'attack' command will turn into 'attack with weapon'. If you typed the skill in properly it should be in the script. Otherwise, Mafia will complain about an invalid skill. Note that the last entry is what the script will keep repeating until the combat is over.

For Reference, the HELP button will give you a list of the script commands. 'steal' is for pickpocketing, 'skill X' will perform the skill, X, you specify. 'item X' uses an item. There are several others to explore later.

4) Make sure the main KoLmafia Frame's 'Action:' pulldown shows 'custom combat script' as the active one, as opposed to 'attack with weapon'.

Lesson5 ccs.png

Next, make sure that your named script is selected, as opposed to that Default one.

Lesson5 cccName.png

5) Time to test it! Go fight something in the Relay Browser and click the Script button at top-left. Watch and see what it does. Did it work? Actually this might be a bit tricky to determine since Scripted attacks tend to skip browser refreshes. Instead, click the 'Graphical CLI' tab and see EXACTLY what your character did.

Bonus) Modify your script and add a 20: abort. This will instruct the script to abort as the 20th action (not necessarily the 20th round). It will pop up a mini-browser and you will finish the fight manually. This is a good catch-all safety feature in case you are fighting a physical immune with no elemental damage, or using a low-power 'disguise outfit' or trying to wield a melee weapon as a moxie-class, or whatever else went wrong.

BOTTOM LINE: Combat Scripts are very flexible and can help you take advantage of stuff you might normally be too lazy to do regularly such as Disco combos, Turtle Tamer Chains, Noodle Summons, and other repetitive things.

Continue to Lesson 6: Auto-Adventuring