<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.kolmafia.us/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ryo+Sangnoir</id>
	<title>Kolmafia - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.kolmafia.us/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ryo+Sangnoir"/>
	<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Special:Contributions/Ryo_Sangnoir"/>
	<updated>2026-04-30T16:10:12Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Installation&amp;diff=9247</id>
		<title>Installation</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Installation&amp;diff=9247"/>
		<updated>2025-01-06T17:21:53Z</updated>

		<summary type="html">&lt;p&gt;Ryo Sangnoir: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOCright}}&lt;br /&gt;
&lt;br /&gt;
== How to Download the latest version. ==&lt;br /&gt;
The latest source build can be downloaded from the following locations:&lt;br /&gt;
&lt;br /&gt;
# [http://builds.kolmafia.us/ builds.kolmafia.us] &lt;br /&gt;
# the [https://github.com/kolmafia/kolmafia/releases GitHub releases page].  &lt;br /&gt;
&lt;br /&gt;
Both of these sources have tested versions that are posted shortly after developers change code.&lt;br /&gt;
&lt;br /&gt;
The GitHub releases page contains both the KoLmafia-xxxxx.jar java binaries and installers for an experimental version that includes a bundled version of Java.  If you use the installers, they manage the Java dependency listed below, but it can be more difficult to troubleshoot issues.  &lt;br /&gt;
&lt;br /&gt;
== Dependencies==&lt;br /&gt;
&lt;br /&gt;
===Java 21 or higher===&lt;br /&gt;
KoLmafia depends on Java 21 or higher  The recommended version is linked at the top of every page of kolmafia.us.  If you are executing KoLmafia from a jarfile, you will need to install Java first.  &lt;br /&gt;
&lt;br /&gt;
If you do not have a recent version of Java, the recommended version (as of this writing) is [https://adoptium.net/index.html Java 21].  &lt;br /&gt;
&lt;br /&gt;
Oracle may have issues, for simplicity use [https://adoptium.net/temurin/releases/ Adoptium]. Any OpenJDK build should be okay too like [https://www.azul.com/downloads/#zulu Zulu Java].&lt;br /&gt;
&lt;br /&gt;
====Testing your Java installation====&lt;br /&gt;
From a Command Prompt (or Terminal) window, enter &amp;lt;code&amp;gt;java -version&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If that returns something like this, you should be good to go.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Michaels-MBP:~ mcroft$ java -version&amp;lt;br /&amp;gt;openjdk version &amp;quot;21.0.4&amp;quot; 2024-07-16&amp;lt;br /&amp;gt;OpenJDK Runtime Environment (build 21.0.4+7-Ubuntu-1ubuntu224.04)&amp;lt;br /&amp;gt;OpenJDK 64-Bit Server VM (build 21.0.4+7-Ubuntu-1ubuntu224.04, mixed mode, sharing)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting Runtime Issues==&lt;br /&gt;
=== Java Errors===&lt;br /&gt;
Please be aware that some older versions of Java do not get completely replaced when installing a newer version.  Usually this happens with Java 8 JRE and Java 11+ JDKs.  If that makes no sense, just delete Java 8.&lt;br /&gt;
&lt;br /&gt;
If you get a message like this:&amp;lt;code&amp;gt;Error: A JNI error has occurred, please check your installation and try again.&amp;lt;/code&amp;gt; Please [https://kolmafia.us/threads/java-11-now-required-for-kolmafia-java-17-recommended.26579/ read this announcement].&lt;br /&gt;
&lt;br /&gt;
===Scaling support on HiDPI Monitors===&lt;br /&gt;
&lt;br /&gt;
If the KoLmafia application is unexpectedly small on a [https://techterms.com/definition/hidpi HiDPI]/Retina Display monitor, then support for HiDPI should enabled.  This should only be required on Linux, since HiDPI support is enabled automatically on Windows and MacOS.&lt;br /&gt;
&lt;br /&gt;
On Linux, using HiDPI with a Java Swing application (such as KoLmafia) requires that you execute the &#039;.jar&#039; file with an option set as follows: &amp;lt;code&amp;gt;java -Dsun.java2d.uiScale=&amp;lt;multiplier&amp;gt; -jar &amp;lt;jarfile&amp;gt;&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Depending on the screen size, a multiplier of 1.6 or 2.0 may be appropriate.  You may need to experiment to find the ideal scaling multiplier for your screens.&lt;br /&gt;
&lt;br /&gt;
[[Category:Tech Support]]&lt;br /&gt;
[[Category:New User Help]]&lt;/div&gt;</summary>
		<author><name>Ryo Sangnoir</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Installation&amp;diff=9246</id>
		<title>Installation</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Installation&amp;diff=9246"/>
		<updated>2025-01-06T17:21:17Z</updated>

		<summary type="html">&lt;p&gt;Ryo Sangnoir: Java 21&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOCright}}&lt;br /&gt;
&lt;br /&gt;
== How to Download the latest version. ==&lt;br /&gt;
The latest source build can be downloaded from the following locations:&lt;br /&gt;
&lt;br /&gt;
# [http://builds.kolmafia.us/ builds.kolmafia.us] &lt;br /&gt;
# the [https://github.com/kolmafia/kolmafia/releases GitHub releases page].  &lt;br /&gt;
&lt;br /&gt;
Both of these sources have tested versions that are posted shortly after developers change code.&lt;br /&gt;
&lt;br /&gt;
The GitHub releases page contains both the KoLmafia-xxxxx.jar java binaries and installers for an experimental version that includes a bundled version of Java.  If you use the installers, they manage the Java dependency listed below, but it can be more difficult to troubleshoot issues.  &lt;br /&gt;
&lt;br /&gt;
== Dependencies==&lt;br /&gt;
&lt;br /&gt;
===Java 21 or higher===&lt;br /&gt;
KoLmafia depends on Java 21 or higher  The recommended version is linked at the top of every page of kolmafia.us.  If you are executing KoLmafia from a jarfile, you will need to install Java first.  &lt;br /&gt;
&lt;br /&gt;
If you do not have a recent version of Java, the recommended version (as of this writing) is [https://adoptium.net/index.html Java 21].  &lt;br /&gt;
&lt;br /&gt;
Oracle may have issues, for simplicity use [https://adoptium.net/temurin/releases/ Adoptium]. Any OpenJDK build should be okay too like [https://www.azul.com/downloads/#zulu Zulu Java].&lt;br /&gt;
&lt;br /&gt;
====Testing your Java installation====&lt;br /&gt;
From a Command Prompt (or Terminal) window, enter &amp;lt;code&amp;gt;java -version&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If that returns something like this, you should be good to go.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Michaels-MBP:~ mcroft$ java -version&amp;lt;br /&amp;gt;openjdk version &amp;quot;21.0.4&amp;quot; 2024-07-16&amp;lt;br /&amp;gt;OpenJDK Runtime Environment (build 21.0.4+7-Ubuntu-1ubuntu224.04)&amp;lt;br /&amp;gt;OpenJDK 64-Bit Server VM (build 21.0.4+7-Ubuntu-1ubuntu224.04, mixed mode, sharing)&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting Runtime Issues==&lt;br /&gt;
=== Java Errors===&lt;br /&gt;
Please be aware that some older versions of Java do not get completely replaced when installing a newer version.  Usually this happens with Java 8 JRE and Java 11+ JDKs.  If that makes no sense, just delete Java 8.&lt;br /&gt;
&lt;br /&gt;
If you get a message like this:&amp;lt;code&amp;gt;Error: A JNI error has occurred, please check your installation and try again.&amp;lt;/code&amp;gt; Please [https://kolmafia.us/threads/java-11-now-required-for-kolmafia-java-17-recommended.26579/ read this announcement].&lt;br /&gt;
&lt;br /&gt;
===Scaling support on HiDPI Monitors===&lt;br /&gt;
&lt;br /&gt;
If the KoLmafia application is unexpectedly small on a [https://techterms.com/definition/hidpi HiDPI]/Retina Display monitor, then support for HiDPI should enabled.  This should only be required on Linux, since HiDPI support is enabled automatically on Windows and MacOS.&lt;br /&gt;
&lt;br /&gt;
On Linux, using HiDPI with a Java Swing application (such as KoLmafia) requires that you execute the &#039;.jar&#039; file with an option set as follows: &amp;lt;code&amp;gt;java -Dsun.java2d.uiScale=&amp;lt;multiplier&amp;gt; -jar &amp;lt;jarfile&amp;gt;&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Depending on the screen size, a multiplier of 1.6 or 2.0 may be appropriate.  You may need to experiment to find the ideal scaling multiplier for your screens.&lt;br /&gt;
&lt;br /&gt;
[[Category:Tech Support]]&lt;br /&gt;
[[Category:New User Help]]&lt;/div&gt;</summary>
		<author><name>Ryo Sangnoir</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Equipped_amount&amp;diff=9192</id>
		<title>Equipped amount</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Equipped_amount&amp;diff=9192"/>
		<updated>2023-03-24T08:56:05Z</updated>

		<summary type="html">&lt;p&gt;Ryo Sangnoir: add boolean&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{&lt;br /&gt;
#vardefine:name|equipped_amount}}{{&lt;br /&gt;
#vardefine:return_type|int}}{{&lt;br /&gt;
&lt;br /&gt;
FunctionPage|&lt;br /&gt;
name={{#var:name}}|&lt;br /&gt;
&lt;br /&gt;
function1={{Function|&lt;br /&gt;
name={{#var:name}}|&lt;br /&gt;
aggregate={{#var:aggregate}}|&lt;br /&gt;
return_type={{#var:return_type}}|&lt;br /&gt;
return_also={{#var:return_also}}|&lt;br /&gt;
parameter1={{Param|item|it}}|&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
function2={{Function|&lt;br /&gt;
name={{#var:name}}|&lt;br /&gt;
aggregate={{#var:aggregate}}|&lt;br /&gt;
return_type={{#var:return_type}}|&lt;br /&gt;
return_also={{#var:return_also}}|&lt;br /&gt;
parameter1={{Param|item|it}}|&lt;br /&gt;
parameter2={{Param|boolean|includeAllFamiliars}}|&lt;br /&gt;
p1desc={{Pspan|it}} is the item that will be checked for among your worn gear.|&lt;br /&gt;
p2desc={{Pspan|includeAllFamiliars}} is whether you want to check the familiars in your terrarium in addition to your current familiar.|&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
function_description=Returns the amount of a given item currently equipped on your character.|&lt;br /&gt;
&lt;br /&gt;
code1={{CodeSample|&lt;br /&gt;
title=Code Sample|&lt;br /&gt;
description=Checks if you&#039;re safe to chat.|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if (equipped_amount($item[sword behind inappropriate prepositions]) == 1 &amp;amp;&amp;amp; have_effect($effect[Wanged]) == 0)&lt;br /&gt;
// Sword doesn&#039;t fire if you have this particular effect.&lt;br /&gt;
   abort(&amp;quot;You aren&#039;t safe to chat!&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
see_also={{SeeAlso|closet_amount|display_amount|item_amount|shop_amount|stash_amount|storage_amount}}|&lt;br /&gt;
}}&lt;br /&gt;
[[Category:Item Management]][[Category:Equipment]]&lt;/div&gt;</summary>
		<author><name>Ryo Sangnoir</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Modifiers&amp;diff=9191</id>
		<title>Modifiers</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Modifiers&amp;diff=9191"/>
		<updated>2023-03-10T18:34:30Z</updated>

		<summary type="html">&lt;p&gt;Ryo Sangnoir: add more modifiers, but we&amp;#039;re missing a load&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOCright}}&lt;br /&gt;
Here is a comprehensive list of modifiers calculated by KoLmafia. Note that these are also available as ASH functions -- the first form, which takes one parameter, provides information about your character&#039;s current state; the second form, which takes two parameters, information about the object in question.&lt;br /&gt;
&lt;br /&gt;
To view this list of modifiers as it pertains to your character [and a specified &#039;&#039;object&#039;&#039;], use the CLI command &amp;quot;modref [&#039;&#039;object&#039;&#039;]&amp;quot;. To see what affects a certain modifier (or modifiers), use &amp;quot;modtrace &#039;&#039;filter&#039;&#039;&amp;quot;. For a list of all items that modify &#039;&#039;modifier&#039;&#039;, use &amp;quot;modifies &#039;&#039;modifier&#039;&#039;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
More specific information regarding these modifiers is available in modifiers.txt, one of KoLmafia&#039;s internally-stored datafiles.&lt;br /&gt;
&lt;br /&gt;
A list of the functions used to access these modifiers can be found at [[Modifier Functions]].&lt;br /&gt;
&lt;br /&gt;
==Numeric Modifiers==&lt;br /&gt;
Note that although some of these functions have an ASH derivative that may be easier to use, the two-parameter form is still relevant and rather useful when obtaining information about a particular object, rather than your current state.&lt;br /&gt;
&lt;br /&gt;
When not logged in, these all return 0 for the 1-parameter form of {{f|numeric_modifier}}.&lt;br /&gt;
{| cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1px&amp;quot; class=&amp;quot;sortable&amp;quot;&lt;br /&gt;
|- | style=&amp;quot;background-color: #F2F2F2&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Modifier Name&lt;br /&gt;
!  Related ASH function / Notes&lt;br /&gt;
|-&lt;br /&gt;
| Familiar Weight&lt;br /&gt;
| {{f|weight_adjustment}}&lt;br /&gt;
|-&lt;br /&gt;
| Monster Level&lt;br /&gt;
| {{f|monster_level_adjustment}}&lt;br /&gt;
|-&lt;br /&gt;
| Combat Rate&lt;br /&gt;
| {{f|combat_rate_modifier}}&lt;br /&gt;
|-&lt;br /&gt;
| Initiative&lt;br /&gt;
| {{f|initiative_modifier}}&lt;br /&gt;
|-&lt;br /&gt;
| Experience&lt;br /&gt;
| {{f|experience_bonus}}&lt;br /&gt;
|-&lt;br /&gt;
| Item Drop&lt;br /&gt;
| {{f|item_drop_modifier}}&lt;br /&gt;
|-&lt;br /&gt;
| Meat Drop&lt;br /&gt;
| {{f|meat_drop_modifier}}&lt;br /&gt;
|-&lt;br /&gt;
| Damage Absorption&lt;br /&gt;
| {{f|raw_damage_absorption}}&lt;br /&gt;
|-&lt;br /&gt;
| Damage Reduction&lt;br /&gt;
| {{f|damage_reduction}}&lt;br /&gt;
|-&lt;br /&gt;
| Cold Resistance&lt;br /&gt;
| Similar to [[elemental_resistance|elemental_resistance( $element[cold] )]], but returns the level of resistance.&lt;br /&gt;
|-&lt;br /&gt;
| Hot Resistance&lt;br /&gt;
| Similar to [[elemental_resistance|elemental_resistance( $element[hot] )]], but returns the level of resistance.&lt;br /&gt;
|-&lt;br /&gt;
| Sleaze Resistance&lt;br /&gt;
| Similar to [[elemental_resistance|elemental_resistance( $element[sleaze] )]], but returns the level of resistance.&lt;br /&gt;
|-&lt;br /&gt;
| Spooky Resistance&lt;br /&gt;
| Similar to [[elemental_resistance|elemental_resistance( $element[spooky] )]], but returns the level of resistance.&lt;br /&gt;
|-&lt;br /&gt;
| Stench Resistance&lt;br /&gt;
| Similar to [[elemental_resistance|elemental_resistance( $element[stench] )]], but returns the level of resistance.&lt;br /&gt;
|-&lt;br /&gt;
| Mana Cost&lt;br /&gt;
| Similar to {{f|mana_cost_modifier}} -- only counts up to the -3 cap.&lt;br /&gt;
|-&lt;br /&gt;
| Moxie&lt;br /&gt;
| Sum of all absolute moxie modifiers.&lt;br /&gt;
|-&lt;br /&gt;
| Moxie Percent&lt;br /&gt;
| Sum of all percentage-based moxie modifiers.&lt;br /&gt;
|-&lt;br /&gt;
| Muscle&lt;br /&gt;
| Sum of all absolute muscle modifiers.&lt;br /&gt;
|-&lt;br /&gt;
| Muscle Percent&lt;br /&gt;
| Sum of all percentage-based muscle modifiers.&lt;br /&gt;
|-&lt;br /&gt;
| Mysticality&lt;br /&gt;
| Sum of all absolute mysticality modifiers.&lt;br /&gt;
|-&lt;br /&gt;
| Mysticality Percent&lt;br /&gt;
| Sum of all percentage-based mysticality modifiers.&lt;br /&gt;
|-&lt;br /&gt;
| Maximum HP&lt;br /&gt;
| Sum of all absolute HP modifiers.&lt;br /&gt;
|-&lt;br /&gt;
| Maximum HP Percent&lt;br /&gt;
| Sum of all percentage-based HP modifiers.&lt;br /&gt;
|-&lt;br /&gt;
| Maximum MP&lt;br /&gt;
| Sum of all absolute MP modifiers.&lt;br /&gt;
|-&lt;br /&gt;
| Maximum MP Percent&lt;br /&gt;
| Sum of all percentage-based MP modifiers.&lt;br /&gt;
|-&lt;br /&gt;
| Weapon Damage&lt;br /&gt;
| Sum of all absolute weapon damage modifiers.&lt;br /&gt;
|-&lt;br /&gt;
| Ranged Damage&lt;br /&gt;
| Sum of all absolute ranged damage modifiers.&lt;br /&gt;
|-&lt;br /&gt;
| Spell Damage&lt;br /&gt;
| Sum of all absolute spell damage modifiers.&lt;br /&gt;
|-&lt;br /&gt;
| Spell Damage Percent&lt;br /&gt;
| Sum of all percentage-based spell damage modifiers.&lt;br /&gt;
|-&lt;br /&gt;
| Cold Damage&lt;br /&gt;
| Total cold damage.&lt;br /&gt;
|-&lt;br /&gt;
| Hot Damage&lt;br /&gt;
| Total hot damage.&lt;br /&gt;
|-&lt;br /&gt;
| Sleaze Damage&lt;br /&gt;
| Total sleaze damage.&lt;br /&gt;
|-&lt;br /&gt;
| Spooky Damage&lt;br /&gt;
| Total spooky damage.&lt;br /&gt;
|-&lt;br /&gt;
| Stench Damage&lt;br /&gt;
| Total stench damage.&lt;br /&gt;
|-&lt;br /&gt;
| Cold Spell Damage&lt;br /&gt;
| Total cold spell damage.&lt;br /&gt;
|-&lt;br /&gt;
| Hot Spell Damage&lt;br /&gt;
| Total hot spell damage.&lt;br /&gt;
|-&lt;br /&gt;
| Sleaze Spell Damage&lt;br /&gt;
| Total sleaze spell damage.&lt;br /&gt;
|-&lt;br /&gt;
| Spooky Spell Damage&lt;br /&gt;
| Total spooky spell damage.&lt;br /&gt;
|-&lt;br /&gt;
| Stench Spell Damage&lt;br /&gt;
| Total stench spell damage.&lt;br /&gt;
|-&lt;br /&gt;
| Underwater Combat Rate&lt;br /&gt;
| Combat rate modifier, but underwater only.&lt;br /&gt;
|-&lt;br /&gt;
| Fumble&lt;br /&gt;
| Fumble multiplier.&lt;br /&gt;
|-&lt;br /&gt;
| HP Regen Min&lt;br /&gt;
| Lower bound of all HP-regenerating effects/equipment.&lt;br /&gt;
|-&lt;br /&gt;
| HP Regen Max&lt;br /&gt;
| Upper bound of all HP-regenerating effects/equipment.&lt;br /&gt;
|-&lt;br /&gt;
| MP Regen Min&lt;br /&gt;
| Lower bound of all MP-regenerating effects/equipment.&lt;br /&gt;
|-&lt;br /&gt;
| MP Regen Max&lt;br /&gt;
| Upper bound of all MP-regenerating effects/equipment.&lt;br /&gt;
|-&lt;br /&gt;
| Adventures&lt;br /&gt;
| Bonus Rollover adventures&lt;br /&gt;
|-&lt;br /&gt;
| Familiar Weight Percent&lt;br /&gt;
| Percentage modifier of Familiar Weight (from Bad Moon effects; always &amp;lt;= 0)&lt;br /&gt;
|-&lt;br /&gt;
| Weapon Damage Percent&lt;br /&gt;
| Sum of all percentage-based weapon damage modifiers.&lt;br /&gt;
|-&lt;br /&gt;
| Ranged Damage Percent&lt;br /&gt;
| Sum of all percentage-based ranged damage modifiers.&lt;br /&gt;
|-&lt;br /&gt;
| Stackable Mana Cost&lt;br /&gt;
| Similar to {{f|mana_cost_modifier}} -- all other MP cost modifiers.&lt;br /&gt;
|-&lt;br /&gt;
| Hobo Power&lt;br /&gt;
| Hobo Power from equipment and effects (effect, technically).&lt;br /&gt;
|-&lt;br /&gt;
| Base Resting HP&lt;br /&gt;
| Average HP gained from resting.&lt;br /&gt;
|-&lt;br /&gt;
| Resting HP Percent&lt;br /&gt;
| Percentage modifier to HP gained from resting (e.g. from Pagoda).&lt;br /&gt;
|-&lt;br /&gt;
| Bonus Resting HP&lt;br /&gt;
| Absolute modifier to HP gained from resting (e.g. from Gauze hammock).&lt;br /&gt;
|-&lt;br /&gt;
| Base Resting MP&lt;br /&gt;
| MP gained from resting.&lt;br /&gt;
|-&lt;br /&gt;
| Resting MP Percent&lt;br /&gt;
| Percentage modifier to HP gained from resting (e.g. Pagoda).&lt;br /&gt;
|-&lt;br /&gt;
| Bonus Resting MP&lt;br /&gt;
| Absolute modifier to HP gained from resting (e.g. from Beanbag chair).&lt;br /&gt;
|-&lt;br /&gt;
| Critical Hit Percent&lt;br /&gt;
| Percentage modifiers to critical hits (e.g. Depleted Grimacite Kneecapping stick).&lt;br /&gt;
|-&lt;br /&gt;
| PvP Fights&lt;br /&gt;
| Bonus PvP fights upon Rollover.&lt;br /&gt;
|-&lt;br /&gt;
| Volleyball&lt;br /&gt;
| Only for use with multiple parameters (e.g. Llama returns .5, metallic foil radar dish returns -1).&lt;br /&gt;
|-&lt;br /&gt;
| Sombrero&lt;br /&gt;
| Only for use with multiple parameters (e.g. Baby Sandworm returns 1, metallic foil radar dish returns 1).&lt;br /&gt;
|-&lt;br /&gt;
| Leprechaun&lt;br /&gt;
| Only for use with multiple parameters (e.g. Hobo monkey returns 1.25).&lt;br /&gt;
|-&lt;br /&gt;
| Fairy&lt;br /&gt;
| Only for use with multiple parameters (e.g. Hound dog returns 1.25).&lt;br /&gt;
|-&lt;br /&gt;
| Meat Drop Penalty&lt;br /&gt;
| Penalty to Meat Drops; result of having an Underwater location selected as your current location.&lt;br /&gt;
|-&lt;br /&gt;
| Hidden Familiar Weight&lt;br /&gt;
| Bonus familiar weight that does not show up on the character pane (e.g. from Temporary Teardrop Tattoo).&lt;br /&gt;
|-&lt;br /&gt;
| Item Drop Penalty&lt;br /&gt;
| Penalty to Item Drops; result of having an Underwater location selected as your current location.&lt;br /&gt;
|-&lt;br /&gt;
| Initiative Penalty&lt;br /&gt;
| Penalty to Initiative Drops; result of having an Underwater location selected as your current location.&lt;br /&gt;
|-&lt;br /&gt;
| Food Drop&lt;br /&gt;
| Exclusive bonus to food drops (e.g. Brother Flying Burrito&#039;s Blessing).&lt;br /&gt;
|-&lt;br /&gt;
| Booze Drop&lt;br /&gt;
| Exclusive bonus to booze drops (e.g. Brother Smother&#039;s Blessing).&lt;br /&gt;
|-&lt;br /&gt;
| Hat Drop&lt;br /&gt;
| Exclusive bonus to hat drops (e.g. velcro broadsword).&lt;br /&gt;
|-&lt;br /&gt;
| Weapon Drop&lt;br /&gt;
| Exclusive bonus to weapon drops (e.g. pilgrim shield).&lt;br /&gt;
|-&lt;br /&gt;
| Offhand Drop&lt;br /&gt;
| Exclusive bonus to offhand drops (None at the moment; placeholder).&lt;br /&gt;
|-&lt;br /&gt;
| Shirt Drop&lt;br /&gt;
| Exclusive bonus to shirt drops (None at the moment; placeholder).&lt;br /&gt;
|-&lt;br /&gt;
| Pants Drop&lt;br /&gt;
| Exclusive bonus to pants drops (e.g. baneful bandolier).&lt;br /&gt;
|-&lt;br /&gt;
| Accessory Drop&lt;br /&gt;
| Exclusive bonus to accessory drops (e.g. velcro paddle ball).&lt;br /&gt;
|-&lt;br /&gt;
| Volleyball Effectiveness&lt;br /&gt;
| Exclusive to the Baby Mutant Rattlesnake; evaluates an expression that factors in the current moon phase.&lt;br /&gt;
|-&lt;br /&gt;
| Sombrero Effectiveness&lt;br /&gt;
| Currently only returns 0; placeholder.&lt;br /&gt;
|-&lt;br /&gt;
| Leprechaun Effectiveness&lt;br /&gt;
| Exclusive to the Mutant Cactus Bud; evaluates an expression that factors in the current moon phase.&lt;br /&gt;
|-&lt;br /&gt;
| Fairy Effectiveness&lt;br /&gt;
| Exclusive to the Mutant Fire Ant; evaluates an expression that factors in the current moon phase.&lt;br /&gt;
|-&lt;br /&gt;
| Familiar Weight Cap&lt;br /&gt;
| Relevant only to the Mad Hatrack; returns maximum base weight based on equipment.&lt;br /&gt;
|-&lt;br /&gt;
| Slime Resistance&lt;br /&gt;
| Similar to [[elemental_resistance|elemental_resistance( $element[slime] )]], but returns the level of resistance.&lt;br /&gt;
|-&lt;br /&gt;
| Slime Hates It&lt;br /&gt;
| Number of Slime Hates It active, as taken from equipment and effects.&lt;br /&gt;
|-&lt;br /&gt;
| Spell Critical Percent&lt;br /&gt;
| Increased absolute spell critical rate.&lt;br /&gt;
|-&lt;br /&gt;
| Muscle Experience&lt;br /&gt;
| +X Mus substats/fight&lt;br /&gt;
|-&lt;br /&gt;
| Mysticality Experience&lt;br /&gt;
| +X Mys substats/fight&lt;br /&gt;
|-&lt;br /&gt;
| Moxie Experience&lt;br /&gt;
| +X Mox substats/fight&lt;br /&gt;
|-&lt;br /&gt;
| Effect Duration&lt;br /&gt;
| For use with the two-parameter form, using item as the other parameter. Returns duration of effect for potions.&lt;br /&gt;
|-&lt;br /&gt;
| Candy Drop&lt;br /&gt;
| Exclusive bonus to candy drops (e.g. peanut brittle shield).&lt;br /&gt;
|-&lt;br /&gt;
| DB Combat Damage&lt;br /&gt;
| Bonus damage from using DB combat skills (e.g. Chester&#039;s moustache)&lt;br /&gt;
|-&lt;br /&gt;
| Sombrero Bonus&lt;br /&gt;
| Provides X pounds of Sombrero (e.g. tiny sombrero)&lt;br /&gt;
|-&lt;br /&gt;
| Familiar Experience&lt;br /&gt;
| Bonus experience for familiars (e.g. Brother Corsican&#039;s Blessing)&lt;br /&gt;
|-&lt;br /&gt;
| Sporadic Meat Drop&lt;br /&gt;
| Bonus to Meat Drop that has a &amp;lt;100% chance of occurring (e.g. mayflower bouquet)&lt;br /&gt;
|-&lt;br /&gt;
| Sporadic Item Drop&lt;br /&gt;
| Bonus to Item Drop that has a &amp;lt;100% chance of occurring (e.g. mayflower bouquet)&lt;br /&gt;
|-&lt;br /&gt;
| Meat Bonus&lt;br /&gt;
| Absolute bonus to Meat Drop (e.g. ant sickle)&lt;br /&gt;
|-&lt;br /&gt;
| Pickpocket Chance&lt;br /&gt;
| Bonus to pickpocket chance (e.g. Elvish Sunglasses)&lt;br /&gt;
|-&lt;br /&gt;
| Combat Mana Cost&lt;br /&gt;
| Reduction to skill cost, in-combat only (e.g. camouflage T-shirt)&lt;br /&gt;
|-&lt;br /&gt;
|Muscle Experience Percent&lt;br /&gt;
| +X% to all Muscle Gains&lt;br /&gt;
|-&lt;br /&gt;
|Mysticality Experience Percent&lt;br /&gt;
| +X% to all Mysticality Gains&lt;br /&gt;
|-&lt;br /&gt;
|Moxie Experience Percent&lt;br /&gt;
| +X% to all Moxie Gains&lt;br /&gt;
|-&lt;br /&gt;
| Minstrel Level&lt;br /&gt;
| Level of Boris&#039; Minstrel, Clancy&lt;br /&gt;
|-&lt;br /&gt;
| Muscle Limit&lt;br /&gt;
| Limit to Base Muscle&lt;br /&gt;
|-&lt;br /&gt;
| Mysticality Limit&lt;br /&gt;
| Limit to Base Mysticality&lt;br /&gt;
|-&lt;br /&gt;
| Moxie Limit&lt;br /&gt;
| Limit to Base Moxie&lt;br /&gt;
|-&lt;br /&gt;
| Song Duration&lt;br /&gt;
| Length of accordion song cast by accordion&lt;br /&gt;
|-&lt;br /&gt;
| Smithsness&lt;br /&gt;
| Bonus to Smithsness (used by The Smith&#039;s equipment)&lt;br /&gt;
|-&lt;br /&gt;
| Supercold Resistance&lt;br /&gt;
| Resistance to supercold damage (inflicted by warbears)&lt;br /&gt;
|-&lt;br /&gt;
| Reduce Enemy Defense&lt;br /&gt;
| Reduce enemy defense stat by a given percentage&lt;br /&gt;
|- &lt;br /&gt;
| Pool Skill&lt;br /&gt;
| How good you are at playing pool in The Haunted Billiards Room&lt;br /&gt;
|- &lt;br /&gt;
| Familiar Damage&lt;br /&gt;
| How much damage your familiar deals (e.g. autumn leaf pendant)&lt;br /&gt;
|-&lt;br /&gt;
| Gear Drop&lt;br /&gt;
| Exclusive bonus to gear drop (e.g. Combat Lover&#039;s Locket after reminiscing a Demon)&lt;br /&gt;
|-&lt;br /&gt;
| Damage Aura&lt;br /&gt;
| Sources of damage each turn (e.g. smirking shrunken head)&lt;br /&gt;
|-&lt;br /&gt;
| Sporadic Damage Aura&lt;br /&gt;
| Average sources of damage each turn, but not every turn (e.g. Biologically Shocked)&lt;br /&gt;
|-&lt;br /&gt;
| Thorns&lt;br /&gt;
| Source of damage when the enemy hits you (e.g. Spiky Shell)&lt;br /&gt;
|-&lt;br /&gt;
| Sporadic Thorns&lt;br /&gt;
| Average sources of damage when the enemy hits you, but not every turn (e.g. cannonball charrrm bracelet)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Derived Modifiers==&lt;br /&gt;
These are modifiers that are calculated based on other modifier values, rather than being a property of individual items.  They can be used just like the numeric modifier names above, but are fairly useless with the one-parameter form of the function since you can easily retrieve the actual values (which may differ slightly from these predicted values, due to different rounding behavior or other errors in KoLmafia&#039;s modifier calculations).  The intended usage is in the form numeric_modifier(&amp;quot;_spec&amp;quot;, &#039;&#039;name&#039;&#039;), to determine the results of a potential equipment or effect change that has been tested by the CLI &#039;&#039;&#039;whatif&#039;&#039;&#039; command.&lt;br /&gt;
{| cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1px&amp;quot; class=&amp;quot;sortable&amp;quot;&lt;br /&gt;
|- | style=&amp;quot;background-color: #F2F2F2&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Modifier Name&lt;br /&gt;
!  Related ASH function / Notes&lt;br /&gt;
|-&lt;br /&gt;
| Buffed Muscle&lt;br /&gt;
| Predicted value of [[my_buffedstat|my_buffedstat($stat[muscle])]]&lt;br /&gt;
|-&lt;br /&gt;
| Buffed Mysticality&lt;br /&gt;
| Predicted value of [[my_buffedstat|my_buffedstat($stat[mysticality])]]&lt;br /&gt;
|-&lt;br /&gt;
| Buffed Moxie&lt;br /&gt;
| Predicted value of [[my_buffedstat|my_buffedstat($stat[moxie])]]&lt;br /&gt;
|-&lt;br /&gt;
| Buffed HP Maximum&lt;br /&gt;
| Predicted value of {{f|my_maxhp}}&lt;br /&gt;
|-&lt;br /&gt;
| Buffed MP Maximum&lt;br /&gt;
| Predicted value of {{f|my_maxmp}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Bitmap Modifiers==&lt;br /&gt;
Note: This does not have a corresponding ASH function. Instead, these modifiers can all be called using the {{f|numeric_modifier}} function. &lt;br /&gt;
&lt;br /&gt;
When not logged in, these all return 0x0 (0).&lt;br /&gt;
{| cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1px&amp;quot; class=&amp;quot;sortable&amp;quot;&lt;br /&gt;
|- | style=&amp;quot;background-color: #F2F2F2&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Modifier Name&lt;br /&gt;
!  Notes&lt;br /&gt;
|-&lt;br /&gt;
| Clownosity&lt;br /&gt;
| If this is &amp;gt;= 4, you can &amp;quot;Push the nose&amp;quot; in the Fun House. Might be &amp;quot;Clowniness&amp;quot; now.&lt;br /&gt;
|-&lt;br /&gt;
| Raveosity&lt;br /&gt;
| If this is &amp;gt;= 7, you can &amp;quot;Get into the club&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| Brimstone&lt;br /&gt;
| These have many &amp;quot;bonuses&amp;quot; when you equip more of them at once.&lt;br /&gt;
|-&lt;br /&gt;
| Synergetic&lt;br /&gt;
| For items that have hidden bonuses when used together, such as the Secrets from the Future and the snake/wolf sword &amp;amp; shield.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Boolean Modifiers==&lt;br /&gt;
When not logged in, these all return false for the 1-parameter form of {{f|boolean_modifier}}.&lt;br /&gt;
{| cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1px&amp;quot; class=&amp;quot;sortable&amp;quot;&lt;br /&gt;
|- | style=&amp;quot;background-color: #F2F2F2&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Modifier Name&lt;br /&gt;
!  Notes&lt;br /&gt;
|-&lt;br /&gt;
| Softcore Only&lt;br /&gt;
| For use with the parameter &amp;quot;item&amp;quot;; returns true if the item in question has the Softcore Only flag (e.g. Travoltan Trousers).&lt;br /&gt;
|-&lt;br /&gt;
| Single Equip&lt;br /&gt;
| For use with the parameter &amp;quot;item&amp;quot;; returns true if the item in question has the Single Equip flag (e.g. plexiglass pendant).&lt;br /&gt;
|-&lt;br /&gt;
| Never Fumble&lt;br /&gt;
| Returns true if the player has an effect that prevents fumbling.&lt;br /&gt;
|-&lt;br /&gt;
| Weakens Monster&lt;br /&gt;
| For use with the parameter &amp;quot;item&amp;quot;; returns true if the item in question delevels on hit (e.g. 7-foot dwarven mattock).&lt;br /&gt;
|-&lt;br /&gt;
| Free Pull&lt;br /&gt;
| For use with the parameter &amp;quot;item&amp;quot;; returns true if the item in question can be pulled from Hagnk&#039;s for free (e.g. roll of toilet paper).&lt;br /&gt;
|-&lt;br /&gt;
| Variable&lt;br /&gt;
| For use with the parameter &amp;quot;item&amp;quot;; returns true if the item in question has a variable effect (e.g. depleted grimacite grappling hook).&lt;br /&gt;
|-&lt;br /&gt;
| Nonstackable Watch&lt;br /&gt;
| For use with the parameter &amp;quot;item&amp;quot;; returns true if the item in question counts as one of the nonstackable watches (e.g. dead guy&#039;s watch).&lt;br /&gt;
|-&lt;br /&gt;
| Lasts Until Rollover&lt;br /&gt;
| For use with the parameter &amp;quot;item&amp;quot;; returns true if the item in question disappears at rollover&lt;br /&gt;
|-&lt;br /&gt;
| Cold Immunity&lt;br /&gt;
| Returns true if Coldform is active.&lt;br /&gt;
|-&lt;br /&gt;
| Hot Immunity&lt;br /&gt;
| Returns true if Hotform is active.&lt;br /&gt;
|-&lt;br /&gt;
| Sleaze Immunity&lt;br /&gt;
| Returns true if Sleazeform is active.&lt;br /&gt;
|-&lt;br /&gt;
| Spooky Immunity&lt;br /&gt;
| Returns true if Spookyform is active.&lt;br /&gt;
|-&lt;br /&gt;
| Stench Immunity&lt;br /&gt;
| Returns true if Stenchform is active.&lt;br /&gt;
|-&lt;br /&gt;
| Cold Vulnerability&lt;br /&gt;
| Returns true if the player is vulnerable to Cold (e.g. from Sleazeform).&lt;br /&gt;
|-&lt;br /&gt;
| Hot Vulnerability&lt;br /&gt;
| Returns true if the player is vulnerable to Hot (e.g. from Spookyform).&lt;br /&gt;
|-&lt;br /&gt;
| Sleaze Vulnerability&lt;br /&gt;
| Returns true if the player is vulnerable to Sleaze (e.g. from Stenchform).&lt;br /&gt;
|-&lt;br /&gt;
| Spooky Vulnerability&lt;br /&gt;
| Returns true if the player is vulnerable to Spooky (e.g. from Coldform).&lt;br /&gt;
|-&lt;br /&gt;
| Stench Vulnerability&lt;br /&gt;
| Returns true if the player is vulnerable to Stench (e.g. from Hotform).&lt;br /&gt;
|-&lt;br /&gt;
| Moxie Controls MP&lt;br /&gt;
| Returns true if the player has a moxie magnet equipped.&lt;br /&gt;
|-&lt;br /&gt;
| Moxie May Control MP&lt;br /&gt;
| Returns true if the player has Travoltan Trousers equipped.&lt;br /&gt;
|-&lt;br /&gt;
| Four Songs&lt;br /&gt;
| Returns true if the player is able to &amp;quot;Keep 4 songs in [his] head instead of 3&amp;quot; (e.g. Brimstone Beret).&lt;br /&gt;
|-&lt;br /&gt;
| Additional Song&lt;br /&gt;
| Returns true if the player has the bonus from the El Hebilla del Cinturón de Lopez (Accordion Thief Epic Accessory).&lt;br /&gt;
|-&lt;br /&gt;
| Adventure Underwater&lt;br /&gt;
| Returns true if the player has some way to breathe underwater (e.g. makeshift SCUBA gear).&lt;br /&gt;
|-&lt;br /&gt;
| Underwater Familiar&lt;br /&gt;
| Returns true if the player&#039;s familiar has some way to breathe underwater (e.g. das boot).&lt;br /&gt;
|-&lt;br /&gt;
| Generic&lt;br /&gt;
| Returns true if the item in question can be equipped to all familiars.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==String Modifiers==&lt;br /&gt;
Note: These use the two-parameter form, for the most part.&lt;br /&gt;
{| cellpadding=&amp;quot;3&amp;quot; cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1px&amp;quot; class=&amp;quot;sortable&amp;quot;&lt;br /&gt;
|- | style=&amp;quot;background-color: #F2F2F2&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!  Modifier Name&lt;br /&gt;
!  Notes&lt;br /&gt;
|-&lt;br /&gt;
| Class&lt;br /&gt;
| Returns the class you must be to benefit from any of the enchantments on this item.&lt;br /&gt;
|-&lt;br /&gt;
| Effect&lt;br /&gt;
| Returns the effect that KoL associates with a potion (which may not be the potion&#039;s only effect).&lt;br /&gt;
|-&lt;br /&gt;
| Equalize&lt;br /&gt;
| Returns the base stat of an equalizer potion.&lt;br /&gt;
|-&lt;br /&gt;
| Equips On&lt;br /&gt;
| Holds a &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt;-separated list of familiars that the item equips on. Not needed for the basic familiar-specific item listed in familiars.txt.&lt;br /&gt;
|-&lt;br /&gt;
| Familiar Tuning&lt;br /&gt;
| For use with Bandersnatch fold-able equipment; returns the stat associated with the item.&lt;br /&gt;
|-&lt;br /&gt;
| Intrinsic Effect&lt;br /&gt;
| Returns the intrinsic effect granted by a piece of equipment (e.g. Chapped Legs from leather chaps).&lt;br /&gt;
|-&lt;br /&gt;
| Modifiers&lt;br /&gt;
| Returns the raw text of this item&#039;s modifier data, useful for a quick view of all its enchantments.&lt;br /&gt;
|-&lt;br /&gt;
| Outfit&lt;br /&gt;
| Returns the name of the outfit (non-custom, folks!) that this item is part of.&lt;br /&gt;
|-&lt;br /&gt;
| Sign:xxx&lt;br /&gt;
| Returns sign specific modifiers. e.g. {{Pspan|string_modifier( &amp;quot;Sign:Vole&amp;quot;, &amp;quot;Modifiers&amp;quot; )}} returns all modifiers related to being born under the Vole.&lt;br /&gt;
|-&lt;br /&gt;
| Stat Tuning&lt;br /&gt;
| For use with Crimbo &#039;06 items, like tropical paperweight; returns the stat associated with the item.&lt;br /&gt;
|-&lt;br /&gt;
| Wiki Name&lt;br /&gt;
| Returns an empty string unless it is different, in which case the special HTML entities have been replaced. (e.g. frigid hankyu)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>Ryo Sangnoir</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Modifier_Maximizer&amp;diff=9190</id>
		<title>Modifier Maximizer</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Modifier_Maximizer&amp;diff=9190"/>
		<updated>2023-03-10T18:14:07Z</updated>

		<summary type="html">&lt;p&gt;Ryo Sangnoir: /* Equipment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOCright}}&lt;br /&gt;
&lt;br /&gt;
=Usage=&lt;br /&gt;
==General==&lt;br /&gt;
The specification of what attributes to maximize is made by a comma-separated list of keywords, each possibly preceded by a numeric weight. Commas can be omitted if the next item starts with a +, -, or digit. Using just a +, or omitting the weight entirely, is equivalent to a weight of 1. Likewise, using just a&amp;amp;nbsp;&amp;amp;ndash; is equivalent to a weight of -1. Non-integer weights can be used, but may not be meaningful with all keywords.&lt;br /&gt;
&lt;br /&gt;
Numeric weights determine how much an individual keyword will be counted toward the score that Mafia assigns to each combination. For instance, &amp;quot;2 item drop&amp;quot; will force item drop to contribute four times as much as, say, &amp;quot;.5 meat drop&amp;quot; in the expression &amp;quot;maximize 2 item drop, .5 meat drop&amp;quot;. The weights are simply multiplied with the corresponding modifier, so in the preceding expression, a natty blue ascot would contribute 20*.5 = 10 to your score, while a lucky rabbit&#039;s foot would contribute 2*7 + .5*7 = 17.5 to your score.&lt;br /&gt;
&lt;br /&gt;
==Numeric Modifiers==&lt;br /&gt;
The full name of any numeric modifier (as shown by the &#039;&#039;&#039;modref&#039;&#039;&#039; CLI command) is a valid keyword, requesting that its value be maximized. If multiple modifiers are given, their weights specify their relative importance. Negative weights mean that smaller values are more desirable for that modifier.&lt;br /&gt;
&lt;br /&gt;
Shorter forms are allowed for many commonly used modifiers. They can be abbreviated down to just the bold letters:&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;mus&#039;&#039;&#039;, &#039;&#039;&#039;mys&#039;&#039;&#039;, &#039;&#039;&#039;mox&#039;&#039;&#039;, &#039;&#039;&#039;main&#039;&#039;&#039;stat, &#039;&#039;&#039;HP&#039;&#039;&#039;, &#039;&#039;&#039;MP&#039;&#039;&#039;, &#039;&#039;&#039;ML&#039;&#039;&#039;, &#039;&#039;&#039;DA&#039;&#039;&#039;, &#039;&#039;&#039;DR&#039;&#039;&#039;, &#039;&#039;&#039;com&#039;&#039;&#039;bat rate, &#039;&#039;&#039;item&#039;&#039;&#039; drop, &#039;&#039;&#039;meat&#039;&#039;&#039; drop, &#039;&#039;&#039;exp&#039;&#039;&#039;erience, &#039;&#039;&#039;(spell) crit&#039;&#039;&#039;ical, &#039;&#039;&#039;adv&#039;&#039;&#039;entures, &#039;&#039;&#039;fites&#039;&#039;&#039; for &amp;quot;pvp fights&amp;quot; &lt;br /&gt;
&amp;lt;br&amp;gt;Also, resistance (of any type) can be abbreviated as &#039;&#039;&#039;res&#039;&#039;&#039;, and damage can be abbreviated as &#039;&#039;&#039;dmg&#039;&#039;&#039;. &#039;&#039;&#039;all res&#039;&#039;&#039;istance is a shortcut for giving the same weight to all five basic elements. Likewise, &#039;&#039;&#039;elemental dmg&#039;&#039;&#039; is a shortcut for the five elemental damage types. &#039;&#039;&#039;passive damage&#039;&#039;&#039; will look for both &#039;&#039;&#039;damage aura&#039;&#039;&#039; (every round) and &#039;&#039;&#039;thorns&#039;&#039;&#039; (when hit). &lt;br /&gt;
&lt;br /&gt;
Note that many modifiers come in pairs: a base value, plus a percentage boost (such as Moxie and Moxie Percent), or a penalty value. In general, you only need to specify the base modifier, and any related modifiers will automatically be taken into account.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;ocrs&#039;&#039;&#039; will maximize gear that increases the number of monster modifiers. &lt;br /&gt;
&lt;br /&gt;
Finally, &#039;&#039;&#039;prismatic&#039;&#039;&#039; (dmg or res) is a derived modifier that attempts to provide a balance of all elemental types. By contrast the &#039;&#039;&#039;elemental&#039;&#039;&#039; modifier will attempt to maximize all elements, even if it means that some of the elements will get no boost at all.&lt;br /&gt;
&lt;br /&gt;
==Limits==&lt;br /&gt;
Any numeric modifier keyword can be followed by one or both of these special keywords:&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;min&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; The weight specifies the minimum acceptable value for the preceding modifier. If the value is lower, the results will be flagged as a failure.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;max&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; The weight specifies the largest useful value for the preceding modifier. Larger values will be ignored in the score calculation, allowing other specified modifiers to be boosted instead.&lt;br /&gt;
&amp;lt;br&amp;gt;Note that the limit keywords won&#039;t quite work as expected for a modifier that you&#039;re trying to minimize.&lt;br /&gt;
&amp;lt;br&amp;gt;If &#039;&#039;&#039;min&#039;&#039;&#039; or &#039;&#039;&#039;max&#039;&#039;&#039; is specified at the start of the expression, it applies to the total score (the sum of each modifier value times its weight). A global &#039;&#039;&#039;max&#039;&#039;&#039; may allow equipment maximization to finish faster, since no further combinations will be considered once the specified value is reached.+&lt;br /&gt;
&amp;lt;br&amp;gt;The preference &#039;&#039;&#039;maximizerCombinationLimit&#039;&#039;&#039; (set with &#039;&#039;&#039;set maximizerCombinationLimit = 100000&#039;&#039;&#039; in CLi) constrains the number of combinations Maximizer will consider. Depending where it is set, this may mean you don&#039;t get the best combination, but you may well get a good enough one faster. Depending which equipment you can use, you may find a higher value than 100000 is needed.&lt;br /&gt;
&lt;br /&gt;
==Other Modifiers==&lt;br /&gt;
Boolean modifiers can also be used as keywords. With positive weight, the modifier is required to be true; with negative weight, it is required to be false. There is one shortcut available: &#039;&#039;&#039;sea&#039;&#039;&#039; requires both Adventure Underwater and Underwater Familiar to be true.&lt;br /&gt;
&lt;br /&gt;
The only bitmap modifiers that currently appear useful for maximization are Clownosity and Raveosity, so they are allowed as a special case. The weight specifies the required minimum value; only one value is actually meaningful for each keyword, so &#039;&#039;&#039;4 clownosity&#039;&#039;&#039; and &#039;&#039;&#039;7 raveosity&#039;&#039;&#039; are the only useful forms.&lt;br /&gt;
&lt;br /&gt;
String modifiers are not currently meaningful for maximization.&lt;br /&gt;
&lt;br /&gt;
The &#039;Bees Hate You&#039; challenge path adds a &#039;&#039;&#039;beeosity&#039;&#039;&#039; keyword, which specifies the maximum number of &#039;B&#039;s allowed in the names of your equipment items (each of which causes 10% of your maximum HP in damage at the start of every combat). The default is 2 at the moment. The value you specify will automatically be increased if you use a +&#039;&#039;&#039;equip&#039;&#039;&#039; or +&#039;&#039;&#039;outfit&#039;&#039;&#039; keyword (described below) that requires more &#039;B&#039;s to satisfy.&lt;br /&gt;
&lt;br /&gt;
Some extra provided keywords are useful in PvP minigames. &#039;&#039;&#039;number&#039;&#039;&#039; increases score by the number of numbers in a piece of equipment&#039;s name. &#039;&#039;&#039;letter&#039;&#039;&#039; increases score by the number of letters in the name, and &#039;&#039;&#039;letter X&#039;&#039;&#039; can be used to count the number of Xs.&lt;br /&gt;
==Equipment==&lt;br /&gt;
Slot names can be used as keywords:&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;hat&#039;&#039;&#039;, &#039;&#039;&#039;weapon&#039;&#039;&#039;, &#039;&#039;&#039;offhand&#039;&#039;&#039;, &#039;&#039;&#039;shirt&#039;&#039;&#039;, &#039;&#039;&#039;pants&#039;&#039;&#039;, &#039;&#039;&#039;acc1&#039;&#039;&#039;, &#039;&#039;&#039;acc2&#039;&#039;&#039;, &#039;&#039;&#039;acc3&#039;&#039;&#039;, &#039;&#039;&#039;familiar&#039;&#039;&#039; (stickers and fake hands are not currently planned.)&lt;br /&gt;
&amp;lt;br&amp;gt;With positive weights, only the specified slots will be considered for maximization. With negative weights, all but the specified slots will be considered.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;empty&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, consider only slots that are currently empty; with negative weight, only those that aren&#039;t empty. Either way, &#039;&#039;&#039;+&#039;&#039;slot&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;-&#039;&#039;slot&#039;&#039;&#039;&#039;&#039; can be used to further refine the selected slots.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;hand&#039;&#039;&#039;ed&amp;amp;nbsp;&amp;amp;ndash; With a weight of 1, only 1-handed weapons will be considered. With a larger weight, only weapons with at least that handedness will be considered.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;melee&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, only melee weapons will be considered. With negative weight, only ranged weapons will be considered.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;effective&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, if muscle higher than moxie, only melee weapons are considered, if moxie higher or equal to muscle, ranged weapons (and knives with Tricky Knifework known) are considered. &lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;type &#039;&#039;text&#039;&#039;&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; Only weapons with a type containing &#039;&#039;text&#039;&#039; are considered; for example, &#039;&#039;&#039;type club&#039;&#039;&#039; if you plan to do some Seal Clubbing.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;shield&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, only shields will be considered for your off-hand. Implies &#039;&#039;&#039;1 handed&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;club&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, only clubs will be considered for your main-hand.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;sword&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, only swords will be considered for your main-hand.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;shield&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, only shields will be considered for your off-hand. Implies 1 handed.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;utensil&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, only utensils will be considered for your main-hand.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;knife&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, only knives will be considered for your main-hand.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;accordion&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, only accordions will be considered for your main-hand. &lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;current&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; By default Maximizer considers your current equipment in Hardcore and Ronin. With -current keyword it does not, with +current keyword in aftercore it forces it to be considered. Not considering current equipment will reduce the number of combinations considered, but will sometimes mean changes of equipment are suggested even though they don&#039;t improve what you are wearing.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;equip &#039;&#039;item&#039;&#039;&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; The specified item is required (positive weight) or forbidden (negative weight). Multiple uses of &#039;&#039;&#039;+equip&#039;&#039;&#039; require all of the items to be equipped.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;bonus &#039;&#039;item&#039;&#039;&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; The specified item is given a bonus to its score equivalent to weight. &lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;outfit &#039;&#039;name&#039;&#039;&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; The specified standard outfit is required or forbidden. If the name is omitted, the currently equipped outfit is used. Multiple uses of &#039;&#039;&#039;+outfit&#039;&#039;&#039; are satisfied by any one of the outfits (since you can&#039;t be wearing more than one at a time).&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;pirate&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, wear either Swashbuckling outfit or Pirate Fledges.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;plumber&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; If a plumber, require a plumber-specific weapon to be equipped (required to adventure).&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;cold plumber&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; If a plumber, require a plumber-specific weapon that can deal cold damage to be equipped. Useful for getting Blech House. &lt;br /&gt;
&amp;lt;br&amp;gt;If both &#039;&#039;&#039;+equip&#039;&#039;&#039; and &#039;&#039;&#039;+outfit&#039;&#039;&#039; are used together, either one will satisfy the condition&amp;amp;nbsp;&amp;amp;ndash; all of the items, or one of the outfits. This special case is needed to be able to specify the conditions for adventuring in the Pirate Cove.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;tie&#039;&#039;&#039;breaker&amp;amp;nbsp;&amp;amp;ndash; With negative weight, disables the use of a tiebreaker function that tries to choose equipment with generally beneficial attributes, even if not explicitly requested. There are only a few cases where this would be desirable: maximizing &#039;&#039;&#039;+combat&#039;&#039;&#039; or &#039;&#039;&#039;-combat&#039;&#039;&#039; (since there&#039;s usually only one item that can help), &#039;&#039;&#039;adv&#039;&#039;&#039; and/or &#039;&#039;&#039;PvP fights&#039;&#039;&#039; at rollover, and &#039;&#039;&#039;familiar weight&#039;&#039;&#039; when facing the Naughty Sorceress familiars.&lt;br /&gt;
&lt;br /&gt;
==Familiars==&lt;br /&gt;
By default, the Modifier Maximizer does not recommend familiars, since there are many possible factors in choosing one beyond those that can be expressed via modifiers. However, you can request that specific familiars be compared with your current one:&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;switch &#039;&#039;familiar&#039;&#039;&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, the familiar is added to the list to be considered (unless the player lacks that familiar, or is already using it, in which case there is no effect). With negative weight, the familiar is added to the list only if the player lacks the previously specified familiar. For example, &#039;&#039;&#039;switch hobo monkey, -switch leprechaun&#039;&#039;&#039; will only consider the leprechaun if the player doesn&#039;t have the monkey.&lt;br /&gt;
==Assumptions==&lt;br /&gt;
All suggestions are based on the assumption that you will be adventuring in the currently selected location, with all your current effects, prior to the next rollover (since some things depend on the moon phases). For best results, make sure the proper location is selected before maximizing. This is especially true in The Sea and clan dungeons, which have many location-specific modifiers.&lt;br /&gt;
&lt;br /&gt;
Among effects, stat equalizer potions have a major effect on the suggested boosts, since they change the relative importance of additive and percentage stat boosts. Likewise, elemental phials make certain resistance boosts pointless. If you plan to use an equalizer or phial while adventuring, please use them first so that the suggestions take them into account.&lt;br /&gt;
==GUI Use==&lt;br /&gt;
If the Max Price field is zero or blank, the limit will be the smaller of your available meat, or your autoBuyPriceLimit (default 20,000). The other options should be self-explanatory.&lt;br /&gt;
&lt;br /&gt;
Prices are based on the mall price database, so if the price has been looked up in the last 7 days that value is used, otherwise the current mall price is queried. If preference &#039;&#039;&#039;maximizerCurrentMallPrices&#039;&#039;&#039; is set to true the current mall price is always queried, this will be much slower and cause many more server hits. &lt;br /&gt;
&lt;br /&gt;
You can select multiple boosts, and the title of the list will indicate the net effect of applying them all&amp;amp;nbsp;&amp;amp;ndash; note that this isn&#039;t always just the sum of their individual effects.&lt;br /&gt;
==CLI Use==&lt;br /&gt;
The Modifier Maximizer can be invoked from the gCLI or a script via &#039;&#039;&#039;maximize &#039;&#039;expression&#039;&#039;&#039;&#039;&#039;, and will behave as if you&#039;d selected Equipment: on-hand only, Max Price: don&#039;t check, and turned off the Include option. The best equipment will automatically be equipped (unless you invoked the command as &#039;&#039;&#039;maximize? &#039;&#039;expression&#039;&#039;&#039;&#039;&#039;), but you&#039;ll still need to visit the GUI to apply effect boosts&amp;amp;nbsp;&amp;amp;ndash; there are too many factors in choosing between the available boosts for that to be safely automated. An error will be generated if the equipment changes weren&#039;t sufficient to fulfill all &#039;&#039;&#039;min&#039;&#039;&#039; keywords in the expression.&lt;br /&gt;
==Limitations &amp;amp;amp; Bugs==&lt;br /&gt;
This is still a work-in-progress, so don&#039;t expect everything to work perfectly at the moment. However, here are some details that are especially broken:&lt;br /&gt;
* Items that can be installed at your campground for a bonus (such as Hobopolis bedding) aren&#039;t considered.&lt;br /&gt;
* Your song limit isn&#039;t considered when recommending buffs, nor are any daily casting limits.&lt;br /&gt;
* Mutually exclusive effects aren&#039;t handled properly.&lt;br /&gt;
* Weapon Damage, Ranged Damage, and Spell Damage are calculated assuming 100 points of base damage&amp;amp;nbsp;&amp;amp;ndash; in other words, additive and percentage boosts are considered to have exactly equal worth. It&#039;s possible that Weapon and Ranged damage might use a better estimate of the base damage in the future, but for Spell Damage, the proper base depends on which spell you end up using.&lt;br /&gt;
* Effects which vary in power based on how many turns are left (love songs, Mallowed Out, etc.) are handled poorly. If you don&#039;t have the effect, they&#039;ll be suggested based on the results you&#039;d get from having a single turn of it. If you have the effect already, extending it to raise the power won&#039;t even be considered. Similar problems occur with effects that are based on how full or drunk you currently are.&lt;br /&gt;
&lt;br /&gt;
=Useful Expressions=&lt;br /&gt;
&#039;&#039;&#039;MP regen&#039;&#039;&#039;: .5 mp regen max, .5 mp regen min&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Pirates&#039;&#039;&#039;: mainstat, +outfit swashbuckling&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;War&#039;&#039;&#039;: mainstat, +outfit frat warrior&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Shieldbutting&#039;&#039;&#039;: muscle, +shield &lt;br /&gt;
&lt;br /&gt;
=More Information=&lt;br /&gt;
&lt;br /&gt;
Here is the expression used as &#039;&#039;&#039;tie&#039;&#039;&#039;breaker:&lt;br /&gt;
&lt;br /&gt;
:&amp;quot;1 familiar weight, 1 familiar experience, 1 initiative, 5 exp, 1 item, 1 meat, 0.1 DA 1000 max, 1 DR, 0.5 all res, -10 mana cost, 1.0 mus, 0.5 mys, 1.0 mox, 1.5 mainstat, 1 HP, 1 MP, 1 weapon damage, 1 ranged damage, 1 spell damage, 1 cold damage, 1 hot damage, 1 sleaze damage, 1 spooky damage, 1 stench damage, 1 cold spell damage, 1 hot spell damage, 1 sleaze spell damage, 1 spooky spell damage, 1 stench spell damage, 1 critical, -1 fumble, 1 HP regen max, 3 MP regen max, 1 critical hit percent, 0.1 food drop, 0.1 booze drop, 0.1 hat drop, 0.1 weapon drop, 0.1 offhand drop, 0.1 shirt drop, 0.1 pants drop, 0.1 accessory drop, 1 DB combat damage&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
See [http://kolmafia.us/showthread.php?4274 this thread] for details.&lt;br /&gt;
&amp;lt;h2&amp;gt;See Also&amp;lt;/h2&amp;gt;&amp;lt;div style=&amp;quot;border: dashed 1px green; margin: 0.2em; padding: 1em; width=75%; background-color: #fff8dc;&amp;quot;&amp;gt;&amp;lt;center&amp;gt;[[Modifiers]]&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
[[Category:Automation]]&lt;/div&gt;</summary>
		<author><name>Ryo Sangnoir</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Modifier_Maximizer&amp;diff=9189</id>
		<title>Modifier Maximizer</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Modifier_Maximizer&amp;diff=9189"/>
		<updated>2023-03-10T18:13:36Z</updated>

		<summary type="html">&lt;p&gt;Ryo Sangnoir: make more like maximizer help&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOCright}}&lt;br /&gt;
&lt;br /&gt;
=Usage=&lt;br /&gt;
==General==&lt;br /&gt;
The specification of what attributes to maximize is made by a comma-separated list of keywords, each possibly preceded by a numeric weight. Commas can be omitted if the next item starts with a +, -, or digit. Using just a +, or omitting the weight entirely, is equivalent to a weight of 1. Likewise, using just a&amp;amp;nbsp;&amp;amp;ndash; is equivalent to a weight of -1. Non-integer weights can be used, but may not be meaningful with all keywords.&lt;br /&gt;
&lt;br /&gt;
Numeric weights determine how much an individual keyword will be counted toward the score that Mafia assigns to each combination. For instance, &amp;quot;2 item drop&amp;quot; will force item drop to contribute four times as much as, say, &amp;quot;.5 meat drop&amp;quot; in the expression &amp;quot;maximize 2 item drop, .5 meat drop&amp;quot;. The weights are simply multiplied with the corresponding modifier, so in the preceding expression, a natty blue ascot would contribute 20*.5 = 10 to your score, while a lucky rabbit&#039;s foot would contribute 2*7 + .5*7 = 17.5 to your score.&lt;br /&gt;
&lt;br /&gt;
==Numeric Modifiers==&lt;br /&gt;
The full name of any numeric modifier (as shown by the &#039;&#039;&#039;modref&#039;&#039;&#039; CLI command) is a valid keyword, requesting that its value be maximized. If multiple modifiers are given, their weights specify their relative importance. Negative weights mean that smaller values are more desirable for that modifier.&lt;br /&gt;
&lt;br /&gt;
Shorter forms are allowed for many commonly used modifiers. They can be abbreviated down to just the bold letters:&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;mus&#039;&#039;&#039;, &#039;&#039;&#039;mys&#039;&#039;&#039;, &#039;&#039;&#039;mox&#039;&#039;&#039;, &#039;&#039;&#039;main&#039;&#039;&#039;stat, &#039;&#039;&#039;HP&#039;&#039;&#039;, &#039;&#039;&#039;MP&#039;&#039;&#039;, &#039;&#039;&#039;ML&#039;&#039;&#039;, &#039;&#039;&#039;DA&#039;&#039;&#039;, &#039;&#039;&#039;DR&#039;&#039;&#039;, &#039;&#039;&#039;com&#039;&#039;&#039;bat rate, &#039;&#039;&#039;item&#039;&#039;&#039; drop, &#039;&#039;&#039;meat&#039;&#039;&#039; drop, &#039;&#039;&#039;exp&#039;&#039;&#039;erience, &#039;&#039;&#039;(spell) crit&#039;&#039;&#039;ical, &#039;&#039;&#039;adv&#039;&#039;&#039;entures, &#039;&#039;&#039;fites&#039;&#039;&#039; for &amp;quot;pvp fights&amp;quot; &lt;br /&gt;
&amp;lt;br&amp;gt;Also, resistance (of any type) can be abbreviated as &#039;&#039;&#039;res&#039;&#039;&#039;, and damage can be abbreviated as &#039;&#039;&#039;dmg&#039;&#039;&#039;. &#039;&#039;&#039;all res&#039;&#039;&#039;istance is a shortcut for giving the same weight to all five basic elements. Likewise, &#039;&#039;&#039;elemental dmg&#039;&#039;&#039; is a shortcut for the five elemental damage types. &#039;&#039;&#039;passive damage&#039;&#039;&#039; will look for both &#039;&#039;&#039;damage aura&#039;&#039;&#039; (every round) and &#039;&#039;&#039;thorns&#039;&#039;&#039; (when hit). &lt;br /&gt;
&lt;br /&gt;
Note that many modifiers come in pairs: a base value, plus a percentage boost (such as Moxie and Moxie Percent), or a penalty value. In general, you only need to specify the base modifier, and any related modifiers will automatically be taken into account.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;ocrs&#039;&#039;&#039; will maximize gear that increases the number of monster modifiers. &lt;br /&gt;
&lt;br /&gt;
Finally, &#039;&#039;&#039;prismatic&#039;&#039;&#039; (dmg or res) is a derived modifier that attempts to provide a balance of all elemental types. By contrast the &#039;&#039;&#039;elemental&#039;&#039;&#039; modifier will attempt to maximize all elements, even if it means that some of the elements will get no boost at all.&lt;br /&gt;
&lt;br /&gt;
==Limits==&lt;br /&gt;
Any numeric modifier keyword can be followed by one or both of these special keywords:&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;min&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; The weight specifies the minimum acceptable value for the preceding modifier. If the value is lower, the results will be flagged as a failure.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;max&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; The weight specifies the largest useful value for the preceding modifier. Larger values will be ignored in the score calculation, allowing other specified modifiers to be boosted instead.&lt;br /&gt;
&amp;lt;br&amp;gt;Note that the limit keywords won&#039;t quite work as expected for a modifier that you&#039;re trying to minimize.&lt;br /&gt;
&amp;lt;br&amp;gt;If &#039;&#039;&#039;min&#039;&#039;&#039; or &#039;&#039;&#039;max&#039;&#039;&#039; is specified at the start of the expression, it applies to the total score (the sum of each modifier value times its weight). A global &#039;&#039;&#039;max&#039;&#039;&#039; may allow equipment maximization to finish faster, since no further combinations will be considered once the specified value is reached.+&lt;br /&gt;
&amp;lt;br&amp;gt;The preference &#039;&#039;&#039;maximizerCombinationLimit&#039;&#039;&#039; (set with &#039;&#039;&#039;set maximizerCombinationLimit = 100000&#039;&#039;&#039; in CLi) constrains the number of combinations Maximizer will consider. Depending where it is set, this may mean you don&#039;t get the best combination, but you may well get a good enough one faster. Depending which equipment you can use, you may find a higher value than 100000 is needed.&lt;br /&gt;
&lt;br /&gt;
==Other Modifiers==&lt;br /&gt;
Boolean modifiers can also be used as keywords. With positive weight, the modifier is required to be true; with negative weight, it is required to be false. There is one shortcut available: &#039;&#039;&#039;sea&#039;&#039;&#039; requires both Adventure Underwater and Underwater Familiar to be true.&lt;br /&gt;
&lt;br /&gt;
The only bitmap modifiers that currently appear useful for maximization are Clownosity and Raveosity, so they are allowed as a special case. The weight specifies the required minimum value; only one value is actually meaningful for each keyword, so &#039;&#039;&#039;4 clownosity&#039;&#039;&#039; and &#039;&#039;&#039;7 raveosity&#039;&#039;&#039; are the only useful forms.&lt;br /&gt;
&lt;br /&gt;
String modifiers are not currently meaningful for maximization.&lt;br /&gt;
&lt;br /&gt;
The &#039;Bees Hate You&#039; challenge path adds a &#039;&#039;&#039;beeosity&#039;&#039;&#039; keyword, which specifies the maximum number of &#039;B&#039;s allowed in the names of your equipment items (each of which causes 10% of your maximum HP in damage at the start of every combat). The default is 2 at the moment. The value you specify will automatically be increased if you use a +&#039;&#039;&#039;equip&#039;&#039;&#039; or +&#039;&#039;&#039;outfit&#039;&#039;&#039; keyword (described below) that requires more &#039;B&#039;s to satisfy.&lt;br /&gt;
&lt;br /&gt;
Some extra provided keywords are useful in PvP minigames. &#039;&#039;&#039;number&#039;&#039;&#039; increases score by the number of numbers in a piece of equipment&#039;s name. &#039;&#039;&#039;letter&#039;&#039;&#039; increases score by the number of letters in the name, and &#039;&#039;&#039;letter X&#039;&#039;&#039; can be used to count the number of Xs.&lt;br /&gt;
==Equipment==&lt;br /&gt;
Slot names can be used as keywords:&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;hat&#039;&#039;&#039;, &#039;&#039;&#039;weapon&#039;&#039;&#039;, &#039;&#039;&#039;offhand&#039;&#039;&#039;, &#039;&#039;&#039;shirt&#039;&#039;&#039;, &#039;&#039;&#039;pants&#039;&#039;&#039;, &#039;&#039;&#039;acc1&#039;&#039;&#039;, &#039;&#039;&#039;acc2&#039;&#039;&#039;, &#039;&#039;&#039;acc3&#039;&#039;&#039;, &#039;&#039;&#039;familiar&#039;&#039;&#039; (stickers and fake hands are not currently planned.)&lt;br /&gt;
&amp;lt;br&amp;gt;With positive weights, only the specified slots will be considered for maximization. With negative weights, all but the specified slots will be considered.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;empty&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, consider only slots that are currently empty; with negative weight, only those that aren&#039;t empty. Either way, &#039;&#039;&#039;+&#039;&#039;slot&#039;&#039;&#039;&#039;&#039; and &#039;&#039;&#039;-&#039;&#039;slot&#039;&#039;&#039;&#039;&#039; can be used to further refine the selected slots.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;hand&#039;&#039;&#039;ed&amp;amp;nbsp;&amp;amp;ndash; With a weight of 1, only 1-handed weapons will be considered. With a larger weight, only weapons with at least that handedness will be considered.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;melee&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, only melee weapons will be considered. With negative weight, only ranged weapons will be considered.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;effective&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, if muscle higher than moxie, only melee weapons are considered, if moxie higher or equal to muscle, ranged weapons (and knives with Tricky Knifework known) are considered. &lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;type &#039;&#039;text&#039;&#039;&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; Only weapons with a type containing &#039;&#039;text&#039;&#039; are considered; for example, &#039;&#039;&#039;type club&#039;&#039;&#039; if you plan to do some Seal Clubbing.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;shield&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, only shields will be considered for your off-hand. Implies &#039;&#039;&#039;1 handed&#039;&#039;&#039;.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;club&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, only clubs will be considered for your main-hand.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;sword&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, only swords will be considered for your main-hand.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;shield&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, only shields will be considered for your off-hand. Implies 1 handed.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;utensil&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, only utensils will be considered for your main-hand.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;knife&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, only knives will be considered for your main-hand.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;accordion&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, only accordions will be considered for your main-hand. &lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;current&#039;&#039;&#039;&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; By default Maximizer considers your current equipment in Hardcore and Ronin. With -current keyword it does not, with +current keyword in aftercore it forces it to be considered. Not considering current equipment will reduce the number of combinations considered, but will sometimes mean changes of equipment are suggested even though they don&#039;t improve what you are wearing.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;equip &#039;&#039;item&#039;&#039;&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; The specified item is required (positive weight) or forbidden (negative weight). Multiple uses of &#039;&#039;&#039;+equip&#039;&#039;&#039; require all of the items to be equipped.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;bonus &#039;&#039;item&#039;&#039;&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; The specified item is given a bonus to its score equivalent to weight. &lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;outfit &#039;&#039;name&#039;&#039;&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; The specified standard outfit is required or forbidden. If the name is omitted, the currently equipped outfit is used. Multiple uses of &#039;&#039;&#039;+outfit&#039;&#039;&#039; are satisfied by any one of the outfits (since you can&#039;t be wearing more than one at a time).&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;pirate&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, wear either Swashbuckling outfit or Pirate Fledges.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;plumber&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; If a plumber, require a plumber-specific weapon to be equipped (required to adventure).&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;cold plumber&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; If a plumber, require a plumber-specific weapon that can deal cold damage to be equipped. Useful for getting Blech House. &lt;br /&gt;
&amp;lt;br&amp;gt;If both &#039;&#039;&#039;+equip&#039;&#039;&#039; and &#039;&#039;&#039;+outfit&#039;&#039;&#039; are used together, either one will satisfy the condition&amp;amp;nbsp;&amp;amp;ndash; all of the items, or one of the outfits. This special case is needed to be able to specify the conditions for adventuring in the Pirate Cove.&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;tie&#039;&#039;&#039;breaker&amp;amp;nbsp;&amp;amp;ndash; With negative weight, disables the use of a tiebreaker function that tries to choose equipment with generally beneficial attributes, even if not explicitly requested. There are only a few cases where this would be desirable: maximizing &#039;&#039;&#039;+combat&#039;&#039;&#039; or &#039;&#039;&#039;-combat&#039;&#039;&#039; (since there&#039;s usually only one item that can help), &#039;&#039;&#039;adv&#039;&#039;&#039; and/or &#039;&#039;&#039;PvP fights&#039;&#039;&#039; at rollover, and &#039;&#039;&#039;familiar weight&#039;&#039;&#039; when facing the Naughty Sorceress familiars.&lt;br /&gt;
&lt;br /&gt;
==Familiars==&lt;br /&gt;
By default, the Modifier Maximizer does not recommend familiars, since there are many possible factors in choosing one beyond those that can be expressed via modifiers. However, you can request that specific familiars be compared with your current one:&lt;br /&gt;
&amp;lt;br&amp;gt;&#039;&#039;&#039;switch &#039;&#039;familiar&#039;&#039;&#039;&#039;&#039;&amp;amp;nbsp;&amp;amp;ndash; With positive weight, the familiar is added to the list to be considered (unless the player lacks that familiar, or is already using it, in which case there is no effect). With negative weight, the familiar is added to the list only if the player lacks the previously specified familiar. For example, &#039;&#039;&#039;switch hobo monkey, -switch leprechaun&#039;&#039;&#039; will only consider the leprechaun if the player doesn&#039;t have the monkey.&lt;br /&gt;
==Assumptions==&lt;br /&gt;
All suggestions are based on the assumption that you will be adventuring in the currently selected location, with all your current effects, prior to the next rollover (since some things depend on the moon phases). For best results, make sure the proper location is selected before maximizing. This is especially true in The Sea and clan dungeons, which have many location-specific modifiers.&lt;br /&gt;
&lt;br /&gt;
Among effects, stat equalizer potions have a major effect on the suggested boosts, since they change the relative importance of additive and percentage stat boosts. Likewise, elemental phials make certain resistance boosts pointless. If you plan to use an equalizer or phial while adventuring, please use them first so that the suggestions take them into account.&lt;br /&gt;
==GUI Use==&lt;br /&gt;
If the Max Price field is zero or blank, the limit will be the smaller of your available meat, or your autoBuyPriceLimit (default 20,000). The other options should be self-explanatory.&lt;br /&gt;
&lt;br /&gt;
Prices are based on the mall price database, so if the price has been looked up in the last 7 days that value is used, otherwise the current mall price is queried. If preference &#039;&#039;&#039;maximizerCurrentMallPrices&#039;&#039;&#039; is set to true the current mall price is always queried, this will be much slower and cause many more server hits. &lt;br /&gt;
&lt;br /&gt;
You can select multiple boosts, and the title of the list will indicate the net effect of applying them all&amp;amp;nbsp;&amp;amp;ndash; note that this isn&#039;t always just the sum of their individual effects.&lt;br /&gt;
==CLI Use==&lt;br /&gt;
The Modifier Maximizer can be invoked from the gCLI or a script via &#039;&#039;&#039;maximize &#039;&#039;expression&#039;&#039;&#039;&#039;&#039;, and will behave as if you&#039;d selected Equipment: on-hand only, Max Price: don&#039;t check, and turned off the Include option. The best equipment will automatically be equipped (unless you invoked the command as &#039;&#039;&#039;maximize? &#039;&#039;expression&#039;&#039;&#039;&#039;&#039;), but you&#039;ll still need to visit the GUI to apply effect boosts&amp;amp;nbsp;&amp;amp;ndash; there are too many factors in choosing between the available boosts for that to be safely automated. An error will be generated if the equipment changes weren&#039;t sufficient to fulfill all &#039;&#039;&#039;min&#039;&#039;&#039; keywords in the expression.&lt;br /&gt;
==Limitations &amp;amp;amp; Bugs==&lt;br /&gt;
This is still a work-in-progress, so don&#039;t expect everything to work perfectly at the moment. However, here are some details that are especially broken:&lt;br /&gt;
* Items that can be installed at your campground for a bonus (such as Hobopolis bedding) aren&#039;t considered.&lt;br /&gt;
* Your song limit isn&#039;t considered when recommending buffs, nor are any daily casting limits.&lt;br /&gt;
* Mutually exclusive effects aren&#039;t handled properly.&lt;br /&gt;
* Weapon Damage, Ranged Damage, and Spell Damage are calculated assuming 100 points of base damage&amp;amp;nbsp;&amp;amp;ndash; in other words, additive and percentage boosts are considered to have exactly equal worth. It&#039;s possible that Weapon and Ranged damage might use a better estimate of the base damage in the future, but for Spell Damage, the proper base depends on which spell you end up using.&lt;br /&gt;
* Effects which vary in power based on how many turns are left (love songs, Mallowed Out, etc.) are handled poorly. If you don&#039;t have the effect, they&#039;ll be suggested based on the results you&#039;d get from having a single turn of it. If you have the effect already, extending it to raise the power won&#039;t even be considered. Similar problems occur with effects that are based on how full or drunk you currently are.&lt;br /&gt;
&lt;br /&gt;
=Useful Expressions=&lt;br /&gt;
&#039;&#039;&#039;MP regen&#039;&#039;&#039;: .5 mp regen max, .5 mp regen min&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Pirates&#039;&#039;&#039;: mainstat, +outfit swashbuckling&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;War&#039;&#039;&#039;: mainstat, +outfit frat warrior&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Shieldbutting&#039;&#039;&#039;: muscle, +shield &lt;br /&gt;
&lt;br /&gt;
=More Information=&lt;br /&gt;
&lt;br /&gt;
Here is the expression used as &#039;&#039;&#039;tie&#039;&#039;&#039;breaker:&lt;br /&gt;
&lt;br /&gt;
:&amp;quot;1 familiar weight, 1 familiar experience, 1 initiative, 5 exp, 1 item, 1 meat, 0.1 DA 1000 max, 1 DR, 0.5 all res, -10 mana cost, 1.0 mus, 0.5 mys, 1.0 mox, 1.5 mainstat, 1 HP, 1 MP, 1 weapon damage, 1 ranged damage, 1 spell damage, 1 cold damage, 1 hot damage, 1 sleaze damage, 1 spooky damage, 1 stench damage, 1 cold spell damage, 1 hot spell damage, 1 sleaze spell damage, 1 spooky spell damage, 1 stench spell damage, 1 critical, -1 fumble, 1 HP regen max, 3 MP regen max, 1 critical hit percent, 0.1 food drop, 0.1 booze drop, 0.1 hat drop, 0.1 weapon drop, 0.1 offhand drop, 0.1 shirt drop, 0.1 pants drop, 0.1 accessory drop, 1 DB combat damage&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
See [http://kolmafia.us/showthread.php?4274 this thread] for details.&lt;br /&gt;
&amp;lt;h2&amp;gt;See Also&amp;lt;/h2&amp;gt;&amp;lt;div style=&amp;quot;border: dashed 1px green; margin: 0.2em; padding: 1em; width=75%; background-color: #fff8dc;&amp;quot;&amp;gt;&amp;lt;center&amp;gt;[[Modifiers]]&amp;lt;/center&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
[[Category:Automation]]&lt;/div&gt;</summary>
		<author><name>Ryo Sangnoir</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=JavaScript_Support&amp;diff=9172</id>
		<title>JavaScript Support</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=JavaScript_Support&amp;diff=9172"/>
		<updated>2022-12-13T08:48:06Z</updated>

		<summary type="html">&lt;p&gt;Ryo Sangnoir: /* Library Functions */ neat trick for javascript scripts&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;As of revision 20509, KoLmafia supports scripting in JavaScript! You can run JS code from the CLI using &amp;lt;code&amp;gt;js &amp;lt;nowiki&amp;gt;&amp;lt;code&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;, and you can call scripts through any of the normal methods. Consult and &amp;quot;lifecycle&amp;quot; scripts (e.g. &amp;lt;code&amp;gt;betweenBattleScript&amp;lt;/code&amp;gt;) are supported, too! &#039;&#039;&#039;This support is still experimental - you have been warned.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Basics ==&lt;br /&gt;
&lt;br /&gt;
=== Library Functions ===&lt;br /&gt;
All functions in the ASH runtime library are available inside the built-in &amp;lt;code&amp;gt;kolmafia&amp;lt;/code&amp;gt; module. To use these functions, you must use the &amp;lt;code&amp;gt;require()&amp;lt;/code&amp;gt; function to import them:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;js&amp;quot;&amp;gt;&lt;br /&gt;
const { print, myName() } = require(&amp;quot;kolmafia&amp;quot;);&lt;br /&gt;
print(&amp;quot;Hello, &amp;quot; + myName());&lt;br /&gt;
&lt;br /&gt;
// Alternative&lt;br /&gt;
const kolmafia = require(&amp;quot;kolmafia&amp;quot;);&lt;br /&gt;
kolmafia.print(&amp;quot;Hello, &amp;quot; + kolmafia.myName());&lt;br /&gt;
&lt;br /&gt;
// Alternative to have all functions in the global namespace&lt;br /&gt;
Object.assign(globalThis, require(&amp;quot;kolmafia&amp;quot;));&lt;br /&gt;
print(&amp;quot;Hello, &amp;quot; + myName());&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;require()&amp;lt;/code&amp;gt; function is usually called once at the top of the script.&lt;br /&gt;
&lt;br /&gt;
Names of ASH functions are converted to [[wikipedia:CamelCase|camelCase]]. For example, {{f|print_html}} in ASH becomes &amp;lt;code&amp;gt;printHtml()&amp;lt;/code&amp;gt; in JavaScript:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;width: 50%&amp;quot; | ASH&lt;br /&gt;
! style=&amp;quot;width: 50%&amp;quot; | JavaScript&lt;br /&gt;
|- style=&amp;quot;vertical-align: top&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;d&amp;quot;&amp;gt;&lt;br /&gt;
print_html(&amp;quot;&amp;lt;b&amp;gt;Some text&amp;lt;/b&amp;gt;&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;js&amp;quot;&amp;gt;&lt;br /&gt;
const { printHtml } = require(&amp;quot;kolmafia&amp;quot;);&lt;br /&gt;
print(&amp;quot;&amp;lt;b&amp;gt;Some text&amp;lt;/b&amp;gt;&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
When directly executing inline JavaScript code with the &amp;lt;code&amp;gt;js&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;jsq&amp;lt;/code&amp;gt; commands, all library functions are already imported for you, so you don&#039;t have to import them:&lt;br /&gt;
&lt;br /&gt;
  &amp;gt; js print(&amp;quot;My name is &amp;quot; + myName())&lt;br /&gt;
 My name is &amp;lt;playername&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Importing and Exporting ===&lt;br /&gt;
KoLmafia uses the [[wikipedia:CommonJS|CommonJS]] module system, similar to [[wikipedia:Node.js|Node.js]]. You can export functions and values from one JavaScript file and import them from another JavaScript file:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;width: 50%&amp;quot; | &amp;lt;code&amp;gt;source.js&amp;lt;/code&amp;gt;&lt;br /&gt;
! style=&amp;quot;width: 50%&amp;quot; | &amp;lt;code&amp;gt;runner.js&amp;lt;/code&amp;gt;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;js&amp;quot;&amp;gt;&lt;br /&gt;
const { print } = require(&amp;quot;kolmafia&amp;quot;);&lt;br /&gt;
module.exports.hello = function hello() {&lt;br /&gt;
  print(&amp;quot;Hello, world!&amp;quot;);&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;js&amp;quot;&amp;gt;&lt;br /&gt;
const { hello } = require(&amp;quot;./source.js&amp;quot;);&lt;br /&gt;
hello();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Check out [https://flaviocopes.com/commonjs/ this guide] for more examples.&lt;br /&gt;
&lt;br /&gt;
You can export a function named &amp;lt;code&amp;gt;main()&amp;lt;/code&amp;gt; to run it only when the script is invoked directly. When your script is imported by another script, the &amp;lt;code&amp;gt;main()&amp;lt;/code&amp;gt; function will be ignored.&lt;br /&gt;
&lt;br /&gt;
You can also import ASH scripts from JavaScript code. For details, see [[JavaScript Support#ASH_and_JavaScript_Interoperability|ASH and JavaScript Interoperability]].&lt;br /&gt;
&lt;br /&gt;
=== Data Type Classes ===&lt;br /&gt;
All [[Data Types#Special Datatypes|enumerated data types]] in ASH are available as classes in JavaScript. For example, {{type|monster}} is available as the &amp;lt;code&amp;gt;Monster&amp;lt;/code&amp;gt; class, and {{type|item}} is available as the &amp;lt;code&amp;gt;Item&amp;lt;/code&amp;gt; class.&lt;br /&gt;
&lt;br /&gt;
Each enumerated class has the following static methods:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;ClassName&amp;gt;.get()&amp;lt;/code&amp;gt; takes a number or string and returns an object of the class.&lt;br /&gt;
** For example, &amp;lt;code&amp;gt;Monster.get(&amp;quot;fiendish can of asparagus&amp;quot;)&amp;lt;/code&amp;gt; is equivalent to &amp;lt;code&amp;gt;$monster[ fiendish can of asparagus ]&amp;lt;/code&amp;gt; in ASH. &amp;lt;code&amp;gt;Item.get(1)&amp;lt;/code&amp;gt; is equivalent to &amp;lt;code&amp;gt;$item[ 1 ]&amp;lt;/code&amp;gt;.&lt;br /&gt;
** This also accepts string representations of integers. For example, &amp;lt;code&amp;gt;Item.get(5)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;Item.get(&amp;quot;5&amp;quot;)&amp;lt;/code&amp;gt; return the same result.&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;ClassName&amp;gt;.get()&amp;lt;/code&amp;gt; can also take an array of numbers and strings, and return an array of objects.&lt;br /&gt;
** For example, &amp;lt;code&amp;gt;Item.get([&amp;quot;seal-clubbing club&amp;quot;, &amp;quot;pail&amp;quot;, 5])&amp;lt;/code&amp;gt; is similar to &amp;lt;code&amp;gt;$items[ seal-clubbing club, pail, 5 ]&amp;lt;/code&amp;gt; in ASH. However, the JavaScript version returns an array of objects, instead of a boolean map.&lt;br /&gt;
** Passing an empty array returns an empty array (i.e. &amp;lt;code&amp;gt;Item.get([])&amp;lt;/code&amp;gt; is &#039;&#039;not&#039;&#039; the same as &amp;lt;code&amp;gt;$items[]&amp;lt;/code&amp;gt;).&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;lt;ClassName&amp;gt;.all()&amp;lt;/code&amp;gt; takes no argument and returns all possible values of the class.&lt;br /&gt;
** For example, &amp;lt;code&amp;gt;Monster.all()&amp;lt;/code&amp;gt; returns an array of all known monsters. This is similar to &amp;lt;code&amp;gt;$monsters[]&amp;lt;/code&amp;gt; in ASH.&lt;br /&gt;
&lt;br /&gt;
Enumerated objects support the &amp;lt;code&amp;gt;toString()&amp;lt;/code&amp;gt; method, which acts like the {{f|to_string}} ASH function.&lt;br /&gt;
&lt;br /&gt;
To retrieve the numeric ID of enumerated objects, use the {{f|to_int|toInt}} library function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;js&amp;quot;&amp;gt;&lt;br /&gt;
let item = Item.get(&amp;quot;filthy lucre&amp;quot;);&lt;br /&gt;
let itemId = toInt(item);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
* ASH maps are converted to plain JS objects, and ASH arrays are converted to JS arrays.&lt;br /&gt;
* You can look at the type reference for the JS version of the ASH runtime library with &amp;lt;code&amp;gt;jsref&amp;lt;/code&amp;gt;, which works just like &amp;lt;code&amp;gt;ashref&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== ASH and JavaScript Interoperability ==&lt;br /&gt;
&lt;br /&gt;
JavaScript scripts can &amp;lt;code&amp;gt;require()&amp;lt;/code&amp;gt; ASH scripts and use their functions. When an ASH script is &amp;lt;code&amp;gt;require()&amp;lt;/code&amp;gt;-ed by JavaScript code, KoLmafia will execute top-level code, but only export functions in the top-level scope. ASH variables are not exported.&lt;br /&gt;
&lt;br /&gt;
For example, you can use [[Zlib]] if it is installed:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;js&amp;quot; line&amp;gt;&lt;br /&gt;
const { getvar } = require(&amp;quot;zlib.ash&amp;quot;);&lt;br /&gt;
let myvar = getvar(&amp;quot;SOME_VAR_NAME&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ASH scripts cannot &amp;lt;code&amp;gt;import&amp;lt;/code&amp;gt; JavaScript scripts.&lt;br /&gt;
&lt;br /&gt;
== JavaScript Version and Features ==&lt;br /&gt;
KoLmafia uses the [[wikipedia:Rhino (JavaScript engine)|Rhino]] engine to execute JavaScript code. Rhino supports an older version of JavaScript called &amp;quot;ES5&amp;quot;, plus some features from newer versions. This means that many JavaScript features that work in web browsers might not work in KoLmafia.&lt;br /&gt;
&lt;br /&gt;
Here is an incomplete list of post-ES5 features supported by Rhino ([https://kolmafia.us/threads/javascript-bugs.25638/post-160384 source]):&lt;br /&gt;
&lt;br /&gt;
=== Supported ===&lt;br /&gt;
* Syntax&lt;br /&gt;
** &amp;lt;code&amp;gt;let&amp;lt;/code&amp;gt; and (partially) &amp;lt;code&amp;gt;const&amp;lt;/code&amp;gt;&lt;br /&gt;
*** Does not support block-level scoping or temporal dead zones, meaning that you cannot use &amp;lt;code&amp;gt;const&amp;lt;/code&amp;gt; for loop variables. &amp;lt;code&amp;gt;for (const a in obj) { ... }&amp;lt;/code&amp;gt; is a syntax error.&lt;br /&gt;
** Array/object destructuring (but spread/rest syntax (&amp;lt;code&amp;gt;...&amp;lt;/code&amp;gt;) is &#039;&#039;not&#039;&#039; supported)&lt;br /&gt;
** &amp;lt;code&amp;gt;for...of&amp;lt;/code&amp;gt; loop&lt;br /&gt;
** Arrow functions: &amp;lt;code&amp;gt;() =&amp;gt; {}&amp;lt;/code&amp;gt;&lt;br /&gt;
** Octal and binary literals&lt;br /&gt;
* Features&lt;br /&gt;
** Symbol&lt;br /&gt;
** Set, Map, WeakSet, WeakMap&lt;br /&gt;
** ES2015 methods in Array, Math, Number, Object, String&lt;br /&gt;
** &amp;lt;code&amp;gt;Array.prototype.includes()&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;String.prototype.padStart()/padEnd()/trimStart()/trimEnd()&amp;lt;/code&amp;gt;&lt;br /&gt;
** TypedArray: Can be constructed, but most TypedArray-specific methods are unavailable.&lt;br /&gt;
&lt;br /&gt;
=== Unsupported ===&lt;br /&gt;
* Syntax&lt;br /&gt;
** Spread/rest syntax (&amp;lt;code&amp;gt;...&amp;lt;/code&amp;gt;)&lt;br /&gt;
** Object destructuring in assignments (variable declarations are OK)&lt;br /&gt;
** Template string literals: Backtick string literals (&amp;lt;code&amp;gt;``&amp;lt;/code&amp;gt;) are not a syntax error, but are treated as plain string literals.&lt;br /&gt;
** Classes&lt;br /&gt;
** ECMAScript modules (&amp;lt;code&amp;gt;import&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt;)&lt;br /&gt;
** Default function parameters&lt;br /&gt;
** Computed property names&lt;br /&gt;
** Shorthand property names (in object literals)&lt;br /&gt;
** Exponentiation operator (&amp;lt;code&amp;gt;**&amp;lt;/code&amp;gt;)&lt;br /&gt;
** Async/Await&lt;br /&gt;
** Trailing commas in function definitions (oddly, trailing commas are supported in function &#039;&#039;calls&#039;&#039;)&lt;br /&gt;
* Features&lt;br /&gt;
** Promise&lt;br /&gt;
** Proxy&lt;br /&gt;
** Reflect&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
Most JavaScript globals available in browsers and/or server-side environments like Node.js are &#039;&#039;not&#039;&#039; available. This includes &amp;lt;code&amp;gt;alert()&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;console.log()&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;setTimeout()&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Code Checking ==&lt;br /&gt;
&lt;br /&gt;
You can set up [https://eslint.org/ ESLint] to check your code for errors.&lt;br /&gt;
&lt;br /&gt;
The following ESLint configuration (&amp;lt;code&amp;gt;.eslintrc.json&amp;lt;/code&amp;gt;) checks if your JavaScript code uses features unsupported by KoLmafia, and prevents ESLint from complaining about KoLmafia builtins.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;env&amp;quot;: {&lt;br /&gt;
    &amp;quot;commonjs&amp;quot;: true,&lt;br /&gt;
    &amp;quot;es6&amp;quot;: true&lt;br /&gt;
  },&lt;br /&gt;
  &amp;quot;globals&amp;quot;: {&lt;br /&gt;
    &amp;quot;Promise&amp;quot;: &amp;quot;off&amp;quot;,&lt;br /&gt;
    &amp;quot;Proxy&amp;quot;: &amp;quot;off&amp;quot;,&lt;br /&gt;
    &amp;quot;Reflect&amp;quot;: &amp;quot;off&amp;quot;,&lt;br /&gt;
    &amp;quot;Bounty&amp;quot;: &amp;quot;readonly&amp;quot;,&lt;br /&gt;
    &amp;quot;Class&amp;quot;: &amp;quot;readonly&amp;quot;,&lt;br /&gt;
    &amp;quot;Coinmaster&amp;quot;: &amp;quot;readonly&amp;quot;,&lt;br /&gt;
    &amp;quot;Effect&amp;quot;: &amp;quot;readonly&amp;quot;,&lt;br /&gt;
    &amp;quot;Element&amp;quot;: &amp;quot;readonly&amp;quot;,&lt;br /&gt;
    &amp;quot;Familiar&amp;quot;: &amp;quot;readonly&amp;quot;,&lt;br /&gt;
    &amp;quot;Item&amp;quot;: &amp;quot;readonly&amp;quot;,&lt;br /&gt;
    &amp;quot;Location&amp;quot;: &amp;quot;readonly&amp;quot;,&lt;br /&gt;
    &amp;quot;Monster&amp;quot;: &amp;quot;readonly&amp;quot;,&lt;br /&gt;
    &amp;quot;Phylum&amp;quot;: &amp;quot;readonly&amp;quot;,&lt;br /&gt;
    &amp;quot;Servant&amp;quot;: &amp;quot;readonly&amp;quot;,&lt;br /&gt;
    &amp;quot;Skill&amp;quot;: &amp;quot;readonly&amp;quot;,&lt;br /&gt;
    &amp;quot;Slot&amp;quot;: &amp;quot;readonly&amp;quot;,&lt;br /&gt;
    &amp;quot;Stat&amp;quot;: &amp;quot;readonly&amp;quot;,&lt;br /&gt;
    &amp;quot;Thrall&amp;quot;: &amp;quot;readonly&amp;quot;&lt;br /&gt;
  },&lt;br /&gt;
  &amp;quot;parserOptions&amp;quot;: {&lt;br /&gt;
    &amp;quot;ecmaVersion&amp;quot;: 6&lt;br /&gt;
  },&lt;br /&gt;
  &amp;quot;rules&amp;quot;: {&lt;br /&gt;
    &amp;quot;no-restricted-syntax&amp;quot;: [&lt;br /&gt;
      &amp;quot;error&amp;quot;,&lt;br /&gt;
      {&lt;br /&gt;
        &amp;quot;selector&amp;quot;: &amp;quot;AssignmentExpression &amp;gt; ObjectPattern&amp;quot;,&lt;br /&gt;
        &amp;quot;message&amp;quot;: &amp;quot;Rhino does not support object destructuring in assignments (variable declarations are OK)&amp;quot;&lt;br /&gt;
      },&lt;br /&gt;
      {&lt;br /&gt;
        &amp;quot;selector&amp;quot;: &amp;quot;AssignmentPattern&amp;quot;,&lt;br /&gt;
        &amp;quot;message&amp;quot;: &amp;quot;Rhino does not support default values for function parameters and array/object destructuring&amp;quot;&lt;br /&gt;
      },&lt;br /&gt;
      {&lt;br /&gt;
        &amp;quot;selector&amp;quot;: &amp;quot;ClassDeclaration, ClassExpression&amp;quot;,&lt;br /&gt;
        &amp;quot;message&amp;quot;: &amp;quot;Rhino does not support ES2015 classes&amp;quot;&lt;br /&gt;
      },&lt;br /&gt;
      {&lt;br /&gt;
        &amp;quot;selector&amp;quot;: &amp;quot;:matches(ForInStatement, ForOfStatement, ForStatement) &amp;gt; VariableDeclaration[kind=const]&amp;quot;,&lt;br /&gt;
        &amp;quot;message&amp;quot;: &amp;quot;Rhino does not support const declarations in the head of for-loops&amp;quot;&lt;br /&gt;
      },&lt;br /&gt;
      {&lt;br /&gt;
        &amp;quot;selector&amp;quot;: &amp;quot;ObjectExpression &amp;gt; Property[shorthand=true]&amp;quot;,&lt;br /&gt;
        &amp;quot;message&amp;quot;: &amp;quot;Rhino does not support shorthand object properties&amp;quot;&lt;br /&gt;
      },&lt;br /&gt;
      {&lt;br /&gt;
        &amp;quot;selector&amp;quot;: &amp;quot;Property[computed=true]&amp;quot;,&lt;br /&gt;
        &amp;quot;message&amp;quot;: &amp;quot;Rhino does not support computed object properties&amp;quot;&lt;br /&gt;
      },&lt;br /&gt;
      {&lt;br /&gt;
        &amp;quot;selector&amp;quot;: &amp;quot;RestElement, SpreadElement&amp;quot;,&lt;br /&gt;
        &amp;quot;message&amp;quot;: &amp;quot;Rhino does not support spread/rest syntax&amp;quot;&lt;br /&gt;
      },&lt;br /&gt;
      {&lt;br /&gt;
        &amp;quot;selector&amp;quot;: &amp;quot;TemplateLiteral&amp;quot;,&lt;br /&gt;
        &amp;quot;message&amp;quot;: &amp;quot;Rhino does not support template string literals&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
    ]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that this is unnecessary if you use a transpiler to convert modern JavaScript code to Rhino-compatible syntax.&lt;br /&gt;
&lt;br /&gt;
== Transpiling ==&lt;br /&gt;
&lt;br /&gt;
Various tools as Babel, Webpack, and TypeScript can convert modern JavaScript code (or another programming language) to legacy syntax supported by Rhino. These tools are called &amp;quot;transpilers&amp;quot;. These tools allow you to enjoy the convenience and safety of modern language features, while still generating code that runs on KoLmafia.&lt;br /&gt;
&lt;br /&gt;
=== [https://babeljs.io/ Babel] ===&lt;br /&gt;
&lt;br /&gt;
Babel 7.15.0 supports Rhino as a compilation target.&lt;br /&gt;
&lt;br /&gt;
The following config file (&amp;lt;code&amp;gt;babel.config.json&amp;lt;/code&amp;gt;) will convert modern JavaScript syntax to Rhino-compatible ES5+:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;presets&amp;quot;: [&lt;br /&gt;
    [&lt;br /&gt;
      &amp;quot;@babel/preset-env&amp;quot;,&lt;br /&gt;
      {&lt;br /&gt;
        &amp;quot;modules&amp;quot;: false,&lt;br /&gt;
        &amp;quot;targets&amp;quot;: {&lt;br /&gt;
          &amp;quot;rhino&amp;quot;: &amp;quot;1.7.13&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
    ]&lt;br /&gt;
  ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Babel: As of r20558, you will still need to apply several patches to Babel in order to get babel-preset-env to work. See [https://github.com/phulin/bean-casual/tree/ts] for an example of a working Babel/Webpack/Typescript configuration; you&#039;ll need the configuration files and also the patches, which can be applied with patch-package.&lt;br /&gt;
&lt;br /&gt;
=== [https://www.typescriptlang.org/ TypeScript] ===&lt;br /&gt;
&lt;br /&gt;
TypeScript is a statically typed programming language that can be transpiled to JavaScript.&lt;br /&gt;
&lt;br /&gt;
If you use TypeScript without Babel, you can set the &amp;lt;code&amp;gt;[https://www.typescriptlang.org/tsconfig#target target]&amp;lt;/code&amp;gt; to &amp;lt;kbd&amp;gt;&amp;quot;ES5&amp;quot;&amp;lt;/kbd&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TypeScript does not provide [[wikipedia:Polyfill (programming)|polyfills]] for modern JavaScript APIs missing in Rhino. To use them, you must supply your own.&lt;br /&gt;
&lt;br /&gt;
To avoid accidentally using any missing APIs, we recommend using the following configuration for your &amp;lt;code&amp;gt;tsconfig.json&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;js&amp;quot;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
  &amp;quot;compilerOptions&amp;quot;: {&lt;br /&gt;
    // JavaScript APIs supported by Rhino 1.7.13&lt;br /&gt;
    // See https://mozilla.github.io/rhino/compat/engines.html for more info&lt;br /&gt;
    &amp;quot;lib&amp;quot;: [&lt;br /&gt;
      &amp;quot;ES5&amp;quot;,&lt;br /&gt;
      &amp;quot;ES2015.Collection&amp;quot;,&lt;br /&gt;
      &amp;quot;ES2015.Core&amp;quot;,&lt;br /&gt;
      &amp;quot;ES2015.Generator&amp;quot;,&lt;br /&gt;
      &amp;quot;ES2015.Iterable&amp;quot;,&lt;br /&gt;
      &amp;quot;ES2015.Symbol&amp;quot;,&lt;br /&gt;
      &amp;quot;ES2015.Symbol.WellKnown&amp;quot;,&lt;br /&gt;
      &amp;quot;ES2016.Array.Include&amp;quot;,&lt;br /&gt;
      &amp;quot;ES2017.String&amp;quot;,&lt;br /&gt;
      &amp;quot;ES2019.String&amp;quot;&lt;br /&gt;
    ],&lt;br /&gt;
    // Rhino uses require() instead of import/export&lt;br /&gt;
    // Note: If you use Webpack or Rollup, change this to &amp;quot;ES2015&amp;quot;&lt;br /&gt;
    &amp;quot;module&amp;quot;: &amp;quot;CommonJS&amp;quot;,&lt;br /&gt;
    // Rhino supports ES5+&lt;br /&gt;
    // Note: If you use Babel with TypeScript, change this to &amp;quot;ESNext&amp;quot;&lt;br /&gt;
    &amp;quot;target&amp;quot;: &amp;quot;ES5&amp;quot;&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you use a bundler such as [https://webpack.js.org/ Webpack] or [https://rollupjs.org/ Rollup], you should change the &amp;lt;code&amp;gt;module&amp;lt;/code&amp;gt; to &amp;lt;kbd&amp;gt;&amp;quot;ES2015&amp;quot;&amp;lt;/kbd&amp;gt;, and let the bundlers convert your code to CommonJS.&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
* [https://kolmafia.us/threads/20520-this-is-a-big-patch-to-set-up-consult-scripts-lifecycle-scripts-choiceadventurescript.25660/ r20520]: Lifecycle scripts now support JavaScript.&lt;br /&gt;
* [https://kolmafia.us/threads/20620-remove-valueof-as-per-philmasterplus.25845/ r20620]: Enumerated objects no longer provide a custom &amp;lt;code&amp;gt;valueOf()&amp;lt;/code&amp;gt; method. Use {{f|to_int|toInt}} instead.&lt;br /&gt;
* [https://kolmafia.us/threads/20780-javascript-runtime-no-longer-interrupts-when-library-functions-return-false.26174/ r20780]: When calling ASH runtime library functions from JavaScript, functions that return a {{type|boolean}} will return &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; on failure instead of throwing a string as an exception.&lt;/div&gt;</summary>
		<author><name>Ryo Sangnoir</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Batfactors&amp;diff=9114</id>
		<title>Batfactors</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Batfactors&amp;diff=9114"/>
		<updated>2021-10-20T20:09:27Z</updated>

		<summary type="html">&lt;p&gt;Ryo Sangnoir: link to batfactors.txt data file&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOCright}}{{DISPLAYTITLE:batfactors (batfactors.txt)}}&lt;br /&gt;
== What is batfactors? ==&lt;br /&gt;
[https://zachbardon.com/mafiatools/autoupdate.php?f=batfactors&amp;amp;act=getmap batfactors.txt] is a data file used by [[BatBrain]], containing information about all the various factors pertinent to battle.  These are saved in a data-entry-friendly format rather than just saving a map of advevents, which would be bulkier and harder to edit.  The vast majority of BatBrain&#039;s knowledge about items, skills, equipment, monsters, etc. is found in this file.  As it is publicly editable on the Map Manager, a guide to understanding the format could be handy for someone looking to either add new content or fix old or previously unspaded content.&lt;br /&gt;
&lt;br /&gt;
== The Format ==&lt;br /&gt;
&lt;br /&gt;
Like all mafia data files, batfactors is a map file, in the following format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
record combat_rec {&lt;br /&gt;
   string ufname;          // user-friendly name, not really used by BatBrain&lt;br /&gt;
   string dmg;             // damage to monster&lt;br /&gt;
   string pdmg;            // damage to player&lt;br /&gt;
   string special;         // comma-delimited list of other action results&lt;br /&gt;
};&lt;br /&gt;
combat_rec [string, int] factors;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the map has two indices.  The first string represents the category.  The second index is the integer identifying the relevant item/skill/familiar.  For example the &amp;quot;bander&amp;quot; category, which contains information about your Bandersnatch&#039;s enhancements to combat skills, is indexed by skill number.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Category&lt;br /&gt;
!Indexed by&lt;br /&gt;
!What?&lt;br /&gt;
|-&lt;br /&gt;
|bander&lt;br /&gt;
|skill number&lt;br /&gt;
|Your Bandersnatch&#039;s enhancements to the specified skill.&lt;br /&gt;
|-&lt;br /&gt;
|cadenza&lt;br /&gt;
|accordion item number&lt;br /&gt;
|The results of Cadenza using the specified accordion.&lt;br /&gt;
|-&lt;br /&gt;
|canhandle&lt;br /&gt;
|beans item number&lt;br /&gt;
|The results of Canhandle when wielding the specified can of beans.&lt;br /&gt;
|-&lt;br /&gt;
|chef&lt;br /&gt;
|staff item number&lt;br /&gt;
|Jiggle results for the specified chefstaff.&lt;br /&gt;
|-&lt;br /&gt;
|crown&lt;br /&gt;
|familiar number&lt;br /&gt;
|Results for the Crown of Thrones when the specified familiar is enthroned.&lt;br /&gt;
|-&lt;br /&gt;
|effect&lt;br /&gt;
|effect number&lt;br /&gt;
|Per-round results when you have the specified effect active (e.g. passive damage).&lt;br /&gt;
|-&lt;br /&gt;
|fam&lt;br /&gt;
|familiar number&lt;br /&gt;
|Results for the specified familiar.&lt;br /&gt;
|-&lt;br /&gt;
|gear&lt;br /&gt;
|equipment item number&lt;br /&gt;
|Per-round results when you have the specified item equipped.&lt;br /&gt;
|-&lt;br /&gt;
|hatrack&lt;br /&gt;
|hat item number&lt;br /&gt;
|Familiar results for your Mad Hatrack when it has the specified hat equipped.&lt;br /&gt;
|-&lt;br /&gt;
|headbutt&lt;br /&gt;
|hat item number&lt;br /&gt;
|Bonus damage from the specified turtle helmet.&lt;br /&gt;
|-&lt;br /&gt;
|item&lt;br /&gt;
|item number&lt;br /&gt;
|Results for throwing the specified combat item.&lt;br /&gt;
|-&lt;br /&gt;
|monster&lt;br /&gt;
|monster ID&lt;br /&gt;
|Special monster attributes such as resistances, damage caps, and immunities.  This category is a bit special (see below).&lt;br /&gt;
|-&lt;br /&gt;
|scare&lt;br /&gt;
|pants item number&lt;br /&gt;
|Familiar results for your Fancypants Scarecrow when it has the specified pants equipped.&lt;br /&gt;
|-&lt;br /&gt;
|servant&lt;br /&gt;
|servant ID&lt;br /&gt;
|Results for your servant as Ed the Undying.&lt;br /&gt;
|-&lt;br /&gt;
|skill&lt;br /&gt;
|skill number&lt;br /&gt;
|Results for casting the specified combat skill.&lt;br /&gt;
|-&lt;br /&gt;
|thrall&lt;br /&gt;
|thrall ID&lt;br /&gt;
|Per-round results from having the specified pasta thrall active.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
After these important identifiers comes the actual information.  The first field, ufname (user-friendly name), exists solely to make the data file human-readable and isn&#039;t even used by BatBrain when reading the file.  The remaining three fields contain all the information and need to be formatted in a certain way to be understood, but I believe you&#039;ll find that format both intuitive and easy to edit.&lt;br /&gt;
&lt;br /&gt;
== Spreads in Batfactors ==&lt;br /&gt;
&lt;br /&gt;
The dmg and pdmg fields contain damage information, which is converted to a spread (float[element] map) in BatBrain.  The format is versatile and can include formulas and any of BatBrain&#039;s fvars.  Since this value is handled by ASH&#039;s [[modifier_eval]](), any of those key letters or text functions will also work.  Basically damage is expressed as&lt;br /&gt;
&lt;br /&gt;
 amount elements&lt;br /&gt;
&lt;br /&gt;
where amount is the damage formula and elements is a comma (but not space!)-delimited list of elements, using &amp;quot;none&amp;quot; for physical damage or &amp;quot;perfect&amp;quot; for always-correctly-tuned damage.  You may also use &amp;quot;prismatic&amp;quot; as shorthand for specifying all five elements.  If the action does only physical damage, elements (and the preceding space) may be omitted.  If multiple elements are present, the damage in amount will be equally distributed among those elements.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Examples&lt;br /&gt;
|-&lt;br /&gt;
|10&lt;br /&gt;
|deals 10 physical damage&lt;br /&gt;
|-&lt;br /&gt;
| -10&lt;br /&gt;
|heals 10 hit points&lt;br /&gt;
|-&lt;br /&gt;
|10*L&lt;br /&gt;
|deals 10 times your level in physical damage&lt;br /&gt;
|-&lt;br /&gt;
|myhp/2&lt;br /&gt;
|deals half of your current hitpoints in physical damage&lt;br /&gt;
|-&lt;br /&gt;
|10 spooky&lt;br /&gt;
|deals 10 spooky damage&lt;br /&gt;
|-&lt;br /&gt;
|10 spooky,hot&lt;br /&gt;
|deals 5 spooky damage and 5 hot damage&lt;br /&gt;
|-&lt;br /&gt;
|10 prismatic&lt;br /&gt;
|deals 2 each of hot, cold, spooky, sleaze, and stench damage&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For cases where the damage is not equally distributed among elements, the above pattern may be repeated, separated by a pipe:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Examples&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;3 hot|7 spooky&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|deals 3 hot damage and 7 spooky damage&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;50 hot,cold|4 hot&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|deals 29 hot damage and 25 cold damage&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Special ==&lt;br /&gt;
&lt;br /&gt;
Of course, events may have many results besides just damage, and that is all contained in the special field.  The special field, quite simply, is a comma (and space)-delimited list of keywords and values, like so:&lt;br /&gt;
&lt;br /&gt;
 keyword1 value1, keyword2 value2, keyword3 value3&lt;br /&gt;
&lt;br /&gt;
As few as 0 keywords and values may be present.  For numeric values such as MP or meat, formulas may be used since (as with the spreads above) these values will be handled by [[modifier_eval]]().  Here are all the keywords BatBrain presently understands:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Keyword&lt;br /&gt;
!Meaning of Value&lt;br /&gt;
|-&lt;br /&gt;
|aoe&lt;br /&gt;
|For skills with an area of effect, specifies the maximum number of monsters the skill affects.&lt;br /&gt;
|-&lt;br /&gt;
|att&lt;br /&gt;
|Monster attack modifier.&lt;br /&gt;
|-&lt;br /&gt;
|def&lt;br /&gt;
|Monster defense modifier.&lt;br /&gt;
|-&lt;br /&gt;
|stun&lt;br /&gt;
|Number of rounds the monster is stunned by this action, on average.  Defaults to 1 if no value is specified.&lt;br /&gt;
|-&lt;br /&gt;
|mp&lt;br /&gt;
|Amount of MP gained/lost.&lt;br /&gt;
|-&lt;br /&gt;
|meat&lt;br /&gt;
|Amount of meat gained/lost.&lt;br /&gt;
|-&lt;br /&gt;
|item&lt;br /&gt;
|A semicolon+space-delimited list of item names.  This action results in one of the items from this list.  Estimated profit averages the value of these items.&lt;br /&gt;
|-&lt;br /&gt;
|itemcost&lt;br /&gt;
|An item required and expended by this action.  This event uses up one of the specified item, and will be ignored if you lack it.&lt;br /&gt;
|-&lt;br /&gt;
|monster&lt;br /&gt;
|A monster name, or multiple pipe-delimited names. This event only happens for monsters specified here.&lt;br /&gt;
|-&lt;br /&gt;
|notmonster&lt;br /&gt;
|A monster name, or multiple pipe-delimited names. This event happens for any monster except those specified here.&lt;br /&gt;
|-&lt;br /&gt;
|phylum&lt;br /&gt;
|A phylum name.  This event only applies to monsters of the specified phylum.&lt;br /&gt;
|-&lt;br /&gt;
|stats&lt;br /&gt;
|Substats earned, formatted as &amp;lt;nowiki&amp;gt;Mus|Mys|Mox&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
|custom&lt;br /&gt;
|If specified at all, this action is a custom action and should not be used in regular automation.  The optional value represents the type of custom action (runaway, yellow, attract, banish, copy, etc).&lt;br /&gt;
|-&lt;br /&gt;
|mutex&lt;br /&gt;
|A mutually exclusive group this action belongs to.  Any action in the group makes all other actions in the same-named group unavailable (e.g. Sauceror curses, sixguns, etc).&lt;br /&gt;
|-&lt;br /&gt;
|rate&lt;br /&gt;
|For familiars only (which includes hatrack and scare categories).  The action rate of the familiar, expressed as a percent (1.0 = 100%).&lt;br /&gt;
|-&lt;br /&gt;
|!!&lt;br /&gt;
|Note. Usually used to explain something BatBrain is currently unable of knowing or tracking, i.e. unspaded data, ongoing damage, or some other strange mechanic.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Some keywords have no values.  BatBrain merely checks for the presence of the keyword to determine the relevant information.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Keyword&lt;br /&gt;
!Presence Indicates&lt;br /&gt;
|-&lt;br /&gt;
|once&lt;br /&gt;
|The action can only be used once per combat.&lt;br /&gt;
|-&lt;br /&gt;
|endscombat&lt;br /&gt;
|The action automatically ends combat.&lt;br /&gt;
|-&lt;br /&gt;
|underwater&lt;br /&gt;
|The action is only valid underwater.&lt;br /&gt;
|-&lt;br /&gt;
|retal&lt;br /&gt;
|The results happen when the monster successfully hits you.&lt;br /&gt;
|-&lt;br /&gt;
|onhit&lt;br /&gt;
|The results happen when you hit the monster with a melee attack.&lt;br /&gt;
|-&lt;br /&gt;
|oncrit&lt;br /&gt;
|The results happen when you get a critical hit.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== The &amp;quot;monster&amp;quot; Category ==&lt;br /&gt;
&lt;br /&gt;
The monster category is handled differently to the other categories.  The monster attributes are not loaded into an advevent, so it is not handled by to_event() as all the other categories are.  Here are the key differences:&lt;br /&gt;
&lt;br /&gt;
First of all, the integer index is the monster&#039;s ID, which is accessible in the $monster.id proxy field.  Since some monsters&#039; IDs are unknown, and therefore are listed as 0, batfactors uses an arbitrary negative index for those monsters, checking to_monster(ufname) to find a match against the monster name.&lt;br /&gt;
&lt;br /&gt;
Secondly, the dmg field does not contain damage information, but rather monster resistances/vulnerabilities, still expressed as a spread.  For each element, 0 is normal, 1.0 is immunity, and -1.0 is vulnerability.  Normal elemental resistances/vulnerabilities are already calculated by BatBrain, and physical resistance, though it can be specified, is accessible in the physical_resistance proxy field, so you only need to include resistance information if the monster has exceptional resistances.  These resistances will overwrite the existing resistances on a per-element basis.&lt;br /&gt;
&lt;br /&gt;
The pdmg field is also re-purposed -- for monsters, it specifies the monster&#039;s &amp;quot;penetration&amp;quot;, also expressed as a spread.  For each element, the monster treats your resistance as being lower by the amount of levels specified.  Since $element[none] is usually used for physical damage, it is used here to specify DA penetration.&lt;br /&gt;
&lt;br /&gt;
Finally, the special field contains an entirely new set of keywords, which are only for use in the monster category:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Keyword&lt;br /&gt;
!Value/Indicates&lt;br /&gt;
|-&lt;br /&gt;
|variable&lt;br /&gt;
|The monster is variable and should not be loaded from cache.&lt;br /&gt;
|-&lt;br /&gt;
|nopotato&lt;br /&gt;
|Potato-type familiars do not work vs. this monster.&lt;br /&gt;
|-&lt;br /&gt;
|nofamiliar&lt;br /&gt;
|Your familiar will not act vs. this monster.&lt;br /&gt;
|-&lt;br /&gt;
|onlyhurtby X&lt;br /&gt;
|The monster can only be damaged by X.  Currently supported: aoe, pottery, healing, club (and all other weapon types)&lt;br /&gt;
|-&lt;br /&gt;
|aura X&lt;br /&gt;
|The monster has an aura dealing X player damage (specified as a spread) every round.&lt;br /&gt;
|-&lt;br /&gt;
|retal X&lt;br /&gt;
|Use this to specify retaliation damage (damage dealt to you when you succeed with a melee attack) as a spread.&lt;br /&gt;
|-&lt;br /&gt;
|maxround X&lt;br /&gt;
|Use this to specify combats of unusual durations (e.g. &amp;quot;maxround 50&amp;quot; for basement monsters).&lt;br /&gt;
|-&lt;br /&gt;
|group X&lt;br /&gt;
|Use this to specify group monsters, where X is the amount of monsters in the group (integer).&lt;br /&gt;
|-&lt;br /&gt;
|dmgformula X&lt;br /&gt;
|Use this to specify a monster&#039;s unique damage formula as a spread (for example, Your Shadow uses &amp;quot;95+maxhp/6&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
|damagecap X&lt;br /&gt;
|Use this to specify the monster&#039;s soft damage cap boundary (integer).&lt;br /&gt;
|-&lt;br /&gt;
|capexp X&lt;br /&gt;
|This is only meaningful with a soft damage cap, and specifies the exponent used to reduce damage above the boundary.&lt;br /&gt;
|-&lt;br /&gt;
|dodge (X)&lt;br /&gt;
|The monster has an X percent chance to dodge melee attacks.&lt;br /&gt;
|-&lt;br /&gt;
|autohit (X)&lt;br /&gt;
|The monster has an X percent chance to automatically hit you (e.g. gremlins).&lt;br /&gt;
|-&lt;br /&gt;
|automiss (X)&lt;br /&gt;
|The monster has an X percent chance to automatically miss you (e.g. crates).&lt;br /&gt;
|-&lt;br /&gt;
|nostagger (X)&lt;br /&gt;
|The monster has an X percent chance to ignore staggers.&lt;br /&gt;
|-&lt;br /&gt;
|nostun (X)&lt;br /&gt;
|The monster has an X percent chance to shrug a multi-round stunner each round.&lt;br /&gt;
|-&lt;br /&gt;
|noitems (X)&lt;br /&gt;
|The monster has an X percent chance of blocking items (e.g. Bonerdagon).&lt;br /&gt;
|-&lt;br /&gt;
|noskills (X)&lt;br /&gt;
|The monster has an X percent chance of blocking skills (e.g. Naughty Sorceress).&lt;br /&gt;
|-&lt;br /&gt;
|delevelres (X)&lt;br /&gt;
|The monster resists X percent of delevel effects.&lt;br /&gt;
|-&lt;br /&gt;
|spellres (X)&lt;br /&gt;
|The monster resists X percent of damage from combat spells.&lt;br /&gt;
|-&lt;br /&gt;
|dmgformula X&lt;br /&gt;
|Specify a monster&#039;s unique formula for dealing damage.  For example, the entry for Your Shadow includes &amp;quot;dmgformula 95+maxhp/6&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|drpenetration X&lt;br /&gt;
|The monster ignores your first X DR.  The Doctor is IN!&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Any keyword that expresses a &amp;quot;percent&amp;quot; should be specified as a float between 0 and 1.  For any keyword listed with (X) in parentheses, the value is optional and defaults to 1.0.&lt;/div&gt;</summary>
		<author><name>Ryo Sangnoir</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=My_garden_type&amp;diff=8542</id>
		<title>My garden type</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=My_garden_type&amp;diff=8542"/>
		<updated>2020-04-11T23:09:10Z</updated>

		<summary type="html">&lt;p&gt;Ryo Sangnoir: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{&lt;br /&gt;
#vardefine:name|my_garden_type}}{{&lt;br /&gt;
#vardefine:return_type|string}}{{&lt;br /&gt;
&lt;br /&gt;
FunctionPage|&lt;br /&gt;
name={{#var:name}}|&lt;br /&gt;
&lt;br /&gt;
function1={{Function|&lt;br /&gt;
name={{#var:name}}|&lt;br /&gt;
aggregate={{#var:aggregate}}|&lt;br /&gt;
return_type={{#var:return_type}}|&lt;br /&gt;
return_also={{#var:return_also}}|&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
function_description=Returns the garden type of the logged-in character: none, pumpkin, peppermint, skeleton, beer, winter, thanksgarden, grass or mushroom.|&lt;br /&gt;
&lt;br /&gt;
code1={{CodeSample|&lt;br /&gt;
title=Code Sample|&lt;br /&gt;
description=To fight a piranha plant, if you can:|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if (my_garden_type() == &amp;quot;mushroom&amp;quot; &amp;amp;&amp;amp; !get_property(&amp;quot;_mushroomGardenVisited&amp;quot;).to_boolean()) {&lt;br /&gt;
  cli_execute(&amp;quot;garden fertilize&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}|&lt;br /&gt;
&lt;br /&gt;
see_also={{SeeAlso|get_campground}}|&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Item Management]]&lt;/div&gt;</summary>
		<author><name>Ryo Sangnoir</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=My_garden_type&amp;diff=8541</id>
		<title>My garden type</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=My_garden_type&amp;diff=8541"/>
		<updated>2020-04-11T17:49:13Z</updated>

		<summary type="html">&lt;p&gt;Ryo Sangnoir: Created page with &amp;quot;{{ #vardefine:name|my_garden_type}}{{ #vardefine:return_type|string}}{{  FunctionPage| name={{#var:name}}|  function1={{Function| name={{#var:name}}| aggregate={{#var:aggregat...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{&lt;br /&gt;
#vardefine:name|my_garden_type}}{{&lt;br /&gt;
#vardefine:return_type|string}}{{&lt;br /&gt;
&lt;br /&gt;
FunctionPage|&lt;br /&gt;
name={{#var:name}}|&lt;br /&gt;
&lt;br /&gt;
function1={{Function|&lt;br /&gt;
name={{#var:name}}|&lt;br /&gt;
aggregate={{#var:aggregate}}|&lt;br /&gt;
return_type={{#var:return_type}}|&lt;br /&gt;
return_also={{#var:return_also}}|&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
function_description=Returns the garden type of the logged-in character: pumpkin, peppermint, skeleton, beer, winter, thanksgarden, grass or mushroom.|&lt;br /&gt;
&lt;br /&gt;
code1={{CodeSample|&lt;br /&gt;
title=Code Sample|&lt;br /&gt;
description=To fight a piranha plant, if you can:|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if (my_garden_type() == &amp;quot;mushroom&amp;quot; &amp;amp;&amp;amp; !get_property(&amp;quot;_mushroomGardenVisited&amp;quot;).to_boolean()) {&lt;br /&gt;
  cli_execute(&amp;quot;garden fertilize&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}|&lt;br /&gt;
&lt;br /&gt;
see_also={{SeeAlso|get_campground}}|&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Item Management]]&lt;/div&gt;</summary>
		<author><name>Ryo Sangnoir</name></author>
	</entry>
</feed>