New ASH functions to get enchantments for items, etc.

Veracity

Developer
Staff member
I've seen a number of requests from people who want to write scripts to optimize their outfits for Moxie, select equipment to maximize Spell Damage, or do various other things that need to look at the enchantments on equipment. (I've also seen people request that the Gear Changer show them things like that so they can work out their outfits in the GUI. But, that's a UI project, and thus falls into holatuwol's area of expertise; it will happen if and only if he finds it interesting someday. This is the KoLmafia scripting community, and I have a solution for scripts.)

You'll be happy to learn that with revisions 4461 and 4472, ASH provides access to a whole slew of modifiers.

- I programmatically parsed the Item Description page for every single item (2800+) and mined everything I could from it. I used that data to correct numerous errors in KoLmafia's internal database. KoLmafia now stores up to 41 numeric parameters and 2 strings for any given item, effect, or skill.

- You can access the modifiers by name. Here are the names for the numeric parameters:

"Cold Damage"
"Cold Resistance"
"Cold Spell Damage"
"Combat Rate"
"Critical"
"Damage Absorption"
"Damage Reduction"
"Experience"
"Familiar Weight"
"Fumble"
"Hot Damage"
"Hot Resistance"
"Hot Spell Damage"
"Initiative"
"Item Drop"
"Mana Cost"
"Maximum HP Percent"
"Maximum HP"
"Maximum MP Percent"
"Maximum MP"
"Meat Drop"
"Melee Damage"
"Monster Level"
"Moxie Percent"
"Moxie"
"Muscle Percent"
"Muscle"
"Mysticality Percent"
"Mysticality"
"Ranged Damage"
"Sleaze Damage"
"Sleaze Resistance"
"Sleaze Spell Damage"
"Spell Damage Percent"
"Spell Damage"
"Spooky Damage"
"Spooky Resistance"
"Spooky Spell Damage"
"Stench Damage"
"Stench Resistance"
"Stench Spell Damage"

Those apply to items, effects, skills, and your character as whole, taking worn items, active effects, and passive skills into account.

Items also have two potential string parameters:

"Class"
"Intrinsic Effect"

You can access these parameters from ASH using the following functions:

float numeric_modifier( string );
float numeric_modifier( item, string );
float numeric_modifier( effect, string );
float numeric_modifier( skill, string );
string string_modifier( item, string );

and you can convert the returned string of "Class" using:

class to_class( string );

I attach a little ASH program that demonstrates this feature.

I'll be tweaking this from now until the next version of KoLmafia is released. I'll add the modifiers for a bunch of effects, for example, and I know of a couple tricky things that need some work. But, if you wish to play with this before the next release and have any comments or suggestions, feel free. Just remember all the usual caveats regarding using Daily Builds.
 

Attachments

  • modifiers.ash
    3.6 KB · Views: 181

dangerpin

Member
I feel as though the clouds have parted and a golden ray of sunlight has illuminated the way to the fabled cities of Quivira and Cíbola.
 

Veracity

Developer
Staff member
Thanks!

A few changes/enhancements:

New numeric modifiers:

"HP Regen Min"
"HP Regen Max"
"MP Regen Min"
"MP Regen Max"

Boolean modifiers:

"Never Fumble"
"Single Equip"
"Softcore Only"
"Weakens Monster"

For completeness, a new string modifier on effects that equalize your stats to a particular stat.

"Equalize"

And since the string modifiers actually return a stat name, an effect name, or a class name, I got rid of "string_modifier" and added

stat stat_modifier( effect, string );
effect effect_modifier( item, string );
class class_modifier( item, string );

as well as

boolean boolean_modifier( string);
boolean boolean_modifier( item, string );

Regarding the raw data this uses:

- I went through the Wiki and added all effect modifiers
- I handle items that change with the moon, like the Jekyllin belt, Talisman of Baio, and Grimacite items.
- I handle Temporary Lycanthropy
- I handle Tuesday's ruby

Here's the latest version of modifiers.ash that shows how to use everything.
 

Attachments

  • modifiers.ash
    4.7 KB · Views: 196
Top