KoLmafia Guide: Custom Combat Script: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bale
No edit summary
imported>Pineapple of Despair
No edit summary
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Autoattacking is fine and all, but in many cases you want something a bit more sophisticated. For my example, I am a level 15 Disco Bandit, fighting the Giants in the Cloud Castle with plenty of MP regen. I want to use my Disco Bandit combo skill which makes the fight easier AND gives me a 1 turn +30% meat buff.
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) As an example, this is what I would do: (don't actually do anything for this step) In the Mafia Frame, I click the 'Custom Combat' Bottom Tab when in the Adventure TopTab. I see a script called "Default", and it has several lines: A [Default] folder, followed by a 1: Special Action, and 2: Attack With Weapon. This indicates the following:
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.
When encountering a [default] monster, on round 1: it will Use 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.
: [[File:Lesson5 default.png]]
: [[File:Lesson5 default.png]]
This is what the script does:<br>
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.<br>
On Round 2, it will Attack with Weapon. <br>
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.
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. In advanced scripts you can put in a [monster name] with special actions taken against just that monster. This would be great for casting an elemental spell against a physical-resistant foe for example. For now, don't worry about it.
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. For my example, My script I described earlier would look like:
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:
:[default]
:[default]
:1: steal
:1: steal
:2: skill disco dance of doom<br />
:2: skill disco dance of doom
:3: skill disco dance II: electric boogaloo<br />
:3: skill disco dance II: electric boogaloo
:4: attack<br />
:4: attack


When you hit OK, it will interpret what you typed. For example, the keyword 'steal' turns into 'try to steal an item'.
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.
This script will pickpocket if applicable, do my 2 disco skills, then attack with weapon until end of combat.
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.
: [[File:Lesson5 DiscoAttack.png]]
: [[File:Lesson5 DiscoAttack.png]]


For you, make the following script depending on your class:
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 1 - [default] (leave this line alone)
:line 2 - 1: special action (leave this line alone too)
:line 2 - 1: special action (leave this line alone too)
Line 31: Line 34:
So really, all you did is add line 3 and renumber line 4 from 2: attack to 3: attack.
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 Thrust-Smack, or a spell, or whatever. Use your Relay Browser and click your top-left character profile to get the exact name. Type it in, Hit OK. The 'attack' command will turn into 'attack with weapon'. Note that the last entry is what the script will keep repeating until the combat is over.
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.<br> 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.
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'.
4) Make sure the main KoLmafia Frame's 'Action:' pulldown shows 'custom combat script' as the active one, as opposed to 'attack with weapon'.
 
: [[File:Lesson5 ccs.png]]
Next, make sure that your named script is selected, as opposed to Default.
Next, make sure that your named script is selected, as opposed to that Default one.
: [[File: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.
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.
'''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.
'''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 [[KoLmafia Guide: Auto-Adventuring|Lesson 6: Auto-Adventuring]]
'''Continue''' to [[KoLmafia Guide: Auto-Adventuring|Lesson 6: Auto-Adventuring]]


[[Category:KoLmafia Guide]]
[[Category:KoLmafia Guide]][[Category:New User Help]]

Latest revision as of 15:31, 19 January 2011

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.

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:

[default]
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.

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'.

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

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