<?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=75.97.122.27</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=75.97.122.27"/>
	<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Special:Contributions/75.97.122.27"/>
	<updated>2026-04-25T08:41:30Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Miscellaneous_ASH_Features&amp;diff=6080</id>
		<title>Miscellaneous ASH Features</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Miscellaneous_ASH_Features&amp;diff=6080"/>
		<updated>2010-05-08T11:57:37Z</updated>

		<summary type="html">&lt;p&gt;75.97.122.27: /* Additional Script Uses */  - Added chatbotScript information&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOCright}}&lt;br /&gt;
==Special Syntax Functions==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[[notify]]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Used to send a simple kmail to the script&#039;s author, letting them know you use their script.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[[import]]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Used to load an external script into your current one.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[[call]]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Enables the script writer to invoke a function whose name is known at runtime.&lt;br /&gt;
&lt;br /&gt;
==Comments==&lt;br /&gt;
&lt;br /&gt;
Adding &#039;&#039;&#039;[[Comments]]&#039;&#039;&#039; to your code can make it much easier to maintain, and helps other users understand what&#039;s going on.&lt;br /&gt;
&lt;br /&gt;
==Errors==&lt;br /&gt;
&lt;br /&gt;
For help when things go wrong, please see the page on [[ASH Errors]].&lt;br /&gt;
&lt;br /&gt;
==Additional Script Uses==&lt;br /&gt;
&lt;br /&gt;
In addition to regular scripts, relay override scripts, and consult scripts, mafia has a few other hooks for adding event-driven scripts.  These situations are listed below, along with the preference that you can set a script name to (in parentheses).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Between Battle (betweenBattleScript)&#039;&#039;&#039;&lt;br /&gt;
*Executed whenever mafia is about to enter a combat. That means before every adventure if auto-adventuring, or before using an item that could lead to combat such as black pudding or drum machine.&lt;br /&gt;
*Does not require any special main() declaration.&lt;br /&gt;
*Example: Zarqon&#039;s [http://kolmafia.us/showthread.php?t=1240 Best Between Battle]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Buy (buyScript)&#039;&#039;&#039;&lt;br /&gt;
*Will execute whenever mafia needs to determine if it is to purchase or create an item.&lt;br /&gt;
*Requires a special main declaration boolean main(item itm, int qty, int ingredientLevel, boolean defaultBuy). These values will be supplied by mafia when the script is automatically called. A return value of true will instruct mafia to purchase the item and false will cause it to create the item possibly leading to other buy/create decisions.&lt;br /&gt;
**&#039;&#039;itm&#039;&#039; and &#039;&#039;qty&#039;&#039; specify the item under consideration.&lt;br /&gt;
**&#039;&#039;ingredientLevel&#039;&#039; indicates what&#039;s already available: &lt;br /&gt;
***0 = none of the ingredients&lt;br /&gt;
***1 = some of them&lt;br /&gt;
***2 = enough to create at least one of the requested item&lt;br /&gt;
**defaultBuy indicates what KoLmafia would have done otherwise; returning this value is the safest thing your script could do. It will normally be true if ingredientLevel is 0, false if 2. The default at level 1 depends on the item, and is subject to change - normally, anything made with star charts, pixels, the Malus, or multi-use are bought, anything else is created.&lt;br /&gt;
*Example: Bale&#039;s [http://kolmafia.us/showthread.php?p=18313#post18313 potionBuy].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Chatbot (chatbotScript)&#039;&#039;&#039;&lt;br /&gt;
*Will execute whenever a private message is received&lt;br /&gt;
*Requires a special main declaration void main(string sender, string message)&lt;br /&gt;
**&#039;sender&#039; is the name of the player who sent the message&lt;br /&gt;
**&#039;message&#039; is the message that was sent&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Counters (counterScript)&#039;&#039;&#039;&lt;br /&gt;
*Will execute whenever a counter will expire as a result of an intended use of adventures.&lt;br /&gt;
*Requires a special main declaration: boolean main(string name, int remain).  These values will be supplied by mafia when the script is automatically called and the return value will determine whether mafia continues operation (true) or aborts (false).  &lt;br /&gt;
**&#039;&#039;name&#039;&#039; will be the name of the counter that is about to expire.&lt;br /&gt;
**&#039;&#039;remain&#039;&#039; is the number of turns remaining before the counter expires.  Remain will usually be 0, but may be higher if you are about to multi-create items, adventure underwater, or take a vacation. &lt;br /&gt;
*Example: Bale&#039;s [http://kolmafia.us/showthread.php?t=2519 CounterChecker].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Login (loginScript)&#039;&#039;&#039;&lt;br /&gt;
:This script is immediately executed once your character is logged in.  Requires no special main() declaration.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Logout (logoutScript)&#039;&#039;&#039;&lt;br /&gt;
:Same as the loginScript, but runs on logout.  Note that an [[abort|abort()]] in the script won&#039;t stop a logout unless the logout was called in (specific ways, please list).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Planting (plantingScript)&#039;&#039;&#039;&lt;br /&gt;
:Halp!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Post-Ascension (postAscensionScript)&#039;&#039;&#039;&lt;br /&gt;
:Executed at once when your character starts a new ascension. (Example: Bales&#039;s [http://kolmafia.us/showthread.php?t=2769 newLife])&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Pre-Ascension (preAscensionScript)&#039;&#039;&#039;&lt;br /&gt;
:Executed right before entering Valhalla.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Recovery (recoveryScript)&#039;&#039;&#039;&lt;br /&gt;
*Executed whenever mafia would recover your HP / MP.  &lt;br /&gt;
*Requires a special main() declaration: boolean main(string type, int amount).  These values will be supplied when mafia automatically calls the script, and the return value will instruct mafia if it should attempt to use mafia&#039;s default healing after the script concludes. &lt;br /&gt;
**&#039;&#039;type&#039;&#039; is either &amp;quot;HP&amp;quot; or &amp;quot;MP&amp;quot;.&lt;br /&gt;
**&#039;&#039;amount&#039;&#039; is the desired amount of restoration needed or 0 to use mafia&#039;s default recovery level and target.&lt;br /&gt;
*Example: Bale&#039;s [http://kolmafia.us/showthread.php?t=1780 Universal Recovery]&lt;br /&gt;
&lt;br /&gt;
==A little CLI help==&lt;br /&gt;
&lt;br /&gt;
Two CLI commands are of great use to ASH scripters:&lt;br /&gt;
* [[ashref]] allows one to get a list of ASH functions&lt;br /&gt;
* [[ash (CLI)|ash]] or [[ash (CLI)|ashq]] allows one to run ASH directly on the CLI.&lt;br /&gt;
&lt;br /&gt;
{{RFI|Some scripts still need more information: Stares pointedly at the plantingScript and chatbotScript.}}&lt;/div&gt;</summary>
		<author><name>75.97.122.27</name></author>
	</entry>
</feed>