<?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=StDoodle</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=StDoodle"/>
	<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Special:Contributions/StDoodle"/>
	<updated>2026-04-24T19:10:59Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Help:To_Do_List&amp;diff=7572</id>
		<title>Help:To Do List</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Help:To_Do_List&amp;diff=7572"/>
		<updated>2012-01-26T14:01:33Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: /* Missing Stuff */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOCright}}&lt;br /&gt;
&lt;br /&gt;
== &amp;quot;To Do&amp;quot; List ==&lt;br /&gt;
&lt;br /&gt;
This is a list of stuff that is missing from the wiki or else needs major work. Please help!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you need tips for editing the wiki, find that here: [[Help:Editing]].&lt;br /&gt;
&lt;br /&gt;
*CLI Commands are usually only added to the [[CLI Reference]]. Only very complicated commands require their own page.&lt;br /&gt;
&lt;br /&gt;
*ASH commands need to be listed on their category page as well as on the [[Ash Functions]] list. &lt;br /&gt;
**It is not necessary to always create a code sample, although it is preferred.&lt;br /&gt;
**If you don&#039;t add a code sample, please remember to add &#039;&#039;&#039;needscode=yes|&#039;&#039;&#039; to the page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Missing Stuff ==&lt;br /&gt;
 r10025: Added &amp;quot;choice&amp;quot; CLI command, to resolve manual or unsupported choiceadventures &lt;br /&gt;
 Added &amp;quot;choice&amp;quot; CLI command, to resolve manual or unsupported choice&lt;br /&gt;
 adventures without having to visit the relay browser - which might be&lt;br /&gt;
 inconvenient if you&#039;re already in the CLI, and don&#039;t need to see the full&lt;br /&gt;
 adventure text to decide which option you want. With no parameter, &amp;quot;choice&amp;quot;&lt;br /&gt;
 just lists the options. With a numeric parameter, it picks that option. &lt;br /&gt;
 With any other parameter, it picks the first option containing that text (in&lt;br /&gt;
 either the actual button text, or mafia&#039;s spoiler text).&lt;br /&gt;
&lt;br /&gt;
 r10033:  a new command &#039;graygui&#039; (or &#039;greygui&#039; if you prefer that spelling) &lt;br /&gt;
 has been added to the CLI, which will print out all the entry points for all&lt;br /&gt;
 the stuff that still has a known open request sequence.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I would like to list all valid adventuring conditions somewhere: (Is this all of them?)&lt;br /&gt;
* {{pspan|X item}} will be fulfilled when you have X of item.&lt;br /&gt;
* {{pspan|+X item}} will be fulfilled when you have X more of the item than you previously possessed.&lt;br /&gt;
* {{pspan|X choiceadv}} will be fulfilled when you encounter X choice adventures.&lt;br /&gt;
* {{pspan|X autostop}} will be fulfilled when you encounter X autostop adventures.&lt;br /&gt;
* {{pspan|X pirate insult}} will be fulfilled when you have learned X pirate insults.&lt;br /&gt;
* {{pspan|X arena flyer ml}} will be fulfilled when you have flyered X ML worth of monsters.&lt;br /&gt;
* {{pspan|X any itemtype}} will be fulfilled when you have X items that all have a partial match to itemtype, such as {{pspan|8 any paper strip}} or {{pspan|14 any fish meat}}.&lt;br /&gt;
* {{pspan|level X}} will be fulfilled when your character is level X. This is useful for automated power leveling.&lt;br /&gt;
* {{pspan|X muscle}}, {{pspan|X mysticality}} and {{pspan|X moxie}} will be fulfilled when the specified stat is at X.&lt;br /&gt;
* Special conditions exist for several locations.&lt;br /&gt;
** {{pspan|outfit}} is only valid in the Cobb&#039;s Knob Harem, Cobb&#039;s Knob Treasury, Frat House, Hippy Camp, Pirate Cove, Itznotyerzitz Mine, and eXtreme Slope.&lt;br /&gt;
** {{pspan|castle map items}} is only valid in the Giant&#039;s Castle.&lt;br /&gt;
&lt;br /&gt;
If you leave off the quantity X, then it is assumed to be 1.&lt;br /&gt;
Remainder of possible conditions:&lt;br /&gt;
* &#039;&#039;&#039;X meat&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;X health/mana&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;X% health/mana&#039;&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;X anything but Y&#039;&#039;&#039; (opposite of &#039;&#039;&#039;any&#039;&#039;&#039;)&lt;br /&gt;
* any/anything but can take multiple item names separated by | or /.&lt;br /&gt;
* &#039;&#039;&#039;outfit&#039;&#039;&#039; can be preceded by the name of certain outfits, or the location where one normally drops, to specify a non-default outfit.  I&#039;m not sure if there&#039;s any place where that&#039;s actually useful.&lt;br /&gt;
* &#039;&#039;&#039;castle map items&#039;&#039;&#039; is technically valid everywhere; it&#039;s only non-stupid in the Giant&#039;s Castle.&lt;br /&gt;
--[[User:Jasonharper|Jasonharper]] 04:39, 3 December 2011 (EST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 There&#039;s also a &amp;quot;location&amp;quot; command, which allows new zones to work like normal with the rest of mafia.&lt;br /&gt;
 &lt;br /&gt;
 location 274 Lollipop Forest&lt;br /&gt;
 &lt;br /&gt;
 Be careful, if you add the same location twice it can make a mess. &lt;br /&gt;
 Luckily, locations added this way are not remembered, so you can quit and restart if you mess it up.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 10078: ash function format_dtg&lt;br /&gt;
 10081: ash function format_dtg renamed to be&lt;br /&gt;
 string format_date_time(inFormat, dtg, outFormat)&lt;br /&gt;
 more info: http://kolmafia.us/showthread.php?8451-time_to_string()-with-parameter&amp;amp;p=64058&amp;amp;viewfull=1#post64058&lt;br /&gt;
&lt;br /&gt;
 Modify examples on proxy record page because of:&lt;br /&gt;
 10122: Add the boolean &amp;quot;fancy&amp;quot; and &amp;quot;candy&amp;quot; fields to item proxy records.&lt;br /&gt;
 10147: Initial support for &amp;quot;Crimbo 2011&amp;quot; coinmaster: trade candy for Candy Credits&lt;br /&gt;
&lt;br /&gt;
 10227: Add the &amp;quot;closet empty&amp;quot; CLI command, and the empty_closet() ASH function.&lt;br /&gt;
&lt;br /&gt;
 10250: kingLiberatedScript called when you break the prism.&lt;br /&gt;
&lt;br /&gt;
 r10281 Add a &amp;quot;faxbot cmd&amp;quot; command which sends &amp;quot;cmd&amp;quot; to the first configure faxbot.&lt;br /&gt;
&lt;br /&gt;
 r9181, 9183, 9184 &amp;amp; r9190: moods per slyz&#039;s summary here: http://kolmafia.us/showthread.php?8852-Composable-Moods&lt;br /&gt;
&lt;br /&gt;
== Needs Major Work ==&lt;br /&gt;
&lt;br /&gt;
[[Proxy Records]] is only slightly better than a placeholder.&lt;br /&gt;
&lt;br /&gt;
 In r10047, the adventure tab interface was altered. Fix SinginSally&#039;s guide on pages...&lt;br /&gt;
 &lt;br /&gt;
 http://wiki.kolmafia.us/index.php?title=KoLmafia_Guide:_Attack_Script&lt;br /&gt;
 http://wiki.kolmafia.us/index.php?title=KoLmafia_Guide:_Custom_Combat_Script&lt;br /&gt;
 http://wiki.kolmafia.us/index.php?title=KoLmafia_Guide:_Goal-Oriented_Adventuring&lt;br /&gt;
&lt;br /&gt;
 Information on moods calling other moods: http://kolmafia.us/showthread.php?8852-Composable-Moods&amp;amp;p=66468&amp;amp;viewfull=1#post66468&lt;br /&gt;
&lt;br /&gt;
== Needs Code Samples ==&lt;br /&gt;
&lt;br /&gt;
There is a list of all pages that require code samples: [[:Category:Needs_Code_Sample|Category:Needs Code Sample]]&lt;br /&gt;
&lt;br /&gt;
Information on how to create a code sample: [[Template:CodeSample]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Talk:Restore_hp&amp;diff=7871</id>
		<title>Talk:Restore hp</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Talk:Restore_hp&amp;diff=7871"/>
		<updated>2011-12-17T17:24:08Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: Created page with &amp;quot;See page for restore_mp() for notes. --~~~~&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See page for restore_mp() for notes. --[[User:StDoodle|StDoodle (#1059825)]] 12:24, 17 December 2011 (EST)&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Restore_hp&amp;diff=4312</id>
		<title>Restore hp</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Restore_hp&amp;diff=4312"/>
		<updated>2011-12-17T17:23:50Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{&lt;br /&gt;
#vardefine:name|restore_hp}}{{&lt;br /&gt;
#vardefine:return_type|boolean}}{{&lt;br /&gt;
&lt;br /&gt;
FunctionPage|&lt;br /&gt;
&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|int|target}}|&lt;br /&gt;
p1desc={{pspan|target}} is the minimum HP desired after the function is run.|&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
function_description=Restores your HP, following your current recovery settings as closely as possible. This function only attempts to surpass {{pspan|target}}, not to arrive as closely as possible to it. If your current KoLmafia recovery settings are lower than your current HP (or off), this function will restore the bare minimum necessary to reach {{pspan|target}} using the restores you have checked. If, however, you have your recovery setting set to &amp;quot;Try to recover up to 100% health,&amp;quot; this function will follow that preference if possible.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;If {{pspan|target}} is zero then it will restore HP according to KoLmafia&#039;s recovery settings.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;This function will do nothing and return false if you have not checked any restore items. Otherwise, this function returns true if your HP is at or equal to {{pspan|target}} when finished. If {{pspan|target}} is set above your current max HP, this function will attempt to restore to that amount and report its success based on that goal, not the number used for {{pspan|target}}.|&lt;br /&gt;
&lt;br /&gt;
code1={{CodeSample|&lt;br /&gt;
title=Code Sample|&lt;br /&gt;
description=This sample attempts to restore your HP to full.|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if (my_hp() &amp;lt; my_maxhp()) {&lt;br /&gt;
   restore_hp(my_maxhp());&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
see_also={{SeeAlso|my_hp|my_mp|my_maxhp|my_maxmp|restore_mp}}|&lt;br /&gt;
cli_equiv=The CLI command &amp;quot;restore&amp;quot; has similar functionality.|&lt;br /&gt;
special=Note: the return value can be over-ridden by a [[Miscellaneous_ASH_Features#Recovery_.28recoveryScript.29|recoveryScript]] if in use. If your script&#039;s behavior changes based on the return value of this function, it is recommended that you explicitly state which, if any, recoveryScripts it can support when publicly releasing your script.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Skills and Effects]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Talk:Restore_mp&amp;diff=7870</id>
		<title>Talk:Restore mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Talk:Restore_mp&amp;diff=7870"/>
		<updated>2011-12-17T17:23:20Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: Created page with &amp;quot;An attempt has been made to clarify how this changes with a recoveryScript active, feel free to further edit as needed (I really don&amp;#039;t have enough info to get it &amp;quot;perfect&amp;quot;). --~~~~&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;An attempt has been made to clarify how this changes with a recoveryScript active, feel free to further edit as needed (I really don&#039;t have enough info to get it &amp;quot;perfect&amp;quot;). --[[User:StDoodle|StDoodle (#1059825)]] 12:23, 17 December 2011 (EST)&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Restore_mp&amp;diff=4318</id>
		<title>Restore mp</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Restore_mp&amp;diff=4318"/>
		<updated>2011-12-17T17:22:31Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{&lt;br /&gt;
#vardefine:name|restore_mp}}{{&lt;br /&gt;
#vardefine:return_type|boolean}}{{&lt;br /&gt;
&lt;br /&gt;
FunctionPage|&lt;br /&gt;
&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|int|target}}|&lt;br /&gt;
p1desc={{pspan|target}} is the minimum MP desired after the function is run.|&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
function_description=Restores your MP, following your current recovery settings as closely as possible. This function only attempts to surpass {{pspan|target}}, not to arrive as closely as possible to it. If your current KoLmafia recovery settings are lower than your current MP (or off), this function will restore the bare minimum necessary to reach {{pspan|target}} using the restores you have checked. If, however, you have your recovery setting set to &amp;quot;Try to recover up to 100% mana,&amp;quot; this function will follow that preference if possible.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;If {{pspan|target}} is zero then it will restore MP according to KoLmafia&#039;s recovery settings.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;This function will do nothing and return false if you have not checked any restore items. Otherwise, this function returns true if your MP is at or equal to {{pspan|target}} when finished. If {{pspan|target}} is set above your current max MP, this function will attempt to restore to that amount and report its success based on that goal, not the number used for {{pspan|target}}.|&lt;br /&gt;
&lt;br /&gt;
code1={{CodeSample|&lt;br /&gt;
title=Code Sample|&lt;br /&gt;
description=This sample attempts to restore your MP to full.|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if (my_mp() &amp;lt; my_maxmp()) {&lt;br /&gt;
   restore_mp(my_maxmp());&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
see_also={{SeeAlso|my_hp|my_mp|my_maxhp|my_maxmp|restore_hp}}|&lt;br /&gt;
cli_equiv=The CLI command &amp;quot;restore&amp;quot; has similar functionality.|&lt;br /&gt;
special=Note: the return value can be over-ridden by a [[Miscellaneous_ASH_Features#Recovery_.28recoveryScript.29|recoveryScript]] if in use. If your script&#039;s behavior changes based on the return value of this function, it is recommended that you explicitly state which, if any, recoveryScripts it can support when publicly releasing your script.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Skills and Effects]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Talk:File_to_map&amp;diff=7851</id>
		<title>Talk:File to map</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Talk:File_to_map&amp;diff=7851"/>
		<updated>2011-10-23T16:32:52Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: Created page with &amp;quot;=Sub Directories= As of revision 9130, we have been able to specify sub-directories for data files. A lot of scripts would be &amp;quot;nicer&amp;quot; if they did this, so we should probably figu...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Sub Directories=&lt;br /&gt;
As of revision 9130, we have been able to specify sub-directories for data files. A lot of scripts would be &amp;quot;nicer&amp;quot; if they did this, so we should probably figure out a good way to a&#039;splain this here. For reference, see post:&lt;br /&gt;
&lt;br /&gt;
http://kolmafia.us/showthread.php?6162-9130-Move-data-file-timestamp-caching-to-a-separate-class-and-fix-some-files-getting&amp;amp;highlight=file_to_map&lt;br /&gt;
&lt;br /&gt;
--[[User:StDoodle|StDoodle (#1059825)]] 12:32, 23 October 2011 (EDT)&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Talk:Miscellaneous_ASH_Features&amp;diff=6178</id>
		<title>Talk:Miscellaneous ASH Features</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Talk:Miscellaneous_ASH_Features&amp;diff=6178"/>
		<updated>2011-07-01T16:55:41Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;TODO:&lt;br /&gt;
&lt;br /&gt;
All of the bolded script types need to become next-level headings, to make it easier to search and link directly to &amp;quot;sometypeScript&amp;quot; etc. --[[User:StDoodle|StDoodle (#1059825)]] 16:55, 1 July 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
I&#039;m not sure how to handle that, since &amp;quot;script&amp;quot; neither needs or has its own page (it is, after all, meaningless without &amp;quot;notify&amp;quot;). I&#039;m thinking the &amp;quot;script&amp;quot; page should just be a redirect to the heading on the &amp;quot;notify&amp;quot; page, but not listed.&lt;br /&gt;
&lt;br /&gt;
Anyone with further thoughts, or other miscellaneous pseudo-functions, please chime in. --[[User:StDoodle|StDoodle (#1059825)]] 02:51, 13 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
I agree, since the notify and scripts are basicly one thing --[[User:Icon315|Icon315]] 03:00, 13 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
* I believe that script needs its own page because people find commands in scripts and look them up here. They should be able to believe that they can always do that. Therefore script needs its own page and should be referenced here even though it is always used in conjunction with notify. Naturally that connection should be highlighted on the page for [[script]]. --[[User:Bale|Bale]] 09:06, 13 April 2010 (UTC)&lt;br /&gt;
** script doesn&#039;t mean much outside of its use with notify; however, if the page exists, and redirects to a subheading on the notify page (as happens when you click on a data type on a function page), a user will go to the &amp;quot;right&amp;quot; spot, and search will work as intended, so this is what I&#039;m leaning towards. --[[User:StDoodle|StDoodle (#1059825)]] 09:14, 13 April 2010 (UTC)&lt;br /&gt;
** A search for script will now be directed to information about the command so it satisfies me. --[[User:Bale|Bale]] 10:27, 13 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
This is probably the best (or least-worst?) page to reference the &amp;quot;comments&amp;quot; page from as well (which only needs syntaxhighlight-tag-ification, really).--[[User:StDoodle|StDoodle (#1059825)]] 04:01, 13 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
* Emphatically yes. Good point. --[[User:Bale|Bale]] 09:07, 13 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Moved the discussion stuff to the talk page, &#039;cause... yeah. :P  --[[User:StDoodle|StDoodle (#1059825)]] 08:54, 13 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
There&#039;s no point in a ??? step if it isn&#039;t BEFORE profit. :( --[[User:StDoodle|StDoodle (#1059825)]] 00:37, 15 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
I don&#039;t think that profitScript even exists -- how the heck would that work? (On that other hand, there has been a profit.ash...) --[[User:Heeheehee|Heeheehee]] 05:03, 16 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Relax, it was just a joke. Probably should have left it off the page, I know, but I was very tired at the time. I just realized after writing part of a list that I didn&#039;t have something I was trying to think of, so naturally I wrote &amp;quot;???&amp;quot; followed by &amp;quot;Profit.&amp;quot; Ah, internet humor. --[[User:StDoodle|StDoodle (#1059825)]] 15:04, 16 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Ah, another thing we need to figure out how to add: calling functions method-style. I&#039;m not a programmer, so my ability to explain this is limited. :( --[[User:StDoodle|StDoodle (#1059825)]] 06:53, 20 April 2010 (UTC)&lt;br /&gt;
*Sorry, but I&#039;m not quite sure what you are asking for. Please explain. --[[User:Bale|Bale]] 10:03, 20 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Ie if you have a string &amp;quot;foo&amp;quot; declared, foo.print() vs print(foo).&lt;br /&gt;
&lt;br /&gt;
What I do know;&lt;br /&gt;
* whatever is in front of the .function_name() is used as the first parameter&lt;br /&gt;
What I don&#039;t know;&lt;br /&gt;
* Is there any exception to the above? Are all overloaded functions able to intelligently handle the appropriate datatypes?&lt;br /&gt;
* Are there performance differences?&lt;br /&gt;
* Is there a better way to refer to using foo.do_thing() than &amp;quot;method style&amp;quot; (again, little formal training)&lt;br /&gt;
--[[User:StDoodle|StDoodle (#1059825)]] 15:58, 20 April 2010 (UTC)&lt;br /&gt;
: There are no exceptions or performance differences. It always works, including with overloaded functions. The only difference is programming style, just like decisions about much whitespace to use, positioning of curly brackets or breaking long lines into two lines. I&#039;d refer to it as &amp;quot;function calling style&amp;quot;. --[[User:Bale|Bale]] 23:56, 20 April 2010 (UTC)&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=User_talk:StDoodle&amp;diff=4306</id>
		<title>User talk:StDoodle</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=User_talk:StDoodle&amp;diff=4306"/>
		<updated>2011-03-12T14:59:49Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: /* test fake CLI */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Please let me know what&#039;s on your mind!==&lt;br /&gt;
&lt;br /&gt;
Any suggestions or comments are welcome, folks. Just leave them here, and please sign your posts.&lt;br /&gt;
&lt;br /&gt;
Also; if you don&#039;t have anything on your user page, please leave contact info or check back here for a reply.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Wrote up some information about [[Custom Combat Script]], including consult scripts for you. I think it is pretty good, but feel free to do anything with it that you like. You can move it to the [[In-combat Consulting]] page or whatever. If I left out anything of importance or I need to add more detail to some part, let me know. --[[User:Bale|Bale]] 10:21, 3 March 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Added combat filter information and examples to [[adventure]](). What is my next assignment? :) --[[User:Bale|Bale]] 11:03, 3 March 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Triple equal sign means &amp;quot;exactly equal to&amp;quot; (value &amp;amp; type). Same result, anyways. --[[User:Heeheehee|Heeheehee]] 19:42, 7 March 2010 (UTC)&lt;br /&gt;
Apparently Mafia doesn&#039;t recognize the triple-equals sign, though. Huh. (That bit of code was copy-pasted from the seltzer example, then modified slightly) --[[User:Heeheehee|Heeheehee]] 02:25, 8 March 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Hey! why was this: &amp;quot;KoLmafia Guide: Scripting for Dummies&amp;quot; deleted?  It was helpful -[[User:Yag|Yag]] 19:15, 20 March 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hey do you think you should add a link to Notepad ++? also to Bale&#039;s [http://kolmafia.us/showthread.php?3770-Write-mafia-code-prettily!&amp;amp;p=26376&amp;amp;viewfull=1#post26376 coloring ]  of notepad ++. Also &#039;&#039;&#039;Category:Needs Code Sample&#039;&#039;&#039; Seems to have some stuff listed that do have code samples  --[[User:Icon315|Icon315]] 04:05, 9 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
==for Grotfang==&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
int clan_id() {&lt;br /&gt;
	string x = visit_url( &amp;quot;showplayer.php?who=&amp;quot; + my_id().to_string() );&lt;br /&gt;
	string clan_num = &amp;quot;&amp;quot;;&lt;br /&gt;
	&lt;br /&gt;
	if( contains_text( x , &amp;quot;showclan.php?whichclan=&amp;quot; ) ) 	{&lt;br /&gt;
		matcher mat = create_matcher(&amp;quot;whichclan\=(\\d+)&amp;quot;,x);&lt;br /&gt;
		if(find(mat)) clan_num = group(mat,1);&lt;br /&gt;
	}&lt;br /&gt;
		return clan_num.to_int();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I saw your note on my talk page, and I&#039;m curious as to the reasoning behind the deletes.  Are these pages you think need to be rewritten, or pages you think just don&#039;t need to be there at all? &lt;br /&gt;
-Metraxis 15:05, 15 March 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Awww... ==&lt;br /&gt;
&lt;br /&gt;
Your little history seems somewhat familiar. (minus the leaving and coming back part)&lt;br /&gt;
I, however, clearly did not go as far in restructuring as you did. I am a little sad to see the few pages I wrote rewritten, but glad to know that someone is making a concentrated effort to make things even more clearer.&lt;br /&gt;
&lt;br /&gt;
===test fake CLI===&lt;br /&gt;
&amp;lt;div style=&amp;quot;background-color: #e0e0e0; padding: 4px; margin: 0;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;pre style=&amp;quot;margin: 0; padding: 4px; font-family: Helvetica; font-size: 11pt; line-height: 16pt; border: solid 1px gray;&amp;quot;&amp;gt;&lt;br /&gt;
hello&lt;br /&gt;
print goto sub har har&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===testing?===&lt;br /&gt;
&lt;br /&gt;
In the wake of changes, must test.&lt;br /&gt;
&lt;br /&gt;
== Permissions ==&lt;br /&gt;
&lt;br /&gt;
How does one become an administrator? i would like to be one, that way i can delete/block spammers when you guys are not here--[[User:Icon315|Icon315]] 20:58, 21 July 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
* Spammers aren&#039;t a huge problem, they&#039;re just annoying. Mostly because they only seem to cause their problems at intervals rather than flooding many pages until finally stopped, so there isn&#039;t a lot of immanency to it. I&#039;m not sure we really need more admins for this tiny wiki. However, if StDoodle disagrees he&#039;ll do something about it.&lt;br /&gt;
&lt;br /&gt;
* The way to become an admin is StDoodle decides to do it. He&#039;s about 90% in charge of everything here since he served as the guiding light showing this wiki its way to relevancy. If he thinks someone is a good candidate AND he thinks we need more help, he&#039;d ask them. &lt;br /&gt;
&lt;br /&gt;
* --[[User:Bale|Bale]] 21:42, 21 July 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Pretty much true, but on the other hand, there are a few permissions issues (such as external links &amp;amp; images) that allow &amp;quot;red tape removal&amp;quot; when you&#039;re an admin. I&#039;ll make you one if you can agree to the following guidelines:&lt;br /&gt;
* fewyn&#039;s sanity comes first; as the provider of our hosting, we need to avoid causing problems. Shouldn&#039;t really ever be an issue, but it does need to be mentioned.&lt;br /&gt;
* Don&#039;t start revert wars or the like. Don&#039;t delete or move pages except in cases of obvious spam. If you find factual information that you are 100% sure is wrong, change it. Otherwise, I prefer to allow what&#039;s been added to stay unless there is some discussion (usually on a talk page) first. Likewise, page moves &amp;amp; deletion should be discussed first in 99% of non-spam cases. This doesn&#039;t apply nearly as strictly to new information, but rather for changing someone else&#039;s edits / work.&lt;br /&gt;
* The guide belongs to Sally (and the images are mostly from Bale). Anything that isn&#039;t a 100% &amp;quot;the facts are wrong&amp;quot; change should really go through her (or Bale for image additions, to keep a consistent look, unless your screenshots look nearly identical). This may change if she ever abandons the project, but while she remains active in it, she has final say on most of its content.&lt;br /&gt;
* Learn &amp;amp; follow established standards. Mostly, this involves using the templates in existence when appropriate, and adding &amp;lt;nowiki&amp;gt;{{TOCright}}&amp;lt;/nowiki&amp;gt; to pages with a table of contents. Do NOT make edits to templates without REALLY GOOD REASON or discussion.&lt;br /&gt;
Beyond that, I have no issue making anyone who has shown an interest &amp;amp; involvement in KoLmafia &amp;amp; this wiki into an admin. If these conditions are acceptable, just let me know and you can join the ranks. --[[User:StDoodle|StDoodle (#1059825)]] 21:54, 21 July 2010 (UTC)&lt;br /&gt;
**I am somewhat new to the KoLMafia community, but i am very interested in becoming way better in these sort of things. I am no where near as good as scripting as the rest of you, but i do wish to be. So yes i have read through the guidelines and i do not have any problem with them, and i promise not to do anything against them. Signed--[[User:Icon315|Icon315]] 22:43, 21 July 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Good guidelines. I&#039;d comment that you don&#039;t need to be so hands-off with Sally&#039;s guide since she&#039;s pretty happy to have others help with it, but it is important to keep it consistent to her tone and be considerate of her ways of doing things. --[[User:Bale|Bale]] 22:44, 21 July 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Thanks for the [[File_talk:Breakable_equipment.jpg|bump to Bureaucrat]]. I appreciate the expression of trust and fortunately it shouldn&#039;t be much more time consuming than the work I usually put into the wiki. I&#039;m sorry to hear you&#039;re going through such trouble right now. Good luck with real life. --[[User:Bale|Bale]] 10:00, 25 August 2010 (UTC)&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=User_talk:Bale&amp;diff=4342</id>
		<title>User talk:Bale</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=User_talk:Bale&amp;diff=4342"/>
		<updated>2011-03-01T04:36:10Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Bale;&lt;br /&gt;
&lt;br /&gt;
Sorry, I was called away &amp;amp; didn&#039;t get back till you were gone, so I thought I&#039;d answer your questions here before I lost &#039;em.&lt;br /&gt;
&lt;br /&gt;
RE: Consult Scripts. How many rounds does the consult script act for? Does a consult script keep running until combat is over? Just for rounds it&#039;s specifically called? I totally don&#039;t understand how that works...&lt;br /&gt;
&lt;br /&gt;
RE: appearance_rates() &amp;amp; ultra-rares; when using said function on the treasury, it returned -42.5 for that UR monster. It just seems a point worth mentioning, in case anyone wants to parse UR availability by location; wouldn&#039;t want them to assume a STATIC negative number.&lt;br /&gt;
&lt;br /&gt;
Thanks, --[[User:StDoodle|StDoodle]] 23:52, 4 March 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note:&lt;br /&gt;
&lt;br /&gt;
I&#039;ve updated the front page (again); it now includes a link to [[Help:Editing]], where I will try to keep all relevant information on what needs work on the wiki. --[[User:StDoodle|StDoodle]] 13:32, 4 March 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Nice job on [[Custom Combat Script]]! I fixed two minor typos, but otherwise it looks great. There are a few things I&#039;d like to flesh out eventually, such as formatting (make sure to have a space on each side of monster / location name), mention that locations are acceptable, how to specify 2nd funksling item, etc. But most of that is &amp;quot;Regular Mafia&amp;quot; stuff, which, while I intend to get to, is after ash on my to-do list.&lt;br /&gt;
&lt;br /&gt;
For now, I&#039;m &#039;&#039;trying&#039;&#039; to keep up with tagging articles that need specific help, so keep an eye on:&amp;lt;br /&amp;gt;&lt;br /&gt;
* [[:Category:Request_For_Information]]&lt;br /&gt;
* [[:Category:Needs_Code_Sample]]&lt;br /&gt;
if you want to know where I need the most help.&lt;br /&gt;
&lt;br /&gt;
Also, I want to eventually redo a lot of the regular-mafia stuff as well. I think it deserves its own section similar to &amp;quot;Quick Links for ASH Scripters&amp;quot; on the main page, with links to a page for each mafia tab / window. For page naming, I&#039;d like to go with &amp;quot;Adventuring Tab,&amp;quot; &amp;quot;Graphical CLI Tab,&amp;quot; etc. to avoid any collision with function names. I imagine that a lot of the info on these pages will either be stolen from, or added in by Sally.&lt;br /&gt;
&lt;br /&gt;
While in general this is a lower priority from my POV, I&#039;d like to get the pages set up so that others can work on them.&lt;br /&gt;
&lt;br /&gt;
If you want to tackle something more ASH-related, one thing that bugs me is the rather arbitrary (and in many cases outdated) categorization of ASH functions. If you&#039;d like to go through the list &amp;amp; break them up more sensibly, that would be much appreciated!&lt;br /&gt;
&lt;br /&gt;
Thanks! --[[User:StDoodle|StDoodle]] 14:56, 3 March 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
As you may have noticed me mentioning on the forum, I&#039;ve given you admin powers. Mostly, this makes it easier to quickly revert undesired changes, and to protect pages if needed. But also! you should no longer see nearly as many captcha&#039;s &amp;amp; such. --[[User:StDoodle|StDoodle (#1059825)]] 07:41, 22 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Regarding wiki-style lists (using * for bullet points): I generally find it easier to just add a non-breaking space (&amp;amp;amp;nbsp;) on the line after the list rather than add in HTML (see the source of [[to_slot]] to see what I mean -- I can&#039;t really articulate these things too well) --[[User:Heeheehee|Heeheehee]] 06:10, 28 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
drive-by. :P --[[User:StDoodle|StDoodle (#1059825)]] 04:30, 7 May 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Is this the right place to respond to your message to me here? If not, my apologies. In any event, yes, apparently I did have an account here and couldn&#039;t remember my password and had to get a temporary one sent to me. I&#039;ll probably forget the password that I changed it to if I get logged out of this and will have to get another temp password. I&#039;m terrible like that lol. --[[User:Spiny Twizzler|Spiny Twizzler]] 04:49, 11 June 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
You are now a Bureaucrat as well as an Administrator. I think this means you can now edit user permissions, but I was never just an admin, so I&#039;m not sure. ;) Good luck! --[[User:StDoodle|StDoodle (#1059825)]] 07:30, 25 August 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
=== Pipes ===&lt;br /&gt;
&lt;br /&gt;
Just a quick heads up; the wiki automatically puts a pipe between each category, whether it&#039;s called directly on-page or from a template; putting a pipe in manually between categories means the pipe will show up &#039;&#039;after&#039;&#039; the categories on its own line. ;) --[[User:StDoodle|StDoodle (#1059825)]] 04:36, 1 March 2011 (UTC)&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=To_plural&amp;diff=5161</id>
		<title>To plural</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=To_plural&amp;diff=5161"/>
		<updated>2011-03-01T04:34:15Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: extra pipe removed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{&lt;br /&gt;
#vardefine:name|to_plural}}{{&lt;br /&gt;
#vardefine:return_type|string}}{{&lt;br /&gt;
&lt;br /&gt;
FunctionPage|&lt;br /&gt;
&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;
p1desc={{pspan|it}} is the item you want to return the plural of.&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
function_description=Returns the plural of an item in the form of a string.|&lt;br /&gt;
&lt;br /&gt;
code1={{CodeSample|&lt;br /&gt;
title=Code Samples|&lt;br /&gt;
description=Prints diet information after eating.|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
eat(3 , $item[hot hi mein]);&lt;br /&gt;
print(&amp;quot;You have eaten 3 &amp;quot; + to_plural($item[hot hi mein]));&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
see_also={{SeeAlso|to_item}}|&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Item Management]][[Category:Datatype Conversions]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=User_talk:Holatuwol&amp;diff=7426</id>
		<title>User talk:Holatuwol</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=User_talk:Holatuwol&amp;diff=7426"/>
		<updated>2011-02-22T17:49:42Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: Created page with &amp;#039;Welcome to the wiki! &amp;#039;bout damn time. :p --~~~~&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Welcome to the wiki! &#039;bout damn time. :p --[[User:StDoodle|StDoodle (#1059825)]] 17:49, 22 February 2011 (UTC)&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Split_string&amp;diff=5592</id>
		<title>Split string</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Split_string&amp;diff=5592"/>
		<updated>2011-02-19T19:18:32Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: its not it&amp;#039;s&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{&lt;br /&gt;
#vardefine:name|split_string}}{{&lt;br /&gt;
#vardefine:return_type|string [int]}}{{&lt;br /&gt;
#vardefine:aggregate|yes}}{{&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|string|source}}|&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|string|source}}|&lt;br /&gt;
parameter2={{Param|string|delimiter}}|&lt;br /&gt;
p1desc={{Pspan|source}} is the string to split|&lt;br /&gt;
p2desc={{Pspan|delimiter}} is the (optional) [[Regular Expressions|regular expression]] to split with|&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
function_description=Returns an array of your {{pspan|source}}, split by either {{pspan|delimiter}} or by line-breaks if not supplied.|&lt;br /&gt;
&lt;br /&gt;
needscode=yes|&lt;br /&gt;
&lt;br /&gt;
special=This function technically returns an array, not a map. The information in both is accessed in the same way. However, you cannot add new key-value pairs to an array (its length is static once set).|&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:String Handling Routines]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Talk:Data_Types&amp;diff=6946</id>
		<title>Talk:Data Types</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Talk:Data_Types&amp;diff=6946"/>
		<updated>2011-02-18T03:36:30Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: /* Re: rollback */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Note=&lt;br /&gt;
&lt;br /&gt;
This page copied from the deletion-in-progress Datatype Constants discussion page.&lt;br /&gt;
&lt;br /&gt;
=Old Discussion=&lt;br /&gt;
&lt;br /&gt;
Yes, this page should be renamed &amp;amp; such. It&#039;s another artifact of the way things were when I started working on the wiki, that unfortunately became a &amp;quot;hub&amp;quot; of sorts without being properly changed. However, since HUNDREDS of pages link here, we really need to be a bit more careful before moving this page. It should probably be done by a mod (to avoid automatic redirect creation) AFTER various prerequisites are taken care of. --[[User:StDoodle|StDoodle (#1059825)]] 04:29, 21 June 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
*Thanks for clarification, and sorry about not discussing it first. --[[User:PhilmASTErpLus|PhilmASTErpLus]]&lt;br /&gt;
&lt;br /&gt;
Ugh. It&#039;s worse than I thought; when templates are nested, it takes a while for the &amp;quot;what links here&amp;quot; pages to get updated. I&#039;ve started the process of transitioning from &amp;quot;Datatype Constantes&amp;quot; to &amp;quot;Data Types,&amp;quot; but it may be a while before it&#039;s complete. Warning: please leave this project alone, I&#039;ve got a handle on it &amp;amp; don&#039;t want confilcts. Thanks. --[[User:StDoodle|StDoodle (#1059825)]] 04:52, 14 July 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Yeah, uh, finger slipped. Oops. (Undone now, don&#039;t worry about it.) --[[User:Heeheehee|Heeheehee]] 12:09, 22 June 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
It&#039;s all yours. Good luck with it. --[[User:Bale|Bale]] 05:17, 14 July 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Gee that was fun (not). But I think it&#039;s done; KoLmafia wiki, now 50% less untechnically accurate! --[[User:StDoodle|StDoodle (#1059825)]] 05:38, 14 July 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Call by value or call by reference? ==&lt;br /&gt;
&lt;br /&gt;
I actually wrote a simple script to see how it works. Apparently all the primitive data types are called by value when passed to a function, whereas maps and records are called by reference (with smart garbage collection!). I presume this is the same for substitution(&amp;lt;code&amp;gt;=&amp;lt;/code&amp;gt;), and that buffers are called by reference, though I haven&#039;t tried either. Could someone high up there please verify this information before I add it? --[[User:PhilmASTErpLus|PhilmASTErpLus]] 07:14, 23 June 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
= Re: rollback =&lt;br /&gt;
&lt;br /&gt;
I&#039;m not using the very latest daily, I know, but on r9045 it DOESN&#039;T change the result if you JUST change the 2 to 2.0. I get 0.0 as my result. Can you double-check that this has changed? --[[User:StDoodle|StDoodle (#1059825)]] 03:34, 18 February 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
Er, edit to clarify; could someone verify that this is INTENDED, and thus safe advice, vs. just being a side-effect of some other change, and subject to revert to the behavior I&#039;m seeing. --[[User:StDoodle|StDoodle (#1059825)]] 03:36, 18 February 2011 (UTC)&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Talk:Data_Types&amp;diff=6945</id>
		<title>Talk:Data Types</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Talk:Data_Types&amp;diff=6945"/>
		<updated>2011-02-18T03:34:10Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: /* Call by value or call by reference? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Note=&lt;br /&gt;
&lt;br /&gt;
This page copied from the deletion-in-progress Datatype Constants discussion page.&lt;br /&gt;
&lt;br /&gt;
=Old Discussion=&lt;br /&gt;
&lt;br /&gt;
Yes, this page should be renamed &amp;amp; such. It&#039;s another artifact of the way things were when I started working on the wiki, that unfortunately became a &amp;quot;hub&amp;quot; of sorts without being properly changed. However, since HUNDREDS of pages link here, we really need to be a bit more careful before moving this page. It should probably be done by a mod (to avoid automatic redirect creation) AFTER various prerequisites are taken care of. --[[User:StDoodle|StDoodle (#1059825)]] 04:29, 21 June 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
*Thanks for clarification, and sorry about not discussing it first. --[[User:PhilmASTErpLus|PhilmASTErpLus]]&lt;br /&gt;
&lt;br /&gt;
Ugh. It&#039;s worse than I thought; when templates are nested, it takes a while for the &amp;quot;what links here&amp;quot; pages to get updated. I&#039;ve started the process of transitioning from &amp;quot;Datatype Constantes&amp;quot; to &amp;quot;Data Types,&amp;quot; but it may be a while before it&#039;s complete. Warning: please leave this project alone, I&#039;ve got a handle on it &amp;amp; don&#039;t want confilcts. Thanks. --[[User:StDoodle|StDoodle (#1059825)]] 04:52, 14 July 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Yeah, uh, finger slipped. Oops. (Undone now, don&#039;t worry about it.) --[[User:Heeheehee|Heeheehee]] 12:09, 22 June 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
It&#039;s all yours. Good luck with it. --[[User:Bale|Bale]] 05:17, 14 July 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
Gee that was fun (not). But I think it&#039;s done; KoLmafia wiki, now 50% less untechnically accurate! --[[User:StDoodle|StDoodle (#1059825)]] 05:38, 14 July 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Call by value or call by reference? ==&lt;br /&gt;
&lt;br /&gt;
I actually wrote a simple script to see how it works. Apparently all the primitive data types are called by value when passed to a function, whereas maps and records are called by reference (with smart garbage collection!). I presume this is the same for substitution(&amp;lt;code&amp;gt;=&amp;lt;/code&amp;gt;), and that buffers are called by reference, though I haven&#039;t tried either. Could someone high up there please verify this information before I add it? --[[User:PhilmASTErpLus|PhilmASTErpLus]] 07:14, 23 June 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
= Re: rollback =&lt;br /&gt;
&lt;br /&gt;
I&#039;m not using the very latest daily, I know, but on r9045 it DOESN&#039;T change the result if you JUST change the 2 to 2.0. I get 0.0 as my result. Can you double-check that this has changed? --[[User:StDoodle|StDoodle (#1059825)]] 03:34, 18 February 2011 (UTC)&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Data_Types&amp;diff=6790</id>
		<title>Data Types</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Data_Types&amp;diff=6790"/>
		<updated>2011-02-18T03:32:56Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: Reverted edits by Bale (Talk) to last revision by StDoodle&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOCright}}&lt;br /&gt;
==Primitive Datatypes==&lt;br /&gt;
&lt;br /&gt;
===void===&lt;br /&gt;
Can be thought of better as the absence of a datatype. No value can be assigned to &#039;&#039;&#039;void&#039;&#039;&#039; nor can a value be returned from a function of datatype &#039;&#039;&#039;void&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===boolean===&lt;br /&gt;
A boolean value is either &#039;&#039;&#039;true&#039;&#039;&#039; or &#039;&#039;&#039;false&#039;&#039;&#039;. By default, a boolean variable is set to false.&lt;br /&gt;
&lt;br /&gt;
===int===&lt;br /&gt;
&lt;br /&gt;
A whole number (short for &amp;quot;integer&amp;quot;), either positive or negative (or 0).  The int used by KoLmafia is a 32-bit signed int, meaning it has a maximum value of 2,147,483,647 and a minimum value of -2,147,483,648. The default value of a integer variable is 0.&lt;br /&gt;
&lt;br /&gt;
Be careful when doing math with integers! As with some other strongly-typed languages, numbers are converted to integers at every step of the operation when only integer types are used. For example:&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
int a = 1;&lt;br /&gt;
int b = 2;&lt;br /&gt;
print( a / b * 2 );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
Will give the output &amp;quot;0,&amp;quot; not &amp;quot;1&amp;quot; as you may expect. Changing either variable to a float type will &amp;quot;correct&amp;quot; this.&lt;br /&gt;
&lt;br /&gt;
===float===&lt;br /&gt;
&lt;br /&gt;
The float data type is a single-precision 32-bit IEEE 754 floating point. Its range of values is beyond the scope of this discussion, but is specified in section 4.2.3 of the Java Language Specification. [http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.2.3]&lt;br /&gt;
&lt;br /&gt;
When assigning to a variable of type float, one should be careful to always enter numbers in decimal form, as unwanted behavior can result from supplying a value that KoLmafia may interpret as an int type without the decimal point.&lt;br /&gt;
&lt;br /&gt;
Note that float is not infinitely precise; it intrinsically rounds off after a certain point. This loss of accuracy is for the sake of storage, but beware of the possibility of small errors compounding from multiple float types.&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
description=For instance, try the following code as an example of how rather long post-decimal portions are handled:|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
float f;&lt;br /&gt;
f = 4.9999999;&lt;br /&gt;
print( f );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
The default value of a &amp;lt;code&amp;gt;float&amp;lt;/code&amp;gt; variable is 0.0.&lt;br /&gt;
&lt;br /&gt;
===string===&lt;br /&gt;
&lt;br /&gt;
A group of characters including, but not limited to: lowercase letters, uppercase characters, numbers, and various control characters. When assigning a value to a string, always enclose the desired value in either single or double quotes (note you must use the same quote type on both ends of the string assignment). If you need to include the same character inside of the string itself, you will need to escape it first with a backslash.{{CodeSample|&lt;br /&gt;
description=For example:|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
string s = &amp;quot;This is my \&amp;quot;friend\&amp;quot; Pete.&amp;quot;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;|&lt;br /&gt;
moreinfo=&lt;br /&gt;
Will result in the following being stored to s:&lt;br /&gt;
&amp;lt;pre&amp;gt;This is my &amp;quot;friend&amp;quot; Pete&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
The default value of a string is an empty string, or literally &amp;lt;code&amp;gt;&amp;quot;&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===buffer===&lt;br /&gt;
&lt;br /&gt;
Similar to a string, but more efficient in certain operations, including concatenation and passing as function arguments. For the most part, you can interchange references to strings and buffers. However, you should test all such actions first, as a few functions require a specific datatype to be supplied as a parameter. (Most notably, those listed under [[String Handling Routines#Regular Expressions|Regular Expressions]].)&lt;br /&gt;
&lt;br /&gt;
==Special Datatypes==&lt;br /&gt;
&lt;br /&gt;
Several datatypes are included in KoLmafia to represent common categories within the KoL universe.&lt;br /&gt;
&lt;br /&gt;
Note that while variables of these types are declared in the same way as for Primitive Datatypes; assigning and referencing them is done differently.&lt;br /&gt;
{{CodeSample|&lt;br /&gt;
description=For example, to declare an item datatype and assign it a value, you would use the following line of code:|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
item it = $item[ broken skull ];&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
The default values of any variable of one of the following types is &amp;lt;code&amp;gt;$&#039;&#039;type&#039;&#039;[ none ]&amp;lt;/code&amp;gt;. For example, the default value of a &amp;lt;code&amp;gt;item&amp;lt;/code&amp;gt; variable is &amp;lt;code&amp;gt;$item[ none ]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===class===&lt;br /&gt;
&lt;br /&gt;
Besides $class[ none ], there are six possible values for this datatype:&lt;br /&gt;
&lt;br /&gt;
* Seal Clubber&lt;br /&gt;
* Turtle Tamer&lt;br /&gt;
* Pastamancer&lt;br /&gt;
* Sauceror&lt;br /&gt;
* Disco Bandit&lt;br /&gt;
* Accordion Thief &lt;br /&gt;
&lt;br /&gt;
===effect===&lt;br /&gt;
&lt;br /&gt;
Any effect you can be under in KoL, whether from items, skills, or what-have-you, is valid for this datatype.&lt;br /&gt;
&lt;br /&gt;
The full range, besides $effect[ none ], is too much to list and keep up with here: please see the Wiki {{kolwiki|Effects}} page for more information.&lt;br /&gt;
&lt;br /&gt;
===element===&lt;br /&gt;
&lt;br /&gt;
Besides $element[ none ], there are six possible values for this datatype. (Note that &amp;quot;Bad Spelling&amp;quot; is not considered a true element.)&lt;br /&gt;
Also note that these names are case-sensitive (referencing $element[ Spooky ] will generate an error).&lt;br /&gt;
&lt;br /&gt;
* cold&lt;br /&gt;
* hot&lt;br /&gt;
* sleaze&lt;br /&gt;
* spooky&lt;br /&gt;
* stench&lt;br /&gt;
* slime&lt;br /&gt;
&lt;br /&gt;
===familiar===&lt;br /&gt;
&lt;br /&gt;
Any familiar available in KoL is valid for this datatype.&lt;br /&gt;
&lt;br /&gt;
The full range, besides $familiar[ none ], is too much to list and keep up with here: please see the Wiki {{kolwiki|Familiars}} page for more information.&lt;br /&gt;
&lt;br /&gt;
===item===&lt;br /&gt;
&lt;br /&gt;
Any item in all of KoL is valid for this datatype. Note that unlike most special datatypes, item references can make use of the item ID number.&lt;br /&gt;
{{CodeSample|&lt;br /&gt;
description=For example, you could assign the item plexiglass pants as follows:|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
item it = $item[ 1234 ];&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
The full range, besides $item[ none ], is too much to list and keep up with here: please see the Wiki {{kolwiki|Items}} page for more information.&lt;br /&gt;
&lt;br /&gt;
===location===&lt;br /&gt;
&lt;br /&gt;
Any location one can adventure at in KoL is valid for this datatype.&lt;br /&gt;
&lt;br /&gt;
The full range, besides $location[ none ], is too much to list and keep up with here: please see the Wiki {{kolwiki|Locations}} page for more information.&lt;br /&gt;
&lt;br /&gt;
===monster===&lt;br /&gt;
&lt;br /&gt;
Any monster you can encounter in KoL is valid for this datatype.&lt;br /&gt;
&lt;br /&gt;
The full range, besides $monster[ none ], is too much to list and keep up with here: please see the Wiki {{kolwiki|Monster Compendium}} page for more information.&lt;br /&gt;
&lt;br /&gt;
===skill===&lt;br /&gt;
Any skill you can have in KoL (whether permable or not, granted by items, etc.) is valid for this datatype.&lt;br /&gt;
&lt;br /&gt;
The full range, besides $skill[ none ], is too much to list and keep up with here: please see the Wiki {{kolwiki|Skills}} page for more information.&lt;br /&gt;
&lt;br /&gt;
===slot===&lt;br /&gt;
&lt;br /&gt;
Besides $slot[ none ], there are 13 possible values for this datatype.&lt;br /&gt;
&lt;br /&gt;
* hat&lt;br /&gt;
* weapon&lt;br /&gt;
* off-hand&lt;br /&gt;
* shirt&lt;br /&gt;
* pants&lt;br /&gt;
* acc1&lt;br /&gt;
* acc2&lt;br /&gt;
* acc3&lt;br /&gt;
* familiar&lt;br /&gt;
* sticker1&lt;br /&gt;
* sticker2&lt;br /&gt;
* sticker3&lt;br /&gt;
* fakehand&lt;br /&gt;
&lt;br /&gt;
===stat===&lt;br /&gt;
&lt;br /&gt;
Besides $stat[ none ], there are six possible values for this datatype (the last three are for referencing sub-stats).&lt;br /&gt;
&lt;br /&gt;
* muscle&lt;br /&gt;
* mysticality&lt;br /&gt;
* moxie&lt;br /&gt;
* submuscle&lt;br /&gt;
* submysticality&lt;br /&gt;
* submoxie&lt;br /&gt;
&lt;br /&gt;
==aggregate==&lt;br /&gt;
&lt;br /&gt;
An aggregate is a complex datatype composed of two or more primitive or special datatypes. For more information, see [[Data Structures]].&lt;br /&gt;
&lt;br /&gt;
==record==&lt;br /&gt;
&lt;br /&gt;
Records are user-defined datatypes that hold as many sub-datatypes as desired. For more information, see the page for [[Data Structures]].&lt;br /&gt;
&lt;br /&gt;
==Plural Typed Constants==&lt;br /&gt;
&lt;br /&gt;
(see http://kolmafia.us/showthread.php?p=15592, from which this section is reproduced)&lt;br /&gt;
&lt;br /&gt;
Plural typed constants allow you to easily do something with a list of specified objects, without having to replicate code or laboriously build up an array of the objects so that you can iterate over it. Here&#039;s a quick example:&lt;br /&gt;
{{CodeSample|code=&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
foreach weapon in $items[star sword, star staff, star crossbow] {&lt;br /&gt;
   if (available_amount(weapon) &amp;gt; 0) {&lt;br /&gt;
      equip(weapon);&lt;br /&gt;
      break;&lt;br /&gt;
   }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
The syntax is basically the same as the existing typed constant feature, but with an &amp;quot;s&amp;quot; or &amp;quot;es&amp;quot; after the type name. (The &amp;quot;es&amp;quot; case is there so that you can properly pluralize &amp;quot;class&amp;quot;.) The text between the square brackets is interpreted as a comma-separated list of elements, each of which is converted to the specified type as if it were an individual constant. More details:&lt;br /&gt;
* The list can span multiple lines.&lt;br /&gt;
* Whitespace before or after elements is ignored.&lt;br /&gt;
* Completely empty elements are ignored (so that you can leave a comma at the end of the list).&lt;br /&gt;
* You can include a comma or closing square bracket in an element by writing it as &amp;quot;\,&amp;quot; or &amp;quot;\]&amp;quot;.&lt;br /&gt;
* All the other escape sequences allowed in strings are possible, such as &amp;quot;\n&amp;quot; (newline), &amp;quot;\t&amp;quot; (tab), and &amp;quot;\uXXXX&amp;quot; (Unicode character value). To put an actual backslash in an element, you have to write it as &amp;quot;\\&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The value generated by a plural constant is of type boolean[type], with the keys being the specified elements, and the boolean value always being true - although you won&#039;t normally do anything with the boolean, you&#039;d use a foreach loop to iterate over the keys. You can assign a plural constant to a variable declared as that type, but note that the value differs from a normal map in three important respects:&lt;br /&gt;
* Since the expression that generates it is syntactically a constant, the value has to be immutable. If you were allowed to change it in any way, those changes would appear in every future use of the same constant.&lt;br /&gt;
* There can be multiple instances of the same key - $ints[1,1,2,3,5,8] is perfectly valid, and will result in the value 1 appearing twice in a foreach loop.&lt;br /&gt;
* The keys will appear in the order you wrote them, rather than being sorted alphanumerically as maps usually do.&lt;br /&gt;
&lt;br /&gt;
In addition to being used in a foreach loop, plural constants also efficiently support membership testing via the &#039;contains&#039; operator. Here&#039;s another example:&lt;br /&gt;
{{CodeSample|code=&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
for hour from 1 to 12 {&lt;br /&gt;
   print(&amp;quot;It&#039;s &amp;quot; + hour + &amp;quot; o&#039;clock.&amp;quot;);&lt;br /&gt;
   if ($ints[10, 2, 4] contains hour) {&lt;br /&gt;
      print(&amp;quot;Time to drink a Dr Pepper!&amp;quot;);&lt;br /&gt;
   }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
(Yes, that example could just as easily have been done with a switch statement.)&lt;br /&gt;
&lt;br /&gt;
Iterating over an empty list is rather pointless, so plural constants with no elements are given a different meaning: they represent every value of the specified type, where this is practical. (The &#039;none&#039; value, if defined for a given type, is omitted.) The biggest benefit here is $items[], which lets you loop over every defined item, more efficiently than you could otherwise write in a script (since the list is generated once per session and then cached), and without having to hard-code a maximum item ID number in your script. Example:&lt;br /&gt;
{{CodeSample|code=&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
foreach it in $items[] {&lt;br /&gt;
   if (autosell_price(it) == 42) print(it);&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
Enumeration of all possible values works with the following types:&lt;br /&gt;
* $booleans[] - false and true.&lt;br /&gt;
* $items[]&lt;br /&gt;
* $locations[]&lt;br /&gt;
* $classes[]&lt;br /&gt;
* $stats[] - Muscle, Mysticality, Moxie: the substat values are omitted.&lt;br /&gt;
* $skills[]&lt;br /&gt;
* $effects[]&lt;br /&gt;
* $familiars[]&lt;br /&gt;
* $slots[] - includes sticker slots and fake hands, which you might not want to consider as normal slots.&lt;br /&gt;
* $monsters[]&lt;br /&gt;
* $elements[] - includes slime now, and possibly other not-quite-elements like cute in the future.&lt;br /&gt;
&lt;br /&gt;
The remaining types that can be used in plural constants require an explicit list of elements, since there are too many possible values:&lt;br /&gt;
* $ints[] - you don&#039;t have enough RAM to store a list with 4 billion elements.&lt;br /&gt;
* $floats[] - ditto.&lt;br /&gt;
* $strings[] - nobody has that much RAM.&lt;br /&gt;
&lt;br /&gt;
==Custom==&lt;br /&gt;
&lt;br /&gt;
===matcher===&lt;br /&gt;
&lt;br /&gt;
A matcher isn&#039;t really a datatype so much as it&#039;s a class, but it is included here for reference, as it is used much as datatypes are in ASH. It can only be declared through the function {{f|create_matcher}}, using two strings. One is the string to find matches in, the other a regular expression to test against. For more information on using a matcher, see [[Regular Expressions]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Data_Types&amp;diff=6788</id>
		<title>Data Types</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Data_Types&amp;diff=6788"/>
		<updated>2011-02-17T16:28:48Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: /* Primitive Datatypes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOCright}}&lt;br /&gt;
==Primitive Datatypes==&lt;br /&gt;
&lt;br /&gt;
===void===&lt;br /&gt;
Can be thought of better as the absence of a datatype. No value can be assigned to &#039;&#039;&#039;void&#039;&#039;&#039; nor can a value be returned from a function of datatype &#039;&#039;&#039;void&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===boolean===&lt;br /&gt;
A boolean value is either &#039;&#039;&#039;true&#039;&#039;&#039; or &#039;&#039;&#039;false&#039;&#039;&#039;. By default, a boolean variable is set to false.&lt;br /&gt;
&lt;br /&gt;
===int===&lt;br /&gt;
&lt;br /&gt;
A whole number (short for &amp;quot;integer&amp;quot;), either positive or negative (or 0).  The int used by KoLmafia is a 32-bit signed int, meaning it has a maximum value of 2,147,483,647 and a minimum value of -2,147,483,648. The default value of a integer variable is 0.&lt;br /&gt;
&lt;br /&gt;
Be careful when doing math with integers! As with some other strongly-typed languages, numbers are converted to integers at every step of the operation when only integer types are used. For example:&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
int a = 1;&lt;br /&gt;
int b = 2;&lt;br /&gt;
print( a / b * 2 );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
Will give the output &amp;quot;0,&amp;quot; not &amp;quot;1&amp;quot; as you may expect. Changing either variable to a float type will &amp;quot;correct&amp;quot; this.&lt;br /&gt;
&lt;br /&gt;
===float===&lt;br /&gt;
&lt;br /&gt;
The float data type is a single-precision 32-bit IEEE 754 floating point. Its range of values is beyond the scope of this discussion, but is specified in section 4.2.3 of the Java Language Specification. [http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.2.3]&lt;br /&gt;
&lt;br /&gt;
When assigning to a variable of type float, one should be careful to always enter numbers in decimal form, as unwanted behavior can result from supplying a value that KoLmafia may interpret as an int type without the decimal point.&lt;br /&gt;
&lt;br /&gt;
Note that float is not infinitely precise; it intrinsically rounds off after a certain point. This loss of accuracy is for the sake of storage, but beware of the possibility of small errors compounding from multiple float types.&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
description=For instance, try the following code as an example of how rather long post-decimal portions are handled:|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
float f;&lt;br /&gt;
f = 4.9999999;&lt;br /&gt;
print( f );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
The default value of a &amp;lt;code&amp;gt;float&amp;lt;/code&amp;gt; variable is 0.0.&lt;br /&gt;
&lt;br /&gt;
===string===&lt;br /&gt;
&lt;br /&gt;
A group of characters including, but not limited to: lowercase letters, uppercase characters, numbers, and various control characters. When assigning a value to a string, always enclose the desired value in either single or double quotes (note you must use the same quote type on both ends of the string assignment). If you need to include the same character inside of the string itself, you will need to escape it first with a backslash.{{CodeSample|&lt;br /&gt;
description=For example:|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
string s = &amp;quot;This is my \&amp;quot;friend\&amp;quot; Pete.&amp;quot;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;|&lt;br /&gt;
moreinfo=&lt;br /&gt;
Will result in the following being stored to s:&lt;br /&gt;
&amp;lt;pre&amp;gt;This is my &amp;quot;friend&amp;quot; Pete&amp;lt;/pre&amp;gt;}}&lt;br /&gt;
The default value of a string is an empty string, or literally &amp;lt;code&amp;gt;&amp;quot;&amp;quot;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===buffer===&lt;br /&gt;
&lt;br /&gt;
Similar to a string, but more efficient in certain operations, including concatenation and passing as function arguments. For the most part, you can interchange references to strings and buffers. However, you should test all such actions first, as a few functions require a specific datatype to be supplied as a parameter. (Most notably, those listed under [[String Handling Routines#Regular Expressions|Regular Expressions]].)&lt;br /&gt;
&lt;br /&gt;
==Special Datatypes==&lt;br /&gt;
&lt;br /&gt;
Several datatypes are included in KoLmafia to represent common categories within the KoL universe.&lt;br /&gt;
&lt;br /&gt;
Note that while variables of these types are declared in the same way as for Primitive Datatypes; assigning and referencing them is done differently.&lt;br /&gt;
{{CodeSample|&lt;br /&gt;
description=For example, to declare an item datatype and assign it a value, you would use the following line of code:|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
item it = $item[ broken skull ];&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
The default values of any variable of one of the following types is &amp;lt;code&amp;gt;$&#039;&#039;type&#039;&#039;[ none ]&amp;lt;/code&amp;gt;. For example, the default value of a &amp;lt;code&amp;gt;item&amp;lt;/code&amp;gt; variable is &amp;lt;code&amp;gt;$item[ none ]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===class===&lt;br /&gt;
&lt;br /&gt;
Besides $class[ none ], there are six possible values for this datatype:&lt;br /&gt;
&lt;br /&gt;
* Seal Clubber&lt;br /&gt;
* Turtle Tamer&lt;br /&gt;
* Pastamancer&lt;br /&gt;
* Sauceror&lt;br /&gt;
* Disco Bandit&lt;br /&gt;
* Accordion Thief &lt;br /&gt;
&lt;br /&gt;
===effect===&lt;br /&gt;
&lt;br /&gt;
Any effect you can be under in KoL, whether from items, skills, or what-have-you, is valid for this datatype.&lt;br /&gt;
&lt;br /&gt;
The full range, besides $effect[ none ], is too much to list and keep up with here: please see the Wiki {{kolwiki|Effects}} page for more information.&lt;br /&gt;
&lt;br /&gt;
===element===&lt;br /&gt;
&lt;br /&gt;
Besides $element[ none ], there are six possible values for this datatype. (Note that &amp;quot;Bad Spelling&amp;quot; is not considered a true element.)&lt;br /&gt;
Also note that these names are case-sensitive (referencing $element[ Spooky ] will generate an error).&lt;br /&gt;
&lt;br /&gt;
* cold&lt;br /&gt;
* hot&lt;br /&gt;
* sleaze&lt;br /&gt;
* spooky&lt;br /&gt;
* stench&lt;br /&gt;
* slime&lt;br /&gt;
&lt;br /&gt;
===familiar===&lt;br /&gt;
&lt;br /&gt;
Any familiar available in KoL is valid for this datatype.&lt;br /&gt;
&lt;br /&gt;
The full range, besides $familiar[ none ], is too much to list and keep up with here: please see the Wiki {{kolwiki|Familiars}} page for more information.&lt;br /&gt;
&lt;br /&gt;
===item===&lt;br /&gt;
&lt;br /&gt;
Any item in all of KoL is valid for this datatype. Note that unlike most special datatypes, item references can make use of the item ID number.&lt;br /&gt;
{{CodeSample|&lt;br /&gt;
description=For example, you could assign the item plexiglass pants as follows:|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
item it = $item[ 1234 ];&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
The full range, besides $item[ none ], is too much to list and keep up with here: please see the Wiki {{kolwiki|Items}} page for more information.&lt;br /&gt;
&lt;br /&gt;
===location===&lt;br /&gt;
&lt;br /&gt;
Any location one can adventure at in KoL is valid for this datatype.&lt;br /&gt;
&lt;br /&gt;
The full range, besides $location[ none ], is too much to list and keep up with here: please see the Wiki {{kolwiki|Locations}} page for more information.&lt;br /&gt;
&lt;br /&gt;
===monster===&lt;br /&gt;
&lt;br /&gt;
Any monster you can encounter in KoL is valid for this datatype.&lt;br /&gt;
&lt;br /&gt;
The full range, besides $monster[ none ], is too much to list and keep up with here: please see the Wiki {{kolwiki|Monster Compendium}} page for more information.&lt;br /&gt;
&lt;br /&gt;
===skill===&lt;br /&gt;
Any skill you can have in KoL (whether permable or not, granted by items, etc.) is valid for this datatype.&lt;br /&gt;
&lt;br /&gt;
The full range, besides $skill[ none ], is too much to list and keep up with here: please see the Wiki {{kolwiki|Skills}} page for more information.&lt;br /&gt;
&lt;br /&gt;
===slot===&lt;br /&gt;
&lt;br /&gt;
Besides $slot[ none ], there are 13 possible values for this datatype.&lt;br /&gt;
&lt;br /&gt;
* hat&lt;br /&gt;
* weapon&lt;br /&gt;
* off-hand&lt;br /&gt;
* shirt&lt;br /&gt;
* pants&lt;br /&gt;
* acc1&lt;br /&gt;
* acc2&lt;br /&gt;
* acc3&lt;br /&gt;
* familiar&lt;br /&gt;
* sticker1&lt;br /&gt;
* sticker2&lt;br /&gt;
* sticker3&lt;br /&gt;
* fakehand&lt;br /&gt;
&lt;br /&gt;
===stat===&lt;br /&gt;
&lt;br /&gt;
Besides $stat[ none ], there are six possible values for this datatype (the last three are for referencing sub-stats).&lt;br /&gt;
&lt;br /&gt;
* muscle&lt;br /&gt;
* mysticality&lt;br /&gt;
* moxie&lt;br /&gt;
* submuscle&lt;br /&gt;
* submysticality&lt;br /&gt;
* submoxie&lt;br /&gt;
&lt;br /&gt;
==aggregate==&lt;br /&gt;
&lt;br /&gt;
An aggregate is a complex datatype composed of two or more primitive or special datatypes. For more information, see [[Data Structures]].&lt;br /&gt;
&lt;br /&gt;
==record==&lt;br /&gt;
&lt;br /&gt;
Records are user-defined datatypes that hold as many sub-datatypes as desired. For more information, see the page for [[Data Structures]].&lt;br /&gt;
&lt;br /&gt;
==Plural Typed Constants==&lt;br /&gt;
&lt;br /&gt;
(see http://kolmafia.us/showthread.php?p=15592, from which this section is reproduced)&lt;br /&gt;
&lt;br /&gt;
Plural typed constants allow you to easily do something with a list of specified objects, without having to replicate code or laboriously build up an array of the objects so that you can iterate over it. Here&#039;s a quick example:&lt;br /&gt;
{{CodeSample|code=&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
foreach weapon in $items[star sword, star staff, star crossbow] {&lt;br /&gt;
   if (available_amount(weapon) &amp;gt; 0) {&lt;br /&gt;
      equip(weapon);&lt;br /&gt;
      break;&lt;br /&gt;
   }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
The syntax is basically the same as the existing typed constant feature, but with an &amp;quot;s&amp;quot; or &amp;quot;es&amp;quot; after the type name. (The &amp;quot;es&amp;quot; case is there so that you can properly pluralize &amp;quot;class&amp;quot;.) The text between the square brackets is interpreted as a comma-separated list of elements, each of which is converted to the specified type as if it were an individual constant. More details:&lt;br /&gt;
* The list can span multiple lines.&lt;br /&gt;
* Whitespace before or after elements is ignored.&lt;br /&gt;
* Completely empty elements are ignored (so that you can leave a comma at the end of the list).&lt;br /&gt;
* You can include a comma or closing square bracket in an element by writing it as &amp;quot;\,&amp;quot; or &amp;quot;\]&amp;quot;.&lt;br /&gt;
* All the other escape sequences allowed in strings are possible, such as &amp;quot;\n&amp;quot; (newline), &amp;quot;\t&amp;quot; (tab), and &amp;quot;\uXXXX&amp;quot; (Unicode character value). To put an actual backslash in an element, you have to write it as &amp;quot;\\&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The value generated by a plural constant is of type boolean[type], with the keys being the specified elements, and the boolean value always being true - although you won&#039;t normally do anything with the boolean, you&#039;d use a foreach loop to iterate over the keys. You can assign a plural constant to a variable declared as that type, but note that the value differs from a normal map in three important respects:&lt;br /&gt;
* Since the expression that generates it is syntactically a constant, the value has to be immutable. If you were allowed to change it in any way, those changes would appear in every future use of the same constant.&lt;br /&gt;
* There can be multiple instances of the same key - $ints[1,1,2,3,5,8] is perfectly valid, and will result in the value 1 appearing twice in a foreach loop.&lt;br /&gt;
* The keys will appear in the order you wrote them, rather than being sorted alphanumerically as maps usually do.&lt;br /&gt;
&lt;br /&gt;
In addition to being used in a foreach loop, plural constants also efficiently support membership testing via the &#039;contains&#039; operator. Here&#039;s another example:&lt;br /&gt;
{{CodeSample|code=&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
for hour from 1 to 12 {&lt;br /&gt;
   print(&amp;quot;It&#039;s &amp;quot; + hour + &amp;quot; o&#039;clock.&amp;quot;);&lt;br /&gt;
   if ($ints[10, 2, 4] contains hour) {&lt;br /&gt;
      print(&amp;quot;Time to drink a Dr Pepper!&amp;quot;);&lt;br /&gt;
   }&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
(Yes, that example could just as easily have been done with a switch statement.)&lt;br /&gt;
&lt;br /&gt;
Iterating over an empty list is rather pointless, so plural constants with no elements are given a different meaning: they represent every value of the specified type, where this is practical. (The &#039;none&#039; value, if defined for a given type, is omitted.) The biggest benefit here is $items[], which lets you loop over every defined item, more efficiently than you could otherwise write in a script (since the list is generated once per session and then cached), and without having to hard-code a maximum item ID number in your script. Example:&lt;br /&gt;
{{CodeSample|code=&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
foreach it in $items[] {&lt;br /&gt;
   if (autosell_price(it) == 42) print(it);&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
Enumeration of all possible values works with the following types:&lt;br /&gt;
* $booleans[] - false and true.&lt;br /&gt;
* $items[]&lt;br /&gt;
* $locations[]&lt;br /&gt;
* $classes[]&lt;br /&gt;
* $stats[] - Muscle, Mysticality, Moxie: the substat values are omitted.&lt;br /&gt;
* $skills[]&lt;br /&gt;
* $effects[]&lt;br /&gt;
* $familiars[]&lt;br /&gt;
* $slots[] - includes sticker slots and fake hands, which you might not want to consider as normal slots.&lt;br /&gt;
* $monsters[]&lt;br /&gt;
* $elements[] - includes slime now, and possibly other not-quite-elements like cute in the future.&lt;br /&gt;
&lt;br /&gt;
The remaining types that can be used in plural constants require an explicit list of elements, since there are too many possible values:&lt;br /&gt;
* $ints[] - you don&#039;t have enough RAM to store a list with 4 billion elements.&lt;br /&gt;
* $floats[] - ditto.&lt;br /&gt;
* $strings[] - nobody has that much RAM.&lt;br /&gt;
&lt;br /&gt;
==Custom==&lt;br /&gt;
&lt;br /&gt;
===matcher===&lt;br /&gt;
&lt;br /&gt;
A matcher isn&#039;t really a datatype so much as it&#039;s a class, but it is included here for reference, as it is used much as datatypes are in ASH. It can only be declared through the function {{f|create_matcher}}, using two strings. One is the string to find matches in, the other a regular expression to test against. For more information on using a matcher, see [[Regular Expressions]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Monster_hp&amp;diff=5294</id>
		<title>Monster hp</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Monster_hp&amp;diff=5294"/>
		<updated>2011-02-10T20:34:26Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{&lt;br /&gt;
#vardefine:name|monster_hp}}{{&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;
}}|&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|monster|check_me}}|&lt;br /&gt;
p1desc={{Pspan|check_me}} is the (optional) monster to get the HP of|&lt;br /&gt;
}}|&lt;br /&gt;
function_description=Returns the HP of the specified monster {{pspan|check_me}}. If {{pspan|check_me}} is not specified, it will return the HP of the current monster if you are in a fight (i.e. you&#039;re calling the function from an [[In-combat Consulting]] script), or the HP of the last monster you encountered otherwise.  If you are in a fight, this will return the monster&#039;s current HP to the best of KoLmafia&#039;s knowledge.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;The return value includes monster level modifications.  This means that for monsters with unknown HP, the return value will initially be equivalent to monster_level_adjustment().|&lt;br /&gt;
&lt;br /&gt;
needscode=yes|&lt;br /&gt;
&lt;br /&gt;
see_also={{SeeAlso|monster_attack|monster_defense|monster_element}}|&lt;br /&gt;
more_info=For the current discussion of what&#039;s being tracked in-combat for monster level adjustments, please see [http://kolmafia.us/showthread.php?3452 this thread].|&lt;br /&gt;
special=If no monster is specified and no monster has been fought in this session, this function returns 0. This is because mafia forgets the value of [[last_monster|last_monster()]] when it logs out.|&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Adventuring]][[Category:In-combat Consulting]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Tavern&amp;diff=5186</id>
		<title>Tavern</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Tavern&amp;diff=5186"/>
		<updated>2011-02-09T20:25:57Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{&lt;br /&gt;
#vardefine:name|tavern}}{{&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;
}}|&lt;br /&gt;
&lt;br /&gt;
function_description=Attempts to complete the level 3 tavern quest, stopping when it finds the rat faucet. Returns the number of squares visited. &lt;br /&gt;
*It will stop before actually turning off the faucet.&lt;br /&gt;
*If the quest was already completed, it will return the number of explored squares.&lt;br /&gt;
*If you run out of turns, it will return the number of explored squares.&lt;br /&gt;
&amp;amp;nbsp;|&lt;br /&gt;
&lt;br /&gt;
code1={{CodeSample|&lt;br /&gt;
title=Code Sample|&lt;br /&gt;
description=Solve the Typical Tavern.|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if(get_property(&amp;quot;lastTavernAscension&amp;quot;).to_int() == my_ascensions()) {&lt;br /&gt;
   print(&amp;quot;You&#039;ve already turned off the Rat Faucet!&amp;quot;);&lt;br /&gt;
} else {&lt;br /&gt;
   int turns = tavern();&lt;br /&gt;
   if(get_property(&amp;quot;tavernLayout&amp;quot;).contains_text(&amp;quot;3&amp;quot;)) {&lt;br /&gt;
      print(&amp;quot;Found the Rat Faucet in &amp;quot;+ turns+ &amp;quot; adventures.&amp;quot;);&lt;br /&gt;
      if(available_amount($item[Baron von Ratsworth&#039;s monocle]) == 0&lt;br /&gt;
       &amp;amp;&amp;amp; available_amount($item[Baron von Ratsworth&#039;s money clip]) == 0&lt;br /&gt;
       &amp;amp;&amp;amp; available_amount($item[Baron von Ratsworth&#039;s tophat]) == 0&lt;br /&gt;
       &amp;amp;&amp;amp; user_confirm(&amp;quot;Do you want to fight Baron Von Ratsworth?&amp;quot;)) {&lt;br /&gt;
        print(&amp;quot;You&#039;ll have to do the next bit yourself. Sorry.&amp;quot;, &amp;quot;red&amp;quot;);&lt;br /&gt;
      } else {&lt;br /&gt;
        visit_url(&amp;quot;rats.php?action=faucetoff&amp;quot;);&lt;br /&gt;
      }&lt;br /&gt;
   } else print(&amp;quot;Spent &amp;quot;+ turns+ &amp;quot; adventures searching, but did not find the rat faucet.&amp;quot;, &amp;quot;red&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
see_also={{SeeAlso|chamber|entryway|guardians|hedgemaze}}|&lt;br /&gt;
cli_equiv=The CLI command &amp;quot;tavern&amp;quot; functions similarly.|&lt;br /&gt;
more_info= |&lt;br /&gt;
special=The function will not turn off the faucet, and will not attempt to find and / or fight the baron.|&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Adventuring]]&lt;br /&gt;
{{RFI|Has this been updated to account for the new behavior?}}&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Category_talk:Tech_Support&amp;diff=7402</id>
		<title>Category talk:Tech Support</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Category_talk:Tech_Support&amp;diff=7402"/>
		<updated>2011-02-02T21:21:47Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We should brainstorm on how we want this category organized and what should be added. I&#039;m looking into getting into editing / reviewing the source myself, and I&#039;d love clearer help. ;) --[[User:StDoodle|StDoodle (#1059825)]] 22:17, 21 January 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
Well I suppose it would be awesome if there was a quicky guide to how the KoLmafia source was organized and rundown of the most important segments, like RequestEditorKit. I&#039;m getting the hang of it, but finding stuff is my biggest problem with delving into the code. --[[User:Bale|Bale]] 00:18, 27 January 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
We should probably get two categories (or sub categories) for out-of-the-box mafia tech support (installation, dropbox, etc) and one for &amp;quot;dealing with the source code&amp;quot; if that makes sense. --[[User:StDoodle|StDoodle (#1059825)]] 21:21, 2 February 2011 (UTC)&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=User_talk:Malurth&amp;diff=7392</id>
		<title>User talk:Malurth</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=User_talk:Malurth&amp;diff=7392"/>
		<updated>2011-02-01T18:54:22Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Welcome to this wiki and thank you for signing up to edit one of our entries. ^_^ --[[User:Bale|Bale]] 08:50, 1 January 2011 (UTC)&lt;br /&gt;
  &lt;br /&gt;
Oh hi Bale! You&#039;re like a celebrity to me, thanks for the welcome! I can&#039;t just leave a typo there... anyway I dunno if you&#039;ll even see this but I wanted to at least respond. :D --[[User:Malurth|Malurth]] 13:29, 1 January 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
Welcome to the wiki, and thanks for contributing! Don&#039;t hesitate to fix such things; a lot of these pages were written up in mad-dashes, and there are quite a few speeeling and grammer errors. ;) --[[User:StDoodle|StDoodle (#1059825)]] 18:56, 1 January 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Heh, you know, I&#039;ve looked at the hermit() page two or three times lately, thinking &amp;quot;I really ought to fix that.&amp;quot; Thanks! --[[User:StDoodle|StDoodle (#1059825)]] 18:54, 1 February 2011 (UTC)&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Adventuring&amp;diff=896</id>
		<title>Adventuring</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Adventuring&amp;diff=896"/>
		<updated>2011-01-31T18:39:13Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Flink|boolean|adventure|int|location|desc=Visits the desired location the the desired number of times.}}&lt;br /&gt;
{{Flink|boolean|adventure|int|location|string|desc=Visits the desired location a specified number of times, using a combat filter function defined elsewhere in your script.}}&lt;br /&gt;
{{Flink|boolean|adv1|location|int|string|desc=Adventure exactly once in the specified location (even if it uses no turns). Chained choice adventures &#039;&#039;&#039;are&#039;&#039;&#039; followed. Int overrides default settings, and string is a filter, same as in [[adventure|adventure()]]}}&lt;br /&gt;
{{Flink|string|visit_url|string|desc=Visits the specified address and returns the page source.}}&lt;br /&gt;
{{Flink|void|add_item_condition|int|item|desc=Specifies adventuring conditions. With these in place, [[adventure|adventure()]] will successfully complete once the conditions are met.}}&lt;br /&gt;
{{Flink|boolean|is_goal|item|desc=Checks if a given item is a goal.}}&lt;br /&gt;
{{Flink|string|get_counters|string|int|int|desc=Determine if a counter will expire in a specified&lt;br /&gt;
period of time.}}&lt;br /&gt;
{{Flink|void|council|desc=Visits the Council of Loathing.}}&lt;br /&gt;
{{Flink|item|guardians|desc=Climbs the Naughty Sorceress&#039; Tower and passes the challenges it can, returning the first item needed to pass a failed stage.}}&lt;br /&gt;
{{Flink|int|tavern|desc=Attempt to complete the tavern, and returns the number of squares visited}}&lt;br /&gt;
{{Flink|boolean|entryway}}&lt;br /&gt;
{{Flink|boolean|hedgemaze}}&lt;br /&gt;
{{Flink|boolean|chamber|desc=These three functions attempt to perform the associated tasks. The return value indicates the success.}}&lt;br /&gt;
{{Flink|location|my_location|desc=Returns the location where you last adventured.}}&lt;br /&gt;
{{Flink|void|set_location|location|desc=Changes the value returned by my_location().}}&lt;br /&gt;
{{Flink|void|refresh_status|desc=Refreshes the side-pane character info (health, effects, etc.).}}&lt;br /&gt;
{{Flink|buffer|run_combat|desc=Uses the current KoLmafia settings to run a combat (for use with [[visit_url|visit_url()]]).}}&lt;br /&gt;
{{Flink|boolean|retrieve_item|int|item|desc=Uses KoLmafia internal logic to gather items.}}&lt;br /&gt;
{{Flink|boolean|change_mcd|int|desc=Tries to set your +ML device to a specified setting and reports on success.}}&lt;br /&gt;
{{Flink|boolean|hermit|int|item|desc=Trades worthless items (adventuring in the sewer if needed) to the hermit for specified items.}}&lt;br /&gt;
&lt;br /&gt;
==About Monsters==&lt;br /&gt;
For all of the below functions that accept an optional monster parameter, the default value is your most recently-encountered monster (that means your current monster if you&#039;re in combat).&lt;br /&gt;
&lt;br /&gt;
{{Flink|monster|last_monster|desc=Returns last monster encountered.}}&lt;br /&gt;
{{Flink|monster [int]|get_monsters|location|desc=Returns a map of potential monsters at a given location.}}&lt;br /&gt;
{{Flink|float [monster]|appearance_rates|location|desc=Returns a map of the expected frequency of each monster at the specified location under normal conditions.}}&lt;br /&gt;
{{Flink|int|monster_attack|{{opt|monster}}|desc=Returns the starting/current attack value of the specified monster.}}&lt;br /&gt;
{{Flink|int|monster_defense|{{opt|monster}}|desc=Returns the starting/current defense value of the specified monster.}}&lt;br /&gt;
{{Flink|int|monster_hp|{{opt|monster}}|desc=Returns the starting/current HP of the specified monster.}}&lt;br /&gt;
{{Flink|int|expected_damage|{{opt|monster}}|desc=Returns the amount of damage you are expected to take each round from the specified monster.}}&lt;br /&gt;
{{Flink|element|monster_element|{{opt|monster}}|desc=Returns the elemental alignment of the specified monster.}}&lt;br /&gt;
&lt;br /&gt;
==Misc.==&lt;br /&gt;
{{Flink|int|get_auto_attack|desc=Returns your current auto-attack setting.}}&lt;br /&gt;
{{Flink|void|set_auto_attack|int|desc=Sets your auto-attack setting.}}&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Get_auto_attack&amp;diff=7417</id>
		<title>Get auto attack</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Get_auto_attack&amp;diff=7417"/>
		<updated>2011-01-31T18:35:53Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: Created page with &amp;#039;{{ #vardefine:name|get_auto_attack}}{{ #vardefine:return_type|int}}{{  FunctionPage| name={{#var:name}}|  function1={{Function| name={{#var:name}}| return_type={{#var:return_type…&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{&lt;br /&gt;
#vardefine:name|get_auto_attack}}{{&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;
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 your auto-attack as an integer code. Possible values are 0 for disabled, 1 for attack with weapon, a [http://kol.coldfront.net/thekolwiki/index.php/Skills_by_number skillID] number, or a macroID number preceeded by 99.|&lt;br /&gt;
&lt;br /&gt;
needscode=yes|&lt;br /&gt;
see_also={{SeeAlso|set_auto_attack}}|&lt;br /&gt;
cli_equiv=The CLI command &amp;quot;autoattack&amp;quot; does not appear to have reporting capability.|&lt;br /&gt;
}}&lt;br /&gt;
{{RFI|In r8981, the CLI command w/o parameters caused a debug log. Update cli_equip and ask questions similar to set_auto_attack() when fixed.}}&lt;br /&gt;
[[Category:Adventuring]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Set_auto_attack&amp;diff=7415</id>
		<title>Set auto attack</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Set_auto_attack&amp;diff=7415"/>
		<updated>2011-01-31T18:32:20Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: argh, remove adventure()&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{&lt;br /&gt;
#vardefine:name|set_auto_attack}}{{&lt;br /&gt;
#vardefine:return_type|void}}{{&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;
return_type={{#var:return_type}}|&lt;br /&gt;
return_also={{#var:return_also}}|&lt;br /&gt;
parameter1={{Param|int|setting}}|&lt;br /&gt;
p1desc={{Pspan|setting}} is the KoL attack code|&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
function_description=Sets your auto-attack. Possible values for {{pspan|setting}} are 0 for disabled, 1 for attack with weapon, a [http://kol.coldfront.net/thekolwiki/index.php/Skills_by_number skillID] number, or a macroID number preceeded by 99.|&lt;br /&gt;
&lt;br /&gt;
needscode=yes|&lt;br /&gt;
see_also={{SeeAlso|get_auto_attack}}|&lt;br /&gt;
cli_equiv=The CLI command &amp;quot;autoattack&amp;quot; functions similarly.|&lt;br /&gt;
}}&lt;br /&gt;
{{RFI|Does the CLI command allow macro setting?}}&lt;br /&gt;
[[Category:Adventuring]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Set_auto_attack&amp;diff=7414</id>
		<title>Set auto attack</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Set_auto_attack&amp;diff=7414"/>
		<updated>2011-01-31T18:31:52Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{&lt;br /&gt;
#vardefine:name|set_auto_attack}}{{&lt;br /&gt;
#vardefine:return_type|void}}{{&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;
return_type={{#var:return_type}}|&lt;br /&gt;
return_also={{#var:return_also}}|&lt;br /&gt;
parameter1={{Param|int|setting}}|&lt;br /&gt;
p1desc={{Pspan|setting}} is the KoL attack code|&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
function_description=Sets your auto-attack. Possible values for {{pspan|setting}} are 0 for disabled, 1 for attack with weapon, a [http://kol.coldfront.net/thekolwiki/index.php/Skills_by_number skillID] number, or a macroID number preceeded by 99.|&lt;br /&gt;
&lt;br /&gt;
needscode=yes|&lt;br /&gt;
see_also={{SeeAlso|adventure|get_auto_attack}}|&lt;br /&gt;
cli_equiv=The CLI command &amp;quot;autoattack&amp;quot; functions similarly.|&lt;br /&gt;
}}&lt;br /&gt;
{{RFI|Does the CLI command allow macro setting?}}&lt;br /&gt;
[[Category:Adventuring]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Set_auto_attack&amp;diff=7413</id>
		<title>Set auto attack</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Set_auto_attack&amp;diff=7413"/>
		<updated>2011-01-31T18:30:30Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: Created page with &amp;#039;{{ #vardefine:name|set_auto_attack}}{{ #vardefine:return_type|void}}{{  FunctionPage| name={{#var:name}}|  function1={{Function| name={{#var:name}}| return_type={{#var:return_typ…&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{&lt;br /&gt;
#vardefine:name|set_auto_attack}}{{&lt;br /&gt;
#vardefine:return_type|void}}{{&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;
return_type={{#var:return_type}}|&lt;br /&gt;
return_also={{#var:return_also}}|&lt;br /&gt;
parameter1={{Param|int|setting}}|&lt;br /&gt;
p1desc={{Pspan|setting}} is the KoL attack code|&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
function_description=Sets your auto-attack. Possible values for {{pspan|setting}} are 0 for disabled, 1 for attack with weapon, a [http://kol.coldfront.net/thekolwiki/index.php/Skills_by_number skillID] number, or a macroID number preceeded by 99.|&lt;br /&gt;
&lt;br /&gt;
needscode=yes|&lt;br /&gt;
see_also={{SeeAlso|adventure|get_auto_attack}}|&lt;br /&gt;
cli_equiv=The CLI command &amp;quot;autoattack&amp;quot; functions similarly.|&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Adventuring]]&lt;br /&gt;
&lt;br /&gt;
{{RFI|Does the CLI command allow macro setting?}}&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Set_location&amp;diff=6445</id>
		<title>Set location</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Set_location&amp;diff=6445"/>
		<updated>2011-01-31T18:25:40Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: parameter added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{&lt;br /&gt;
#vardefine:name|set_location}}{{&lt;br /&gt;
#vardefine:return_type|void}}{{&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;
return_type={{#var:return_type}}|&lt;br /&gt;
return_also={{#var:return_also}}|&lt;br /&gt;
parameter1={{Param|location|place}}|&lt;br /&gt;
p1desc={{Pspan|place}} is the new location|&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
function_description=Changes the value returned by {{f|my_location}} to {{pspan|place}}. This is significant because it allows scripts which check current adventuring location to provide results based on the location that you are &#039;&#039;about to&#039;&#039; adventure at.|&lt;br /&gt;
&lt;br /&gt;
needscode=yes|&lt;br /&gt;
see_also={{SeeAlso|adventure|my_location}}|&lt;br /&gt;
cli_equiv=The CLI command &amp;quot;locations&amp;quot; will list all locations adventured at during your current session, along with adventures spent at each.|&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Adventuring]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Maximize&amp;diff=7210</id>
		<title>Maximize</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Maximize&amp;diff=7210"/>
		<updated>2011-01-28T16:48:01Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{&lt;br /&gt;
#vardefine:name|maximize}}{{&lt;br /&gt;
#vardefine:return_type|boolean}}{{&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|string|expression}}|&lt;br /&gt;
parameter2={{Param|string|simulate}}|&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|string|expression}}|&lt;br /&gt;
parameter2={{Param|int|max_price}}|&lt;br /&gt;
parameter3={{Param|int|price_level}}|&lt;br /&gt;
parameter4={{Param|string|simulate}}|&lt;br /&gt;
p1desc={{Pspan|expression}} is the list of modifiers to maximize for.|&lt;br /&gt;
p2desc={{Pspan|max_price}} limits how much meat will be spent on maximization.|&lt;br /&gt;
p3desc={{Pspan|price_level}} controls checking the mall and affects return value.|&lt;br /&gt;
p4desc={{Pspan|simulate}} will not equip gear if false.|&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
function_description=This command will run the [[modifier maximizer]] and return true if successful. If a minimum is applied to a modifier and that minimum could not be accomplished (such as 4 clownosity) then it will return false.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;This function will set _spec so that it can be checked with {{f|numeric_modifier}}. That is the main purpose of using a true value for {{Pspan|simulate}}.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;If {{Pspan|max_price}} is &amp;lt;= 0, it will use the preference autoBuyPriceLimit, or available meat, whichever is lower. Otherwise, that&#039;s the value it&#039;s considering as the max value for new items.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
If {{Pspan|price_level}} is greater than 0, Mall price is considered. If {{Pspan|price_level}} is 2, always consider mall price. If {{Pspan|price_level}} is 1, only consider it if there isn&#039;t another way.&lt;br /&gt;
Also, if {{Pspan|price_level}} is 0 or less, validateItem always returns true.|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
needscode=yes|&lt;br /&gt;
&lt;br /&gt;
cli_equiv=The CLI command command &amp;quot;maximize&amp;quot; will automatically change equipment as if the final parameter was false.|&lt;br /&gt;
more_info=See the page on the [[Modifier Maximizer]] for more information on how to use this, especially to create a meaningful expression.|&lt;br /&gt;
}}&lt;br /&gt;
{{RFI|What exactly is validateItem? What does it mean to us?}}&lt;br /&gt;
[[Category:Equipment]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Operators&amp;diff=1888</id>
		<title>Operators</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Operators&amp;diff=1888"/>
		<updated>2011-01-26T16:54:38Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: /* Operator Precedence */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOCright}}&lt;br /&gt;
==Mathematical Operators==&lt;br /&gt;
&lt;br /&gt;
The following mathematical operators are used in KoLmafia:&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| + |Addition|Performs addition and string concatenation}}}}&lt;br /&gt;
{{eztr|{{eztd| - |Subtraction|Performs subtraction}}}}&lt;br /&gt;
{{eztr|{{eztd| * |Multiplication|Performs multiplication}}}}&lt;br /&gt;
{{eztr|{{eztd| / |Division|Performs division}}}}&lt;br /&gt;
{{eztr|{{eztd| % |Modulo|Returns the remainder after division}}}}&lt;br /&gt;
{{eztr|{{eztd| ** |Exponent|Performs exponentiation}}}}&lt;br /&gt;
}}&lt;br /&gt;
Note that, with the exception of using &amp;lt;nowiki&amp;gt;&amp;quot;+&amp;quot;&amp;lt;/nowiki&amp;gt; for string concatenation, these operators can only be used on int or float datatypes.&lt;br /&gt;
&lt;br /&gt;
==Bitwise Operators==&lt;br /&gt;
&lt;br /&gt;
The following mathematical operators are used for operating on the bits of integers. The operands must be integers; no coercion is allowed:&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;lt;/nowiki&amp;gt; |and|a &amp;amp; b}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; |or|a &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; b}}}}&lt;br /&gt;
{{eztr|{{eztd| ~ |not|~a}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;&amp;lt; |left shift|a &amp;lt;&amp;lt; b}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;gt;&amp;gt; |right shift|a &amp;gt;&amp;gt; b}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;amp;=&amp;lt;/nowiki&amp;gt; |and|&amp;lt;nowiki&amp;gt;a &amp;amp;= b --&amp;gt; a = a &amp;amp; b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;|=&amp;lt;/nowiki&amp;gt; |or|&amp;lt;nowiki&amp;gt;a |= b --&amp;gt; a = a | b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;gt;&amp;gt;&amp;gt; |unsigned right shift|a &amp;gt;&amp;gt;&amp;gt; b}}}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Assignment Operators==&lt;br /&gt;
The following assignment operators are used in KoLmafia (let a = left operand, b = right operand):&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;+=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a + b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;-=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a - b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;*=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a * b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;/=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a / b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;%=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a % b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;**=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a ** b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a &amp;gt;&amp;gt; b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a &amp;gt;&amp;gt;&amp;gt; b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
}}&lt;br /&gt;
Of these, only += and = are usable for strings.  See [[Operators#Mathematical Operators|Mathematical Operators]] for information regarding the basic Mathematical Operators.&lt;br /&gt;
&lt;br /&gt;
==Relational Operators==&lt;br /&gt;
&lt;br /&gt;
To follow these examples, a basic understanding of the concepts found on [[Control Structures]] would be helpful.&lt;br /&gt;
&lt;br /&gt;
In order to create more complex if statements, we need to understand the basic relational operators:&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;==&amp;lt;/nowiki&amp;gt; |equal to}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;!=&amp;lt;/nowiki&amp;gt; |not equal to}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;lt;&amp;lt;/nowiki&amp;gt; |less than}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;&amp;lt;/nowiki&amp;gt; |greater than}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;lt;=&amp;lt;/nowiki&amp;gt; |less than or equal to}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; |greater than or equal to}}}}&lt;br /&gt;
}}&lt;br /&gt;
Note that you cannot mix datatypes within a comparison or KoLmafia will abort with an error, with the exception of mixing types int and float, where KoLmafia will do a transparent type conversion behind-the-scenes. If you need to compare different datatypes, use one or more of the [[Datatype Conversions|Datatype Conversion]] functions. Also, == is case-insensitive with respect to strings.&lt;br /&gt;
&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if ( true == true )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( true == false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( 1 == 1.0 )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( 1 == 2 )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( &amp;quot;Hello&amp;quot; == &amp;quot;hello&amp;quot; )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
==Boolean Operators==&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;amp;&amp;lt;/nowiki&amp;gt; |and}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt; |or}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;!&amp;lt;/nowiki&amp;gt; |not}}}}&lt;br /&gt;
}}&lt;br /&gt;
Note that the above operators only work with boolean values &amp;amp; datatypes. To make use of them with other datatypes, you will either need to first perform a [[Datatype Conversions|Datatype Conversion]], or you will need to nest your operations such that a boolean value is used with the boolean operators.&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if ( true &amp;amp;&amp;amp; true )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed (both possibilities proved true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( true &amp;amp;&amp;amp; false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed (only one possibility proved true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( true || false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed (since at least one of the possibilities proved true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( ! false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed (since the not operator converted false to true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==Operator Precedence==&lt;br /&gt;
&lt;br /&gt;
KoLmafia follows [http://download.oracle.com/javase/tutorial/java/nutsandbolts/operators.html Java&#039;s Operator Precedence rules] with a few exceptions.&lt;br /&gt;
&lt;br /&gt;
(The exceptions being operators that exist in only one or the other; operators that exist in both have the same precedence in both.)&lt;br /&gt;
&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd|14| &amp;lt;nowiki&amp;gt;(reserved for postfix ++ and --)&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|13| &amp;lt;nowiki&amp;gt;! ~ contains remove (reserved for prefix ++ and --)&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|12| &amp;lt;nowiki&amp;gt;**&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|11| &amp;lt;nowiki&amp;gt;* / %&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|10| &amp;lt;nowiki&amp;gt;+ -&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd| 9| &amp;lt;nowiki&amp;gt;&amp;lt;&amp;lt; &amp;gt;&amp;gt; &amp;gt;&amp;gt;&amp;gt;&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|8| &amp;lt;nowiki&amp;gt;&amp;lt; &amp;gt; &amp;lt;= &amp;gt;=&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|7| &amp;lt;nowiki&amp;gt;== !=&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|6| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|5| &amp;lt;nowiki&amp;gt;^&amp;lt;/nowiki&amp;gt; (xor) }}}}&lt;br /&gt;
{{eztr|{{eztd|5| &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|3| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;amp;&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|2| &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|1|(reserved for &amp;lt;nowiki&amp;gt;?:&amp;lt;/nowiki&amp;gt;(ternary conditional))}}}}&lt;br /&gt;
{{eztr|{{eztd|0| (reserved for assignments)}}}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Statements inside a () pair are always evaluated first, then in order of precedence as listed above (highest number precedence first), then left-to-right.&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if ( true || true &amp;amp;&amp;amp; false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
   // &amp;amp;&amp;amp; has highest precedence&lt;br /&gt;
   // true or (true &amp;amp;&amp;amp; false) returns true&lt;br /&gt;
}&lt;br /&gt;
if ( ( true &amp;amp;&amp;amp; false ) &amp;amp;&amp;amp; true )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed.&amp;quot; );&lt;br /&gt;
   // ( true &amp;amp;&amp;amp; false ) is evaluated first since it is inside of parentheses&lt;br /&gt;
   // so we end up evaluating ( false &amp;amp;&amp;amp; true ) which returns false&lt;br /&gt;
}&lt;br /&gt;
if ( true &amp;amp;&amp;amp; ! ( true &amp;amp;&amp;amp; false ) )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
   // ( true &amp;amp;&amp;amp; false ) is evaluated first since it is inside of parentheses&lt;br /&gt;
   // the ! operator converts the false from ( true &amp;amp;&amp;amp; false ) to true&lt;br /&gt;
   // ( true &amp;amp;&amp;amp; true ) returns true&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Operators&amp;diff=1887</id>
		<title>Operators</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Operators&amp;diff=1887"/>
		<updated>2011-01-26T16:53:17Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOCright}}&lt;br /&gt;
==Mathematical Operators==&lt;br /&gt;
&lt;br /&gt;
The following mathematical operators are used in KoLmafia:&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| + |Addition|Performs addition and string concatenation}}}}&lt;br /&gt;
{{eztr|{{eztd| - |Subtraction|Performs subtraction}}}}&lt;br /&gt;
{{eztr|{{eztd| * |Multiplication|Performs multiplication}}}}&lt;br /&gt;
{{eztr|{{eztd| / |Division|Performs division}}}}&lt;br /&gt;
{{eztr|{{eztd| % |Modulo|Returns the remainder after division}}}}&lt;br /&gt;
{{eztr|{{eztd| ** |Exponent|Performs exponentiation}}}}&lt;br /&gt;
}}&lt;br /&gt;
Note that, with the exception of using &amp;lt;nowiki&amp;gt;&amp;quot;+&amp;quot;&amp;lt;/nowiki&amp;gt; for string concatenation, these operators can only be used on int or float datatypes.&lt;br /&gt;
&lt;br /&gt;
==Bitwise Operators==&lt;br /&gt;
&lt;br /&gt;
The following mathematical operators are used for operating on the bits of integers. The operands must be integers; no coercion is allowed:&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;lt;/nowiki&amp;gt; |and|a &amp;amp; b}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; |or|a &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; b}}}}&lt;br /&gt;
{{eztr|{{eztd| ~ |not|~a}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;&amp;lt; |left shift|a &amp;lt;&amp;lt; b}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;gt;&amp;gt; |right shift|a &amp;gt;&amp;gt; b}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;amp;=&amp;lt;/nowiki&amp;gt; |and|&amp;lt;nowiki&amp;gt;a &amp;amp;= b --&amp;gt; a = a &amp;amp; b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;|=&amp;lt;/nowiki&amp;gt; |or|&amp;lt;nowiki&amp;gt;a |= b --&amp;gt; a = a | b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;gt;&amp;gt;&amp;gt; |unsigned right shift|a &amp;gt;&amp;gt;&amp;gt; b}}}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Assignment Operators==&lt;br /&gt;
The following assignment operators are used in KoLmafia (let a = left operand, b = right operand):&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;+=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a + b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;-=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a - b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;*=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a * b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;/=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a / b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;%=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a % b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;**=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a ** b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a &amp;gt;&amp;gt; b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a &amp;gt;&amp;gt;&amp;gt; b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
}}&lt;br /&gt;
Of these, only += and = are usable for strings.  See [[Operators#Mathematical Operators|Mathematical Operators]] for information regarding the basic Mathematical Operators.&lt;br /&gt;
&lt;br /&gt;
==Relational Operators==&lt;br /&gt;
&lt;br /&gt;
To follow these examples, a basic understanding of the concepts found on [[Control Structures]] would be helpful.&lt;br /&gt;
&lt;br /&gt;
In order to create more complex if statements, we need to understand the basic relational operators:&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;==&amp;lt;/nowiki&amp;gt; |equal to}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;!=&amp;lt;/nowiki&amp;gt; |not equal to}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;lt;&amp;lt;/nowiki&amp;gt; |less than}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;&amp;lt;/nowiki&amp;gt; |greater than}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;lt;=&amp;lt;/nowiki&amp;gt; |less than or equal to}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; |greater than or equal to}}}}&lt;br /&gt;
}}&lt;br /&gt;
Note that you cannot mix datatypes within a comparison or KoLmafia will abort with an error, with the exception of mixing types int and float, where KoLmafia will do a transparent type conversion behind-the-scenes. If you need to compare different datatypes, use one or more of the [[Datatype Conversions|Datatype Conversion]] functions. Also, == is case-insensitive with respect to strings.&lt;br /&gt;
&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if ( true == true )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( true == false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( 1 == 1.0 )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( 1 == 2 )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( &amp;quot;Hello&amp;quot; == &amp;quot;hello&amp;quot; )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
==Boolean Operators==&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;amp;&amp;lt;/nowiki&amp;gt; |and}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt; |or}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;!&amp;lt;/nowiki&amp;gt; |not}}}}&lt;br /&gt;
}}&lt;br /&gt;
Note that the above operators only work with boolean values &amp;amp; datatypes. To make use of them with other datatypes, you will either need to first perform a [[Datatype Conversions|Datatype Conversion]], or you will need to nest your operations such that a boolean value is used with the boolean operators.&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if ( true &amp;amp;&amp;amp; true )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed (both possibilities proved true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( true &amp;amp;&amp;amp; false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed (only one possibility proved true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( true || false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed (since at least one of the possibilities proved true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( ! false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed (since the not operator converted false to true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==Operator Precedence==&lt;br /&gt;
&lt;br /&gt;
KoLmafia follows [http://download.oracle.com/javase/tutorial/java/nutsandbolts/operators.html Java&#039;s Operator Precedence rules] with a few exceptions.&lt;br /&gt;
&lt;br /&gt;
(The exceptions being operators that exist in only one or the other; operators that exist in both have the same precedence in both.)&lt;br /&gt;
&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd|14| &amp;lt;nowiki&amp;gt;(reserved for postfix ++ and --)&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|13| &amp;lt;nowiki&amp;gt;! ~ contains remove (reserved for prefix ++ and --)&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|12| &amp;lt;nowiki&amp;gt;**&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|11| &amp;lt;nowiki&amp;gt;* / %&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|10| &amp;lt;nowiki&amp;gt;+ -&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd| 9| &amp;lt;nowiki&amp;gt;&amp;lt;&amp;lt; &amp;gt;&amp;gt; &amp;gt;&amp;gt;&amp;gt;&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|8| &amp;lt;nowiki&amp;gt;&amp;lt; &amp;gt; &amp;lt;= &amp;gt;=&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|7| &amp;lt;nowiki&amp;gt;== !=&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|6| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|5| &amp;lt;nowiki&amp;gt;^&amp;lt;/nowiki&amp;gt; (xor) }}}}&lt;br /&gt;
{{eztr|{{eztd|5| &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|3| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;amp;&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|2| &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|1|(reserved for &amp;lt;nowiki&amp;gt;?:&amp;lt;/nowiki&amp;gt;(ternary conditional))}}}}&lt;br /&gt;
{{eztr|{{eztd|0| (reserved for assignments)}}}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Statements inside a () pair are always evaluated first, then in order of precedence as listed above (highest number precedence first), then left-to-right.&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if ( true || true &amp;amp;&amp;amp; false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
   // evaluated right-to-left&lt;br /&gt;
   // true or (true &amp;amp;&amp;amp; false) returns true&lt;br /&gt;
}&lt;br /&gt;
if ( ( true &amp;amp;&amp;amp; false ) &amp;amp;&amp;amp; true )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed.&amp;quot; );&lt;br /&gt;
   // ( true &amp;amp;&amp;amp; false ) is evaluated first since it is inside of parentheses&lt;br /&gt;
   // so we end up evaluating ( false &amp;amp;&amp;amp; true ) which returns false&lt;br /&gt;
}&lt;br /&gt;
if ( true &amp;amp;&amp;amp; ! ( true &amp;amp;&amp;amp; false ) )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
   // ( true &amp;amp;&amp;amp; false ) is evaluated first since it is inside of parentheses&lt;br /&gt;
   // the ! operator converts the false from ( true &amp;amp;&amp;amp; false ) to true&lt;br /&gt;
   // ( true &amp;amp;&amp;amp; true ) returns true&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Operators&amp;diff=1886</id>
		<title>Operators</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Operators&amp;diff=1886"/>
		<updated>2011-01-26T16:49:25Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: /* Operator Precedence */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOCright}}&lt;br /&gt;
==Mathematical Operators==&lt;br /&gt;
&lt;br /&gt;
The following mathematical operators are used in KoLmafia:&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| + |Addition|Performs addition and string concatenation}}}}&lt;br /&gt;
{{eztr|{{eztd| - |Subtraction|Performs subtraction}}}}&lt;br /&gt;
{{eztr|{{eztd| * |Multiplication|Performs multiplication}}}}&lt;br /&gt;
{{eztr|{{eztd| / |Division|Performs division}}}}&lt;br /&gt;
{{eztr|{{eztd| % |Modulo|Returns the remainder after division}}}}&lt;br /&gt;
{{eztr|{{eztd| ** |Exponent|Performs exponentiation}}}}&lt;br /&gt;
}}&lt;br /&gt;
Note that, with the exception of using &amp;lt;nowiki&amp;gt;&amp;quot;+&amp;quot;&amp;lt;/nowiki&amp;gt; for string concatenation, these operators can only be used on int or float datatypes.&lt;br /&gt;
&lt;br /&gt;
==Bitwise Operators==&lt;br /&gt;
&lt;br /&gt;
The following mathematical operators are used for operating on the bits of integers. The operands must be integers; no coercion is allowed:&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;lt;/nowiki&amp;gt; |and|a &amp;amp; b}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; |or|a &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; b}}}}&lt;br /&gt;
{{eztr|{{eztd| ~ |not|~a}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;&amp;lt; |left shift|a &amp;lt;&amp;lt; b}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;gt;&amp;gt; |right shift|a &amp;gt;&amp;gt; b}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;amp;=&amp;lt;/nowiki&amp;gt; |and|&amp;lt;nowiki&amp;gt;a &amp;amp;= b --&amp;gt; a = a &amp;amp; b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;|=&amp;lt;/nowiki&amp;gt; |or|&amp;lt;nowiki&amp;gt;a |= b --&amp;gt; a = a | b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;gt;&amp;gt;&amp;gt; |unsigned right shift|a &amp;gt;&amp;gt;&amp;gt; b}}}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Assignment Operators==&lt;br /&gt;
The following assignment operators are used in KoLmafia (let a = left operand, b = right operand):&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;+=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a + b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;-=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a - b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;*=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a * b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;/=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a / b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;%=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a % b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;**=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a ** b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a &amp;gt;&amp;gt; b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a &amp;gt;&amp;gt;&amp;gt; b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
}}&lt;br /&gt;
Of these, only += and = are usable for strings.  See [[Operators#Mathematical Operators|Mathematical Operators]] for information regarding the basic Mathematical Operators.&lt;br /&gt;
&lt;br /&gt;
==Relational Operators==&lt;br /&gt;
&lt;br /&gt;
To follow these examples, a basic understanding of the concepts found on [[Control Structures]] would be helpful.&lt;br /&gt;
&lt;br /&gt;
In order to create more complex if statements, we need to understand the basic relational operators:&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;==&amp;lt;/nowiki&amp;gt; |equal to}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;!=&amp;lt;/nowiki&amp;gt; |not equal to}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;lt;&amp;lt;/nowiki&amp;gt; |less than}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;&amp;lt;/nowiki&amp;gt; |greater than}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;lt;=&amp;lt;/nowiki&amp;gt; |less than or equal to}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; |greater than or equal to}}}}&lt;br /&gt;
}}&lt;br /&gt;
Note that you cannot mix datatypes within a comparison or KoLmafia will abort with an error, with the exception of mixing types int and float, where KoLmafia will do a transparent type conversion behind-the-scenes. If you need to compare different datatypes, use one or more of the [[Datatype Conversions|Datatype Conversion]] functions. Also, == is case-insensitive with respect to strings.&lt;br /&gt;
&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if ( true == true )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( true == false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( 1 == 1.0 )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( 1 == 2 )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( &amp;quot;Hello&amp;quot; == &amp;quot;hello&amp;quot; )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
==Boolean Operators==&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;amp;&amp;lt;/nowiki&amp;gt; |and}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt; |or}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;!&amp;lt;/nowiki&amp;gt; |not}}}}&lt;br /&gt;
}}&lt;br /&gt;
Note that the above operators only work with boolean values &amp;amp; datatypes. To make use of them with other datatypes, you will either need to first perform a [[Datatype Conversions|Datatype Conversion]], or you will need to nest your operations such that a boolean value is used with the boolean operators.&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if ( true &amp;amp;&amp;amp; true )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed (both possibilities proved true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( true &amp;amp;&amp;amp; false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed (only one possibility proved true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( true || false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed (since at least one of the possibilities proved true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( ! false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed (since the not operator converted false to true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
We also need to understand operator precedence. Statements inside a () pair are always evaluated first, then from right to left.&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if ( true || true &amp;amp;&amp;amp; false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
   // evaluated right-to-left&lt;br /&gt;
   // true or (true &amp;amp;&amp;amp; false) returns true&lt;br /&gt;
}&lt;br /&gt;
if ( ( true &amp;amp;&amp;amp; false ) &amp;amp;&amp;amp; true )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed.&amp;quot; );&lt;br /&gt;
   // ( true &amp;amp;&amp;amp; false ) is evaluated first since it is inside of parentheses&lt;br /&gt;
   // so we end up evaluating ( false &amp;amp;&amp;amp; true ) which returns false&lt;br /&gt;
}&lt;br /&gt;
if ( true &amp;amp;&amp;amp; ! ( true &amp;amp;&amp;amp; false ) )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
   // ( true &amp;amp;&amp;amp; false ) is evaluated first since it is inside of parentheses&lt;br /&gt;
   // the ! operator converts the false from ( true &amp;amp;&amp;amp; false ) to true&lt;br /&gt;
   // ( true &amp;amp;&amp;amp; true ) returns true&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==Operator Precedence==&lt;br /&gt;
&lt;br /&gt;
KoLmafia follows [http://download.oracle.com/javase/tutorial/java/nutsandbolts/operators.html Java&#039;s Operator Precedence rules] with a few exceptions.&lt;br /&gt;
&lt;br /&gt;
(The exceptions being operators that exist in only one or the other; operators that exist in both have the same precedence in both.)&lt;br /&gt;
&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd|14| &amp;lt;nowiki&amp;gt;(reserved for postfix ++ and --)&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|13| &amp;lt;nowiki&amp;gt;! ~ contains remove (reserved for prefix ++ and --)&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|12| &amp;lt;nowiki&amp;gt;**&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|11| &amp;lt;nowiki&amp;gt;* / %&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|10| &amp;lt;nowiki&amp;gt;+ -&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd| 9| &amp;lt;nowiki&amp;gt;&amp;lt;&amp;lt; &amp;gt;&amp;gt; &amp;gt;&amp;gt;&amp;gt;&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|8| &amp;lt;nowiki&amp;gt;&amp;lt; &amp;gt; &amp;lt;= &amp;gt;=&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|7| &amp;lt;nowiki&amp;gt;== !=&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|6| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|5| &amp;lt;nowiki&amp;gt;^&amp;lt;/nowiki&amp;gt; (xor) }}}}&lt;br /&gt;
{{eztr|{{eztd|5| &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|3| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;amp;&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|2| &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|1|(reserved for &amp;lt;nowiki&amp;gt;?:&amp;lt;/nowiki&amp;gt;(ternary conditional))}}}}&lt;br /&gt;
{{eztr|{{eztd|0| (reserved for assignments)}}}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Operators&amp;diff=1885</id>
		<title>Operators</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Operators&amp;diff=1885"/>
		<updated>2011-01-26T16:49:13Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: /* Operator Precedence */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOCright}}&lt;br /&gt;
==Mathematical Operators==&lt;br /&gt;
&lt;br /&gt;
The following mathematical operators are used in KoLmafia:&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| + |Addition|Performs addition and string concatenation}}}}&lt;br /&gt;
{{eztr|{{eztd| - |Subtraction|Performs subtraction}}}}&lt;br /&gt;
{{eztr|{{eztd| * |Multiplication|Performs multiplication}}}}&lt;br /&gt;
{{eztr|{{eztd| / |Division|Performs division}}}}&lt;br /&gt;
{{eztr|{{eztd| % |Modulo|Returns the remainder after division}}}}&lt;br /&gt;
{{eztr|{{eztd| ** |Exponent|Performs exponentiation}}}}&lt;br /&gt;
}}&lt;br /&gt;
Note that, with the exception of using &amp;lt;nowiki&amp;gt;&amp;quot;+&amp;quot;&amp;lt;/nowiki&amp;gt; for string concatenation, these operators can only be used on int or float datatypes.&lt;br /&gt;
&lt;br /&gt;
==Bitwise Operators==&lt;br /&gt;
&lt;br /&gt;
The following mathematical operators are used for operating on the bits of integers. The operands must be integers; no coercion is allowed:&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;lt;/nowiki&amp;gt; |and|a &amp;amp; b}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; |or|a &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; b}}}}&lt;br /&gt;
{{eztr|{{eztd| ~ |not|~a}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;&amp;lt; |left shift|a &amp;lt;&amp;lt; b}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;gt;&amp;gt; |right shift|a &amp;gt;&amp;gt; b}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;amp;=&amp;lt;/nowiki&amp;gt; |and|&amp;lt;nowiki&amp;gt;a &amp;amp;= b --&amp;gt; a = a &amp;amp; b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;|=&amp;lt;/nowiki&amp;gt; |or|&amp;lt;nowiki&amp;gt;a |= b --&amp;gt; a = a | b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;gt;&amp;gt;&amp;gt; |unsigned right shift|a &amp;gt;&amp;gt;&amp;gt; b}}}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Assignment Operators==&lt;br /&gt;
The following assignment operators are used in KoLmafia (let a = left operand, b = right operand):&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;+=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a + b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;-=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a - b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;*=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a * b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;/=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a / b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;%=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a % b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;**=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a ** b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a &amp;gt;&amp;gt; b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a &amp;gt;&amp;gt;&amp;gt; b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
}}&lt;br /&gt;
Of these, only += and = are usable for strings.  See [[Operators#Mathematical Operators|Mathematical Operators]] for information regarding the basic Mathematical Operators.&lt;br /&gt;
&lt;br /&gt;
==Relational Operators==&lt;br /&gt;
&lt;br /&gt;
To follow these examples, a basic understanding of the concepts found on [[Control Structures]] would be helpful.&lt;br /&gt;
&lt;br /&gt;
In order to create more complex if statements, we need to understand the basic relational operators:&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;==&amp;lt;/nowiki&amp;gt; |equal to}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;!=&amp;lt;/nowiki&amp;gt; |not equal to}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;lt;&amp;lt;/nowiki&amp;gt; |less than}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;&amp;lt;/nowiki&amp;gt; |greater than}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;lt;=&amp;lt;/nowiki&amp;gt; |less than or equal to}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; |greater than or equal to}}}}&lt;br /&gt;
}}&lt;br /&gt;
Note that you cannot mix datatypes within a comparison or KoLmafia will abort with an error, with the exception of mixing types int and float, where KoLmafia will do a transparent type conversion behind-the-scenes. If you need to compare different datatypes, use one or more of the [[Datatype Conversions|Datatype Conversion]] functions. Also, == is case-insensitive with respect to strings.&lt;br /&gt;
&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if ( true == true )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( true == false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( 1 == 1.0 )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( 1 == 2 )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( &amp;quot;Hello&amp;quot; == &amp;quot;hello&amp;quot; )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
==Boolean Operators==&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;amp;&amp;lt;/nowiki&amp;gt; |and}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt; |or}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;!&amp;lt;/nowiki&amp;gt; |not}}}}&lt;br /&gt;
}}&lt;br /&gt;
Note that the above operators only work with boolean values &amp;amp; datatypes. To make use of them with other datatypes, you will either need to first perform a [[Datatype Conversions|Datatype Conversion]], or you will need to nest your operations such that a boolean value is used with the boolean operators.&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if ( true &amp;amp;&amp;amp; true )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed (both possibilities proved true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( true &amp;amp;&amp;amp; false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed (only one possibility proved true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( true || false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed (since at least one of the possibilities proved true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( ! false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed (since the not operator converted false to true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
We also need to understand operator precedence. Statements inside a () pair are always evaluated first, then from right to left.&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if ( true || true &amp;amp;&amp;amp; false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
   // evaluated right-to-left&lt;br /&gt;
   // true or (true &amp;amp;&amp;amp; false) returns true&lt;br /&gt;
}&lt;br /&gt;
if ( ( true &amp;amp;&amp;amp; false ) &amp;amp;&amp;amp; true )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed.&amp;quot; );&lt;br /&gt;
   // ( true &amp;amp;&amp;amp; false ) is evaluated first since it is inside of parentheses&lt;br /&gt;
   // so we end up evaluating ( false &amp;amp;&amp;amp; true ) which returns false&lt;br /&gt;
}&lt;br /&gt;
if ( true &amp;amp;&amp;amp; ! ( true &amp;amp;&amp;amp; false ) )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
   // ( true &amp;amp;&amp;amp; false ) is evaluated first since it is inside of parentheses&lt;br /&gt;
   // the ! operator converts the false from ( true &amp;amp;&amp;amp; false ) to true&lt;br /&gt;
   // ( true &amp;amp;&amp;amp; true ) returns true&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==Operator Precedence==&lt;br /&gt;
&lt;br /&gt;
KoLmafia follows [http://download.oracle.com/javase/tutorial/java/nutsandbolts/operators.html Java&#039;s Operator Precedence rules] with a few exceptions.&lt;br /&gt;
(The exceptions being operators that exist in only one or the other; operators that exist in both have the same precedence in both.)&lt;br /&gt;
&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd|14| &amp;lt;nowiki&amp;gt;(reserved for postfix ++ and --)&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|13| &amp;lt;nowiki&amp;gt;! ~ contains remove (reserved for prefix ++ and --)&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|12| &amp;lt;nowiki&amp;gt;**&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|11| &amp;lt;nowiki&amp;gt;* / %&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|10| &amp;lt;nowiki&amp;gt;+ -&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd| 9| &amp;lt;nowiki&amp;gt;&amp;lt;&amp;lt; &amp;gt;&amp;gt; &amp;gt;&amp;gt;&amp;gt;&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|8| &amp;lt;nowiki&amp;gt;&amp;lt; &amp;gt; &amp;lt;= &amp;gt;=&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|7| &amp;lt;nowiki&amp;gt;== !=&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|6| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|5| &amp;lt;nowiki&amp;gt;^&amp;lt;/nowiki&amp;gt; (xor) }}}}&lt;br /&gt;
{{eztr|{{eztd|5| &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|3| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;amp;&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|2| &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|1|(reserved for &amp;lt;nowiki&amp;gt;?:&amp;lt;/nowiki&amp;gt;(ternary conditional))}}}}&lt;br /&gt;
{{eztr|{{eztd|0| (reserved for assignments)}}}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Operators&amp;diff=1884</id>
		<title>Operators</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Operators&amp;diff=1884"/>
		<updated>2011-01-26T16:45:59Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: /* Operator Precedence */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOCright}}&lt;br /&gt;
==Mathematical Operators==&lt;br /&gt;
&lt;br /&gt;
The following mathematical operators are used in KoLmafia:&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| + |Addition|Performs addition and string concatenation}}}}&lt;br /&gt;
{{eztr|{{eztd| - |Subtraction|Performs subtraction}}}}&lt;br /&gt;
{{eztr|{{eztd| * |Multiplication|Performs multiplication}}}}&lt;br /&gt;
{{eztr|{{eztd| / |Division|Performs division}}}}&lt;br /&gt;
{{eztr|{{eztd| % |Modulo|Returns the remainder after division}}}}&lt;br /&gt;
{{eztr|{{eztd| ** |Exponent|Performs exponentiation}}}}&lt;br /&gt;
}}&lt;br /&gt;
Note that, with the exception of using &amp;lt;nowiki&amp;gt;&amp;quot;+&amp;quot;&amp;lt;/nowiki&amp;gt; for string concatenation, these operators can only be used on int or float datatypes.&lt;br /&gt;
&lt;br /&gt;
==Bitwise Operators==&lt;br /&gt;
&lt;br /&gt;
The following mathematical operators are used for operating on the bits of integers. The operands must be integers; no coercion is allowed:&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;lt;/nowiki&amp;gt; |and|a &amp;amp; b}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; |or|a &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; b}}}}&lt;br /&gt;
{{eztr|{{eztd| ~ |not|~a}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;&amp;lt; |left shift|a &amp;lt;&amp;lt; b}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;gt;&amp;gt; |right shift|a &amp;gt;&amp;gt; b}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;amp;=&amp;lt;/nowiki&amp;gt; |and|&amp;lt;nowiki&amp;gt;a &amp;amp;= b --&amp;gt; a = a &amp;amp; b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;|=&amp;lt;/nowiki&amp;gt; |or|&amp;lt;nowiki&amp;gt;a |= b --&amp;gt; a = a | b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;gt;&amp;gt;&amp;gt; |unsigned right shift|a &amp;gt;&amp;gt;&amp;gt; b}}}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Assignment Operators==&lt;br /&gt;
The following assignment operators are used in KoLmafia (let a = left operand, b = right operand):&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;+=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a + b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;-=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a - b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;*=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a * b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;/=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a / b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;%=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a % b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;**=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a ** b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a &amp;gt;&amp;gt; b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a &amp;gt;&amp;gt;&amp;gt; b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
}}&lt;br /&gt;
Of these, only += and = are usable for strings.  See [[Operators#Mathematical Operators|Mathematical Operators]] for information regarding the basic Mathematical Operators.&lt;br /&gt;
&lt;br /&gt;
==Relational Operators==&lt;br /&gt;
&lt;br /&gt;
To follow these examples, a basic understanding of the concepts found on [[Control Structures]] would be helpful.&lt;br /&gt;
&lt;br /&gt;
In order to create more complex if statements, we need to understand the basic relational operators:&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;==&amp;lt;/nowiki&amp;gt; |equal to}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;!=&amp;lt;/nowiki&amp;gt; |not equal to}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;lt;&amp;lt;/nowiki&amp;gt; |less than}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;&amp;lt;/nowiki&amp;gt; |greater than}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;lt;=&amp;lt;/nowiki&amp;gt; |less than or equal to}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; |greater than or equal to}}}}&lt;br /&gt;
}}&lt;br /&gt;
Note that you cannot mix datatypes within a comparison or KoLmafia will abort with an error, with the exception of mixing types int and float, where KoLmafia will do a transparent type conversion behind-the-scenes. If you need to compare different datatypes, use one or more of the [[Datatype Conversions|Datatype Conversion]] functions. Also, == is case-insensitive with respect to strings.&lt;br /&gt;
&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if ( true == true )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( true == false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( 1 == 1.0 )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( 1 == 2 )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( &amp;quot;Hello&amp;quot; == &amp;quot;hello&amp;quot; )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
==Boolean Operators==&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;amp;&amp;lt;/nowiki&amp;gt; |and}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt; |or}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;!&amp;lt;/nowiki&amp;gt; |not}}}}&lt;br /&gt;
}}&lt;br /&gt;
Note that the above operators only work with boolean values &amp;amp; datatypes. To make use of them with other datatypes, you will either need to first perform a [[Datatype Conversions|Datatype Conversion]], or you will need to nest your operations such that a boolean value is used with the boolean operators.&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if ( true &amp;amp;&amp;amp; true )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed (both possibilities proved true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( true &amp;amp;&amp;amp; false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed (only one possibility proved true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( true || false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed (since at least one of the possibilities proved true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( ! false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed (since the not operator converted false to true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
We also need to understand operator precedence. Statements inside a () pair are always evaluated first, then from right to left.&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if ( true || true &amp;amp;&amp;amp; false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
   // evaluated right-to-left&lt;br /&gt;
   // true or (true &amp;amp;&amp;amp; false) returns true&lt;br /&gt;
}&lt;br /&gt;
if ( ( true &amp;amp;&amp;amp; false ) &amp;amp;&amp;amp; true )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed.&amp;quot; );&lt;br /&gt;
   // ( true &amp;amp;&amp;amp; false ) is evaluated first since it is inside of parentheses&lt;br /&gt;
   // so we end up evaluating ( false &amp;amp;&amp;amp; true ) which returns false&lt;br /&gt;
}&lt;br /&gt;
if ( true &amp;amp;&amp;amp; ! ( true &amp;amp;&amp;amp; false ) )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
   // ( true &amp;amp;&amp;amp; false ) is evaluated first since it is inside of parentheses&lt;br /&gt;
   // the ! operator converts the false from ( true &amp;amp;&amp;amp; false ) to true&lt;br /&gt;
   // ( true &amp;amp;&amp;amp; true ) returns true&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==Operator Precedence==&lt;br /&gt;
&lt;br /&gt;
KoLmafia follows [http://download.oracle.com/javase/tutorial/java/nutsandbolts/operators.html Java&#039;s Operator Precedence rules] with a few exceptions.&lt;br /&gt;
(The exceptions being operators that exist in only one or the other; operators that exist in both have the same precedence in both.)&lt;br /&gt;
&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd|14| &amp;lt;nowiki&amp;gt;(reserved for postfix ++ and --)&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|13| &amp;lt;nowiki&amp;gt;! ~ contains remove (reserved for prefix ++ and --)&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|12| &amp;lt;nowiki&amp;gt;**&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|11| &amp;lt;nowiki&amp;gt;* / %&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|10| &amp;lt;nowiki&amp;gt;+ -&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd| 9| &amp;lt;nowiki&amp;gt;&amp;lt;&amp;lt; &amp;gt;&amp;gt; &amp;gt;&amp;gt;&amp;gt;&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|8| &amp;lt;nowiki&amp;gt;&amp;lt; &amp;gt; &amp;lt;= &amp;gt;=&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|7| &amp;lt;nowiki&amp;gt;== !=&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|6| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|5| &amp;lt;nowiki&amp;gt;^&amp;lt;/nowiki&amp;gt; (xor) }}}}&lt;br /&gt;
{{eztr|{{eztd|5| &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|3| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;amp;&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|2| &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|1| &amp;lt;nowiki&amp;gt;?:&amp;lt;/nowiki&amp;gt; (ternary conditional)}}}}&lt;br /&gt;
{{eztr|{{eztd|0| (reserved for assignments)}}}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Operators&amp;diff=1883</id>
		<title>Operators</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Operators&amp;diff=1883"/>
		<updated>2011-01-26T16:11:32Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: /* Operator Precedence */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOCright}}&lt;br /&gt;
==Mathematical Operators==&lt;br /&gt;
&lt;br /&gt;
The following mathematical operators are used in KoLmafia:&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| + |Addition|Performs addition and string concatenation}}}}&lt;br /&gt;
{{eztr|{{eztd| - |Subtraction|Performs subtraction}}}}&lt;br /&gt;
{{eztr|{{eztd| * |Multiplication|Performs multiplication}}}}&lt;br /&gt;
{{eztr|{{eztd| / |Division|Performs division}}}}&lt;br /&gt;
{{eztr|{{eztd| % |Modulo|Returns the remainder after division}}}}&lt;br /&gt;
{{eztr|{{eztd| ** |Exponent|Performs exponentiation}}}}&lt;br /&gt;
}}&lt;br /&gt;
Note that, with the exception of using &amp;lt;nowiki&amp;gt;&amp;quot;+&amp;quot;&amp;lt;/nowiki&amp;gt; for string concatenation, these operators can only be used on int or float datatypes.&lt;br /&gt;
&lt;br /&gt;
==Bitwise Operators==&lt;br /&gt;
&lt;br /&gt;
The following mathematical operators are used for operating on the bits of integers. The operands must be integers; no coercion is allowed:&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;lt;/nowiki&amp;gt; |and|a &amp;amp; b}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; |or|a &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; b}}}}&lt;br /&gt;
{{eztr|{{eztd| ~ |not|~a}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;&amp;lt; |left shift|a &amp;lt;&amp;lt; b}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;gt;&amp;gt; |right shift|a &amp;gt;&amp;gt; b}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;amp;=&amp;lt;/nowiki&amp;gt; |and|&amp;lt;nowiki&amp;gt;a &amp;amp;= b --&amp;gt; a = a &amp;amp; b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;|=&amp;lt;/nowiki&amp;gt; |or|&amp;lt;nowiki&amp;gt;a |= b --&amp;gt; a = a | b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;gt;&amp;gt;&amp;gt; |unsigned right shift|a &amp;gt;&amp;gt;&amp;gt; b}}}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Assignment Operators==&lt;br /&gt;
The following assignment operators are used in KoLmafia (let a = left operand, b = right operand):&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;+=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a + b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;-=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a - b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;*=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a * b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;/=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a / b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;%=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a % b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;**=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a ** b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a &amp;gt;&amp;gt; b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a &amp;gt;&amp;gt;&amp;gt; b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
}}&lt;br /&gt;
Of these, only += and = are usable for strings.  See [[Operators#Mathematical Operators|Mathematical Operators]] for information regarding the basic Mathematical Operators.&lt;br /&gt;
&lt;br /&gt;
==Relational Operators==&lt;br /&gt;
&lt;br /&gt;
To follow these examples, a basic understanding of the concepts found on [[Control Structures]] would be helpful.&lt;br /&gt;
&lt;br /&gt;
In order to create more complex if statements, we need to understand the basic relational operators:&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;==&amp;lt;/nowiki&amp;gt; |equal to}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;!=&amp;lt;/nowiki&amp;gt; |not equal to}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;lt;&amp;lt;/nowiki&amp;gt; |less than}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;&amp;lt;/nowiki&amp;gt; |greater than}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;lt;=&amp;lt;/nowiki&amp;gt; |less than or equal to}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; |greater than or equal to}}}}&lt;br /&gt;
}}&lt;br /&gt;
Note that you cannot mix datatypes within a comparison or KoLmafia will abort with an error, with the exception of mixing types int and float, where KoLmafia will do a transparent type conversion behind-the-scenes. If you need to compare different datatypes, use one or more of the [[Datatype Conversions|Datatype Conversion]] functions. Also, == is case-insensitive with respect to strings.&lt;br /&gt;
&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if ( true == true )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( true == false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( 1 == 1.0 )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( 1 == 2 )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( &amp;quot;Hello&amp;quot; == &amp;quot;hello&amp;quot; )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
==Boolean Operators==&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;amp;&amp;lt;/nowiki&amp;gt; |and}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt; |or}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;!&amp;lt;/nowiki&amp;gt; |not}}}}&lt;br /&gt;
}}&lt;br /&gt;
Note that the above operators only work with boolean values &amp;amp; datatypes. To make use of them with other datatypes, you will either need to first perform a [[Datatype Conversions|Datatype Conversion]], or you will need to nest your operations such that a boolean value is used with the boolean operators.&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if ( true &amp;amp;&amp;amp; true )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed (both possibilities proved true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( true &amp;amp;&amp;amp; false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed (only one possibility proved true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( true || false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed (since at least one of the possibilities proved true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( ! false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed (since the not operator converted false to true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
We also need to understand operator precedence. Statements inside a () pair are always evaluated first, then from right to left.&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if ( true || true &amp;amp;&amp;amp; false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
   // evaluated right-to-left&lt;br /&gt;
   // true or (true &amp;amp;&amp;amp; false) returns true&lt;br /&gt;
}&lt;br /&gt;
if ( ( true &amp;amp;&amp;amp; false ) &amp;amp;&amp;amp; true )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed.&amp;quot; );&lt;br /&gt;
   // ( true &amp;amp;&amp;amp; false ) is evaluated first since it is inside of parentheses&lt;br /&gt;
   // so we end up evaluating ( false &amp;amp;&amp;amp; true ) which returns false&lt;br /&gt;
}&lt;br /&gt;
if ( true &amp;amp;&amp;amp; ! ( true &amp;amp;&amp;amp; false ) )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
   // ( true &amp;amp;&amp;amp; false ) is evaluated first since it is inside of parentheses&lt;br /&gt;
   // the ! operator converts the false from ( true &amp;amp;&amp;amp; false ) to true&lt;br /&gt;
   // ( true &amp;amp;&amp;amp; true ) returns true&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==Operator Precedence==&lt;br /&gt;
&lt;br /&gt;
KoLmafia follows [http://download.oracle.com/javase/tutorial/java/nutsandbolts/operators.html Java&#039;s Operator Precedence rules] with a few exceptions.&lt;br /&gt;
&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd|14| &amp;lt;nowiki&amp;gt;(reserved for postfix ++ and --)&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|13| &amp;lt;nowiki&amp;gt;! ~ contains remove (reserved for prefix ++ and --)&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|12| &amp;lt;nowiki&amp;gt;**&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|11| &amp;lt;nowiki&amp;gt;* / %&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|10| &amp;lt;nowiki&amp;gt;+ -&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd| 9| &amp;lt;nowiki&amp;gt;&amp;lt;&amp;lt; &amp;gt;&amp;gt; &amp;gt;&amp;gt;&amp;gt;&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|8| &amp;lt;nowiki&amp;gt;&amp;lt; &amp;gt; &amp;lt;= &amp;gt;=&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|7| &amp;lt;nowiki&amp;gt;== !=&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|6| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|5| &amp;lt;nowiki&amp;gt;^&amp;lt;/nowiki&amp;gt; (xor) }}}}&lt;br /&gt;
{{eztr|{{eztd|5| &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|3| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;amp;&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|2| &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt; }}}}&lt;br /&gt;
{{eztr|{{eztd|1| &amp;lt;nowiki&amp;gt;?:&amp;lt;/nowiki&amp;gt; (ternary conditional)}}}}&lt;br /&gt;
{{eztr|{{eztd|0| (reserved for assignments)}}}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Operators&amp;diff=1882</id>
		<title>Operators</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Operators&amp;diff=1882"/>
		<updated>2011-01-26T16:04:40Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: /* Boolean Operators */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOCright}}&lt;br /&gt;
==Mathematical Operators==&lt;br /&gt;
&lt;br /&gt;
The following mathematical operators are used in KoLmafia:&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| + |Addition|Performs addition and string concatenation}}}}&lt;br /&gt;
{{eztr|{{eztd| - |Subtraction|Performs subtraction}}}}&lt;br /&gt;
{{eztr|{{eztd| * |Multiplication|Performs multiplication}}}}&lt;br /&gt;
{{eztr|{{eztd| / |Division|Performs division}}}}&lt;br /&gt;
{{eztr|{{eztd| % |Modulo|Returns the remainder after division}}}}&lt;br /&gt;
{{eztr|{{eztd| ** |Exponent|Performs exponentiation}}}}&lt;br /&gt;
}}&lt;br /&gt;
Note that, with the exception of using &amp;lt;nowiki&amp;gt;&amp;quot;+&amp;quot;&amp;lt;/nowiki&amp;gt; for string concatenation, these operators can only be used on int or float datatypes.&lt;br /&gt;
&lt;br /&gt;
==Bitwise Operators==&lt;br /&gt;
&lt;br /&gt;
The following mathematical operators are used for operating on the bits of integers. The operands must be integers; no coercion is allowed:&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;lt;/nowiki&amp;gt; |and|a &amp;amp; b}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; |or|a &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; b}}}}&lt;br /&gt;
{{eztr|{{eztd| ~ |not|~a}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;&amp;lt; |left shift|a &amp;lt;&amp;lt; b}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;gt;&amp;gt; |right shift|a &amp;gt;&amp;gt; b}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;amp;=&amp;lt;/nowiki&amp;gt; |and|&amp;lt;nowiki&amp;gt;a &amp;amp;= b --&amp;gt; a = a &amp;amp; b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;|=&amp;lt;/nowiki&amp;gt; |or|&amp;lt;nowiki&amp;gt;a |= b --&amp;gt; a = a | b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;gt;&amp;gt;&amp;gt; |unsigned right shift|a &amp;gt;&amp;gt;&amp;gt; b}}}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Assignment Operators==&lt;br /&gt;
The following assignment operators are used in KoLmafia (let a = left operand, b = right operand):&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;+=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a + b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;-=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a - b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;*=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a * b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;/=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a / b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;%=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a % b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;**=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a ** b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a &amp;gt;&amp;gt; b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; |&amp;lt;nowiki&amp;gt;a = a &amp;gt;&amp;gt;&amp;gt; b&amp;lt;/nowiki&amp;gt;}}}}&lt;br /&gt;
}}&lt;br /&gt;
Of these, only += and = are usable for strings.  See [[Operators#Mathematical Operators|Mathematical Operators]] for information regarding the basic Mathematical Operators.&lt;br /&gt;
&lt;br /&gt;
==Relational Operators==&lt;br /&gt;
&lt;br /&gt;
To follow these examples, a basic understanding of the concepts found on [[Control Structures]] would be helpful.&lt;br /&gt;
&lt;br /&gt;
In order to create more complex if statements, we need to understand the basic relational operators:&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;==&amp;lt;/nowiki&amp;gt; |equal to}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;!=&amp;lt;/nowiki&amp;gt; |not equal to}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;lt;&amp;lt;/nowiki&amp;gt; |less than}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;&amp;lt;/nowiki&amp;gt; |greater than}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;lt;=&amp;lt;/nowiki&amp;gt; |less than or equal to}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;gt;=&amp;lt;/nowiki&amp;gt; |greater than or equal to}}}}&lt;br /&gt;
}}&lt;br /&gt;
Note that you cannot mix datatypes within a comparison or KoLmafia will abort with an error, with the exception of mixing types int and float, where KoLmafia will do a transparent type conversion behind-the-scenes. If you need to compare different datatypes, use one or more of the [[Datatype Conversions|Datatype Conversion]] functions. Also, == is case-insensitive with respect to strings.&lt;br /&gt;
&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if ( true == true )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( true == false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( 1 == 1.0 )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( 1 == 2 )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( &amp;quot;Hello&amp;quot; == &amp;quot;hello&amp;quot; )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
==Boolean Operators==&lt;br /&gt;
{{&lt;br /&gt;
eztable|&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;&amp;amp;&amp;amp;&amp;lt;/nowiki&amp;gt; |and}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt; |or}}}}&lt;br /&gt;
{{eztr|{{eztd| &amp;lt;nowiki&amp;gt;!&amp;lt;/nowiki&amp;gt; |not}}}}&lt;br /&gt;
}}&lt;br /&gt;
Note that the above operators only work with boolean values &amp;amp; datatypes. To make use of them with other datatypes, you will either need to first perform a [[Datatype Conversions|Datatype Conversion]], or you will need to nest your operations such that a boolean value is used with the boolean operators.&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if ( true &amp;amp;&amp;amp; true )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed (both possibilities proved true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( true &amp;amp;&amp;amp; false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed (only one possibility proved true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( true || false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed (since at least one of the possibilities proved true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
if ( ! false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed (since the not operator converted false to true).&amp;quot; );&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
We also need to understand operator precedence. Statements inside a () pair are always evaluated first, then from right to left.&lt;br /&gt;
{{&lt;br /&gt;
CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
if ( true || true &amp;amp;&amp;amp; false )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
   // evaluated right-to-left&lt;br /&gt;
   // true or (true &amp;amp;&amp;amp; false) returns true&lt;br /&gt;
}&lt;br /&gt;
if ( ( true &amp;amp;&amp;amp; false ) &amp;amp;&amp;amp; true )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line does NOT get printed.&amp;quot; );&lt;br /&gt;
   // ( true &amp;amp;&amp;amp; false ) is evaluated first since it is inside of parentheses&lt;br /&gt;
   // so we end up evaluating ( false &amp;amp;&amp;amp; true ) which returns false&lt;br /&gt;
}&lt;br /&gt;
if ( true &amp;amp;&amp;amp; ! ( true &amp;amp;&amp;amp; false ) )&lt;br /&gt;
{&lt;br /&gt;
   print( &amp;quot;This line DOES get printed.&amp;quot; );&lt;br /&gt;
   // ( true &amp;amp;&amp;amp; false ) is evaluated first since it is inside of parentheses&lt;br /&gt;
   // the ! operator converts the false from ( true &amp;amp;&amp;amp; false ) to true&lt;br /&gt;
   // ( true &amp;amp;&amp;amp; true ) returns true&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
==Operator Precedence==&lt;br /&gt;
&lt;br /&gt;
KoLmafia follows [http://download.oracle.com/javase/tutorial/java/nutsandbolts/operators.html Java&#039;s Operator Precedence rules] with a few exceptions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Category_talk:Tech_Support&amp;diff=7400</id>
		<title>Category talk:Tech Support</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Category_talk:Tech_Support&amp;diff=7400"/>
		<updated>2011-01-21T22:17:14Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: Created page with &amp;#039;We should brainstorm on how we want this category organized and what should be added. I&amp;#039;m looking into getting into editing / reviewing the source myself, and I&amp;#039;d love clearer he…&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We should brainstorm on how we want this category organized and what should be added. I&#039;m looking into getting into editing / reviewing the source myself, and I&#039;d love clearer help. ;) --[[User:StDoodle|StDoodle (#1059825)]] 22:17, 21 January 2011 (UTC)&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=User_talk:Malurth&amp;diff=7391</id>
		<title>User talk:Malurth</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=User_talk:Malurth&amp;diff=7391"/>
		<updated>2011-01-01T18:56:16Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Welcome to this wiki and thank you for signing up to edit one of our entries. ^_^ --[[User:Bale|Bale]] 08:50, 1 January 2011 (UTC)&lt;br /&gt;
  &lt;br /&gt;
Oh hi Bale! You&#039;re like a celebrity to me, thanks for the welcome! I can&#039;t just leave a typo there... anyway I dunno if you&#039;ll even see this but I wanted to at least respond. :D --[[User:Malurth|Malurth]] 13:29, 1 January 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
Welcome to the wiki, and thanks for contributing! Don&#039;t hesitate to fix such things; a lot of these pages were written up in mad-dashes, and there are quite a few speeeling and grammer errors. ;) --[[User:StDoodle|StDoodle (#1059825)]] 18:56, 1 January 2011 (UTC)&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Record&amp;diff=5662</id>
		<title>Record</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Record&amp;diff=5662"/>
		<updated>2010-12-17T12:38:49Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: Redirected page to Data Types#record&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Data Types#record]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Zlib&amp;diff=7256</id>
		<title>Zlib</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Zlib&amp;diff=7256"/>
		<updated>2010-12-03T15:57:58Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: /* Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOCright}}{{DISPLAYTITLE:ZLib (zlib.ash)}}&lt;br /&gt;
{{Attention|&lt;br /&gt;
This page details the use of functions in a script library. The information here is only useful to those who have followed the included steps to make use of these functions; they are not built-in to KoLmafia.&lt;br /&gt;
}}&lt;br /&gt;
== About Zarqon&#039;s Useful Function Library ==&lt;br /&gt;
Behold, a single function library containing most of zarqon&#039;s most useful functions, which will be used by most of his scripts. He grew tired of tweaking a function that was in multiple scripts and making sure he had changed them all. &#039;&#039;It would be nice&#039;&#039;, he thought in his customary italics, &#039;&#039;to have it in just one place&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In choosing which functions to include, he have tried to select only those functions which are a) super useful, or 2) needed by another of the included functions. It&#039;s a bit less efficient in terms of individual scripts, but in terms of repeated code across a family of scripts it is far simpler.&lt;br /&gt;
&lt;br /&gt;
== Functions ==&lt;br /&gt;
&lt;br /&gt;
{{HideLink|excise}}{{Function|&lt;br /&gt;
name=excise|&lt;br /&gt;
return_type=string|&lt;br /&gt;
parameter1={{Param|string|source}}|&lt;br /&gt;
parameter2={{Param|string|start}}|&lt;br /&gt;
parameter3={{Param|string|end}}|&lt;br /&gt;
p1desc=The original {{pspan|source}} string|&lt;br /&gt;
p2desc={{pspan|start}} after this string|&lt;br /&gt;
p3desc={{pspan|end}} before this string|&lt;br /&gt;
}}&lt;br /&gt;
This function returns a portion of the {{pspan|source}} string, from after the first occurrence of {{pspan|start}} to just before the first occurrence of {{pspan|end}}. If either {{pspan|start}} or {{pspan|end}} are missing, it will return an empty string. You can also supply either {{pspan|start}} or {{pspan|end}} as blank strings to specify the actual start or end of the {{pspan|source}} string.&lt;br /&gt;
&lt;br /&gt;
{{HideLink|normalized}}{{Function|&lt;br /&gt;
name=normalized|&lt;br /&gt;
return_type=string|&lt;br /&gt;
parameter1={{Param|string|mixvar}}|&lt;br /&gt;
parameter2={{Param|string|type}}|&lt;br /&gt;
p1desc={{pspan|mixvar}} is the string to normalize|&lt;br /&gt;
p2desc={{pspan|type}} is the datatype to normalize to|&lt;br /&gt;
}}&lt;br /&gt;
Returns {{pspan|mixvar}}, normalized to the specified KoLmafia {{pspan|type}}, which can be any primitive type or ASH datatype constant. For example, normalized(&amp;quot;badger&amp;quot;, &amp;quot;familiar&amp;quot;) would return &amp;quot;Astral Badger&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{{HideLink|rnum}}{{Function|&lt;br /&gt;
name=rnum|&lt;br /&gt;
return_type=string|&lt;br /&gt;
parameter1={{Param|int|n}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=rnum|&lt;br /&gt;
return_type=string|&lt;br /&gt;
parameter1={{Param|float|n}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=rnum|&lt;br /&gt;
return_type=string|&lt;br /&gt;
parameter1={{Param|float|n}}|&lt;br /&gt;
parameter2={{Param|int|place}}|&lt;br /&gt;
p1desc={{pspan|n}} is a number|&lt;br /&gt;
p2desc={{pspan|place}} is the number of decimal places to round to|&lt;br /&gt;
}}&lt;br /&gt;
Returns your number {{pspan|n}} as a human-readable string. For ints, this means it adds commas where appropriate. For floats, it also rounds to the nearest {{pspan|place}} after the decimal. Default {{pspan|place}} for the float-only version is 2, although it may display fewer digits if they are 0&#039;s. Examples: rnum(12580) =&amp;gt; &amp;quot;12,580&amp;quot;, rnum(3.14152964,3) =&amp;gt; &amp;quot;3.142&amp;quot;, rnum(4.00008) =&amp;gt; &amp;quot;4&amp;quot;, rnum(123456789.87654321) =&amp;gt; &amp;quot;123,456,789.88&amp;quot;. Recommended as a substitute for to_string().&lt;br /&gt;
&lt;br /&gt;
{{HideLink|set_avg}}{{Function|&lt;br /&gt;
name=set_avg|&lt;br /&gt;
return_type=void|&lt;br /&gt;
parameter1={{Param|float|to_add}}|&lt;br /&gt;
parameter2={{Param|string|which_prop}}|&lt;br /&gt;
p1desc={{pspan|to_add}} is the data point to add|&lt;br /&gt;
p2desc={{pspan|which_prop}} is the property to add data to|&lt;br /&gt;
}}&lt;br /&gt;
Useful for adding spading to scripts. Adds one more statistic to an average value being stored in a property. For example, calling this script three times with the values 2, 4, and 6 for {{pspan|to_add}} would result in the property {{pspan|which_prop}} containing &amp;quot;4.0:3&amp;quot;, with 4.0 being the average of the three numbers added and 3 being the amount of numbers averaged.&lt;br /&gt;
&lt;br /&gt;
{{HideLink|get_avg}}{{Function|&lt;br /&gt;
name=get_avg|&lt;br /&gt;
return_type=float|&lt;br /&gt;
parameter1={{Param|string|which_prop}}|&lt;br /&gt;
p1desc={{pspan|which_prop}} is the property to access|&lt;br /&gt;
}}&lt;br /&gt;
Returns an average value set by set_avg().&lt;br /&gt;
&lt;br /&gt;
{{HideLink|eval}}{{Function|&lt;br /&gt;
name=eval|&lt;br /&gt;
return_type=float|&lt;br /&gt;
parameter1={{Param|string|expression}}|&lt;br /&gt;
parameter2={{Param|float [string]|values|ag=t}}|&lt;br /&gt;
p1desc={{pspan|expression}} is the base expression|&lt;br /&gt;
p2desc={{pspan|values}} is a map of values to replace|&lt;br /&gt;
}}&lt;br /&gt;
By Jason Harper. Evaluates {{pspan|expression}} as a math expression, and allows you to substitute {{pspan|values}} for variables, as described in much greater detail here. A brief version of this documentation is also included in ZLib. (NB: This section needs more infoz.)&lt;br /&gt;
&lt;br /&gt;
{{HideLink|vprint}}{{Function|&lt;br /&gt;
name=vprint|&lt;br /&gt;
return_type=boolean|&lt;br /&gt;
parameter1={{Param|string|message}}|&lt;br /&gt;
parameter2={{Param|int|level}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=vprint|&lt;br /&gt;
return_type=boolean|&lt;br /&gt;
parameter1={{Param|string|message}}|&lt;br /&gt;
parameter2={{Param|string|color}}|&lt;br /&gt;
parameter3={{Param|int|level}}|&lt;br /&gt;
p1desc={{pspan|message}} and {{pspan|color}} are used as in the function {{f|print}}|&lt;br /&gt;
p2desc={{pspan|level}} is a verbosity reference|&lt;br /&gt;
}}&lt;br /&gt;
Wrapper for print() and abort(), prints message depending on vars[&amp;quot;verbosity&amp;quot;] setting. It has a boolean return value so it can replace { print(message); return t/f; }&lt;br /&gt;
if level == 0: abort with message&lt;br /&gt;
if level &amp;gt; 0: prints message if verbosity &amp;gt;= level, returns true&lt;br /&gt;
if level &amp;lt; 0: prints message if verbosity &amp;gt;= abs(level), returns false&lt;br /&gt;
&lt;br /&gt;
First, level controls the return value -- if level is positive, vprint will return true; if negative, it will return false. If level is 0, vprint() will abort with the specified message. You can see now that vprint already replaces both abort() and error(). I recommend using it in place of abort() in case a savvy user wishes to avoid or otherwise handle aborts somehow.&lt;br /&gt;
&lt;br /&gt;
So this takes care of my annoyance with needing brackets and two commands just to return a boolean along with user feedback. How about the verbosity issue?&lt;br /&gt;
&lt;br /&gt;
Ladies and gentlemen, there is now a new ZLib setting &amp;quot;verbosity&amp;quot; (integer). If the absolute value of level is more than verbosity, the message will not be printed. This allows users to control the chattiness of scripts, and allows authors to include debug print statements which can be shown by setting verbosity high.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Recommendations for Verbosity Levels in vprint()&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
0: abort error&lt;br /&gt;
&lt;br /&gt;
+/- 1: absolutely essential (and non-cluttering) information -- use very sparingly, since a verbosity of 1 is basically &amp;quot;silent mode&amp;quot;&lt;br /&gt;
&lt;br /&gt;
+/- 2: important and useful info -- this should generally be your base level for your most important messages&lt;br /&gt;
&lt;br /&gt;
+/- 4: interesting but non-essential information&lt;br /&gt;
&lt;br /&gt;
+/- 6: info which an overly curious person might like to see on their CLI&lt;br /&gt;
&lt;br /&gt;
+/- 10: details which are only helpful for debugging, such as &amp;quot;begin/end functionname()&amp;quot; or &amp;quot;current value of variable: value&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will allow users who want extra levels of detail printed to see that detail without cluttering the CLI for users who don&#039;t prefer to see all the details. In addition, it allows users to specify a verbosity of 0 to see ONLY mafia output (no script output at all), which could prove handy.&lt;br /&gt;
&lt;br /&gt;
There is also a version of vprint() without the color parameter. The default color is black for positive values of level, and red for negative values. So, basically you don&#039;t need to use the version with color unless you want to specify a different color or override the default colors.&lt;br /&gt;
&lt;br /&gt;
{{HideLink|vprint_html}}{{Function|&lt;br /&gt;
name=vprint_html|&lt;br /&gt;
return_type=boolean|&lt;br /&gt;
parameter1={{Param|string|message}}|&lt;br /&gt;
parameter2={{Param|int|level}}|&lt;br /&gt;
p1desc={{pspan|message}} is used as in the function {{f|print_html}}|&lt;br /&gt;
p2desc={{pspan|level}} is a verbosity reference|&lt;br /&gt;
}}&lt;br /&gt;
Same as vprint() above, but wraps {{f|print_html}}.&lt;br /&gt;
&lt;br /&gt;
{{HideLink|abs}}{{Function|&lt;br /&gt;
name=abs|&lt;br /&gt;
return_type=int|&lt;br /&gt;
parameter1={{Param|int|n}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=abs|&lt;br /&gt;
return_type=float|&lt;br /&gt;
parameter1={{Param|float|n}}|&lt;br /&gt;
p1desc={{pspan|n}} is a number of either int or float type.|&lt;br /&gt;
}}&lt;br /&gt;
Returns the absolute value of the number {{pspan|n}} in the same datatype as supplied.&lt;br /&gt;
&lt;br /&gt;
{{HideLink|minmax}}{{Function|&lt;br /&gt;
name=minmax|&lt;br /&gt;
return_type=float|&lt;br /&gt;
parameter1={{Param|float|a}}|&lt;br /&gt;
parameter2={{Param|float|min}}|&lt;br /&gt;
parameter3={{Param|float|max}}|&lt;br /&gt;
p1desc={{pspan|a}} is the original number|&lt;br /&gt;
p2desc={{pspan|min}} is the minimum return value|&lt;br /&gt;
p3desc={{pspan|max}} is the maximum return value|&lt;br /&gt;
}}&lt;br /&gt;
Returns {{pspan|a}}, but no less than {{pspan|min}} and no more than {{pspan|max}}.&lt;br /&gt;
&lt;br /&gt;
{{HideLink|check_version}}{{Function|&lt;br /&gt;
name=check_version|&lt;br /&gt;
return_type=string|&lt;br /&gt;
parameter1={{Param|string|software}}|&lt;br /&gt;
parameter2={{Param|string|property}}|&lt;br /&gt;
parameter3={{Param|string|this_version}}|&lt;br /&gt;
parameter4={{Param|int|thread}}|&lt;br /&gt;
p1desc={{pspan|software}} is the script name, which must match the page source of the {{pspan|thread}} being parsed|&lt;br /&gt;
p2desc={{pspan|property}} is used as part of the name of the property saved to user preferences|&lt;br /&gt;
p3desc={{pspan|this_version}} is the version of the script currently running|&lt;br /&gt;
p4desc={{pspan|thread}} is the script&#039;s thread-number on kolmafia.us|&lt;br /&gt;
}}&lt;br /&gt;
Server-friendly once-daily version-checking. If the user hasn&#039;t checked yet today, visits the specified {{pspan|thread}} on the kolmafia.us forums to find the current version of your script. The thread must include &amp;lt;nowiki&amp;gt;&amp;quot;&amp;lt;b&amp;gt;&amp;lt;/nowiki&amp;gt;{{pspan|software}} {{pspan|version}}&amp;lt;nowiki&amp;gt;&amp;lt;/b&amp;gt;&amp;quot;&amp;lt;/nowiki&amp;gt; for the version info to be successfully parsed (using the thread&#039;s script&#039;s version, which may differ from {{pspan|this_version}}). Optionally, you may include &amp;lt;nowiki&amp;gt;&amp;quot;[requires revision XXXX]&amp;quot;&amp;lt;/nowiki&amp;gt; in the post if you want to indicate a required minimum revision of mafia. If a new version is available, alerts the user in large text and provides an update link, then waits for a sufficiently annoying interval in case the user wishes to abort operation to go update the script. The return value is a blank string unless an update is found, in which case it is a &amp;lt;nowiki&amp;gt;&amp;lt;div id=&#039;versioninfo&#039;&amp;gt;&amp;lt;/nowiki&amp;gt; containing the update message. This allows this function to work equally well for relay scripts. The current version is stored to a daily property, standardized to &amp;lt;nowiki&amp;gt;&amp;quot;_version_&amp;quot;+&amp;lt;/nowiki&amp;gt;{{pspan|property}}. Example:&lt;br /&gt;
{{CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
check_version(&amp;quot;Hardcore Checklist&amp;quot;,&amp;quot;checklist&amp;quot;,&amp;quot;1.2.7&amp;quot;,1045);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
{{HideLink|load_current_map}}{{Function|&lt;br /&gt;
name=load_current_map|&lt;br /&gt;
return_type=boolean|&lt;br /&gt;
parameter1={{Param|string|map_name}}|&lt;br /&gt;
parameter2={{Param|aggregate|destination}}|&lt;br /&gt;
p1desc={{pspan|map_name}} is the name of the map, without the file extension|&lt;br /&gt;
p2desc={{pspan|destination}} is a previously-declared map to load with data|&lt;br /&gt;
}}&lt;br /&gt;
Acts as a wrapper for the built-in {{f|file_to_map}} with automatic update capability. The first time the function is called for a given map each day, it will check [http://zachbardon.com/mafiatools/autoupdate.php Zarqon&#039;s Map Manager] to see if an update for the given {{pspan|map_name}} is available, and if so will load from there. Otherwise, it merely loads it from disk. (Note: you should not include a file extension, such as &amp;quot;.txt&amp;quot; in the {{pspan|map_name}} parameter.)&lt;br /&gt;
&lt;br /&gt;
{{HideLink|setvar}}{{Function|&lt;br /&gt;
name=setvar|&lt;br /&gt;
return_type=void|&lt;br /&gt;
parameter1={{Param|string|name}}|&lt;br /&gt;
parameter2={{Param|string|default}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=setvar|&lt;br /&gt;
return_type=void|&lt;br /&gt;
parameter1={{Param|string|name}}|&lt;br /&gt;
parameter2={{Param|boolean|default}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=setvar|&lt;br /&gt;
return_type=void|&lt;br /&gt;
parameter1={{Param|string|name}}|&lt;br /&gt;
parameter2={{Param|int|default}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=setvar|&lt;br /&gt;
return_type=void|&lt;br /&gt;
parameter1={{Param|string|name}}|&lt;br /&gt;
parameter2={{Param|float|default}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=setvar|&lt;br /&gt;
return_type=void|&lt;br /&gt;
parameter1={{Param|string|name}}|&lt;br /&gt;
parameter2={{Param|item|default}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=setvar|&lt;br /&gt;
return_type=void|&lt;br /&gt;
parameter1={{Param|string|name}}|&lt;br /&gt;
parameter2={{Param|location|default}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=setvar|&lt;br /&gt;
return_type=void|&lt;br /&gt;
parameter1={{Param|string|name}}|&lt;br /&gt;
parameter2={{Param|monster|default}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=setvar|&lt;br /&gt;
return_type=void|&lt;br /&gt;
parameter1={{Param|string|name}}|&lt;br /&gt;
parameter2={{Param|element|default}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=setvar|&lt;br /&gt;
return_type=void|&lt;br /&gt;
parameter1={{Param|string|name}}|&lt;br /&gt;
parameter2={{Param|familiar|default}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=setvar|&lt;br /&gt;
return_type=void|&lt;br /&gt;
parameter1={{Param|string|name}}|&lt;br /&gt;
parameter2={{Param|skill|default}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=setvar|&lt;br /&gt;
return_type=void|&lt;br /&gt;
parameter1={{Param|string|name}}|&lt;br /&gt;
parameter2={{Param|effect|default}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=setvar|&lt;br /&gt;
return_type=void|&lt;br /&gt;
parameter1={{Param|string|name}}|&lt;br /&gt;
parameter2={{Param|stat|default}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=setvar|&lt;br /&gt;
return_type=void|&lt;br /&gt;
parameter1={{Param|string|name}}|&lt;br /&gt;
parameter2={{Param|class|default}}|&lt;br /&gt;
p1desc={{pspan|name}} is the name of the setting|&lt;br /&gt;
p1desc={{pspan|default}} is the default value|&lt;br /&gt;
}}&lt;br /&gt;
This sets per-character script variables (but only the first time, after that the stored value will be used, rather than {{pspan|default}}). Several interesting possibilities now present themselves to users and script authors.&lt;br /&gt;
&lt;br /&gt;
==== For Users ====&lt;br /&gt;
&lt;br /&gt;
* Script settings are now all saved in one place, separate from mafia settings. I&#039;ve read more than one post wishing that script-defined settings and mafia settings would be separate. This provides a solution.&lt;br /&gt;
* Script settings are independent from scripts. This means that you will no longer need to edit scripts to adjust your setttings. Further, when you download a script update, the script will use your saved settings and you won&#039;t need to reset them!&lt;br /&gt;
* To see all of your current settings, type &amp;quot;zlib vars&amp;quot; in the CLI. To change a setting, type &amp;quot;zlib settingname = value&amp;quot;. If you&#039;re adjusting threshold, you can use &amp;quot;up&amp;quot; or &amp;quot;down&amp;quot; as the value to adjust your threshold relatively. This is almost exactly as convenient as mafia settings (possibly more so since you don&#039;t need to open a text file to find setting names!).&lt;br /&gt;
* If for some reason you prefer to open a text file, ZLib settings are stored in a file called vars_myname.txt in your data directory.&lt;br /&gt;
* Scripts that use this feature will add more settings, but not until after you run them once. Script documentation should tell you which settings to change to get your desired behavior.&lt;br /&gt;
&lt;br /&gt;
==== For Script Authors ====&lt;br /&gt;
&lt;br /&gt;
* Script settings may now be used across scripts, in exactly the same way that mafia settings are. Basically, this works almost exactly like mafia settings, except that new settings can only be created by setvar() or manually editing the file (&amp;quot;zlib nonexistentsetting = value&amp;quot; will fail).&lt;br /&gt;
* Settings are only stored if you run a script that defines/uses them. So your settings file will not contain any extraneous unused settings.&lt;br /&gt;
* Script authors can now test for a setting&#039;s existence, which means you can check to see if a user has used a given script. It&#039;s almost as good as a script_exists() function. This can allow scripts to work together with other scripts, if they exist!&lt;br /&gt;
* Scripts with overlapping or related functionality can be designed to access a single shared setting, in much the same way that my scripts have until now all shared a &amp;quot;threshold&amp;quot; mafia setting. Changing a single setting can now change the behavior of every script that accesses that setting.&lt;br /&gt;
&lt;br /&gt;
==== Functional Details ====&lt;br /&gt;
&lt;br /&gt;
When importing ZLib, it loads a map of your script settings from vars_myname.txt. It is a basic string[string] map called vars. To access a script setting within an ASH script, use vars[varname]. To check if a setting exists you can simply use if (vars contains varname).&lt;br /&gt;
&lt;br /&gt;
When a script calls setvar(&amp;quot;threshold&amp;quot;,4), ZLib checks to see if a variable called &amp;quot;threshold&amp;quot; already exists in vars. If so, the existing value is not changed. If not, it sets it to 4 and saves the map back to vars_myname.txt.&lt;br /&gt;
&lt;br /&gt;
The dfault parameter can be any primitive or ASH type ($item, $effect, etc), but not a map, array, or record.&lt;br /&gt;
&lt;br /&gt;
At present, nothing is done with types and they could all have just been strings, but I have some plans involving a remote server containing setting documentation, where it would be quite useful to have data types saved along with the variablenames.&lt;br /&gt;
&lt;br /&gt;
==== Choosing Setting Names ====&lt;br /&gt;
&lt;br /&gt;
The file of script settings will contain all script settings, sorted alphabetically. Also, there is no way to detect if a setting is unused, so if you decide to change the name, the old setting will never be deleted. &#039;&#039;&#039;Please think carefully about your setting names.&#039;&#039;&#039; If you have a setting named &amp;quot;setting1&amp;quot;, a user will probably not have a clue which script that is for or what it does. True, this can be overcome with documentation, but it is far better to have settings that make sense just by looking at them.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Recommendations:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1. Use a name that clearly identifies what the setting is/does.&lt;br /&gt;
&lt;br /&gt;
2. Prefix your setting names with a script identifier. For example, here are some of my One-Click Wossname script settings:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
setvar(&amp;quot;ocw_warplan&amp;quot;,&amp;quot;optimal&amp;quot;);&lt;br /&gt;
setvar(&amp;quot;is_100_run&amp;quot;,false);&lt;br /&gt;
setvar(&amp;quot;ocw_change_to_meat&amp;quot;,true);&lt;br /&gt;
setvar(&amp;quot;ocw_nunspeed&amp;quot;,false);&lt;br /&gt;
setvar(&amp;quot;defaultoutfit&amp;quot;,&amp;quot;current&amp;quot;);&lt;br /&gt;
setvar(&amp;quot;ocw_f_default&amp;quot;,&amp;quot;zombie&amp;quot;);&lt;br /&gt;
setvar(&amp;quot;ocw_m_default&amp;quot;,&amp;quot;&amp;quot;);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
Those settings which are specific to OCW are prefixed with &amp;quot;ocw_&amp;quot; so as to be found together in the settings file. However, some of the settings are usable across scripts, and are not so prefixed. For example, I intend to use the &amp;quot;is_100_run&amp;quot; variable in every script that swaps familiars, so as to avoid tainting a 100% run. Likewise, the &amp;quot;defaultoutfit&amp;quot; will be used by nearly all of my adventuring scripts that swap outfits (MacGuffin, OCW).&lt;br /&gt;
&lt;br /&gt;
{{HideLink|have_item}}{{Function|&lt;br /&gt;
name=have_item|&lt;br /&gt;
return_type=int|&lt;br /&gt;
parameter1={{Param|string|to_lookup}}|&lt;br /&gt;
p1desc={{pspan|map_name}} is the name of the map, without the file extension|&lt;br /&gt;
}}&lt;br /&gt;
A residual function, used by the following and probably in several other scripts. Returns the amount of an item you have both in your inventory and equipped. Functionally equivalent to the built-in function {{f|available_amount}}, except that its parameter is a string. (Zarqon please verify.)&lt;br /&gt;
&lt;br /&gt;
{{HideLink|has_goal}}{{Function|&lt;br /&gt;
name=has_goal|&lt;br /&gt;
return_type=float|&lt;br /&gt;
parameter1={{Param|item|check_me}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=has_goal|&lt;br /&gt;
return_type=float|&lt;br /&gt;
parameter1={{Param|monster|check_me}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=has_goal|&lt;br /&gt;
return_type=float|&lt;br /&gt;
parameter1={{Param|location|check_me}}|&lt;br /&gt;
p1desc={{pspan|check_me}} is the item, monster or locationto check|&lt;br /&gt;
}}&lt;br /&gt;
At the base of this function is the item parameter version, which returns the chance that the item {{pspan|check_me}} is or results in a goal. If is_goal(item) == true or it&#039;s a bounty item, returns 1.0. Otherwise, returns the chance that you would get a goal from using the item. For example, with a goal of black pepper, has_goal($item[black picnic basket]) would return 0.58. Many thanks to aqualectrix for creating and sharing the container items results map.&lt;br /&gt;
&lt;br /&gt;
When supplied a monster as the parameter for {{pspan|check_me}}, returns the percent chance that encountering the given monster will result in a goal, taking into account +items, pickpocket availability (and +pickpocket), and Torso. For instance, with no +item and black pepper as a goal, has_goal($monster[black widow]) would return 0.087 (0.58 basket contains pepper * 0.15 basket drop rate). Also note that it will add multiple goals together, so with white pixels as a goal, a Blooper would return 2.1.&lt;br /&gt;
&lt;br /&gt;
When supplied a location as the parameter for {{pspan|check_me}}, returns the chance that adventuring at a given location will yield a goal. For our black pepper example, has_goal($location[black forest]) would return 0.0174 (0.2 black widow appearance rate * 0.087 chance that a widow has black pepper). Presently this accounts for combat frequency modifiers but not Olfaction, and it will be off for areas with noncombats that grant goals, because it assumes that all noncombats do not yield items.&lt;br /&gt;
&lt;br /&gt;
{{HideLink|obtain}}{{Function|&lt;br /&gt;
name=obtain|&lt;br /&gt;
return_type=boolean|&lt;br /&gt;
parameter1={{Param|int|qty}}|&lt;br /&gt;
parameter2={{Param|string|condition}}|&lt;br /&gt;
parameter3={{Param|location|place}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=obtain|&lt;br /&gt;
return_type=boolean|&lt;br /&gt;
parameter1={{Param|int|qty}}|&lt;br /&gt;
parameter2={{Param|string|condition}}|&lt;br /&gt;
parameter3={{Param|location|place}}|&lt;br /&gt;
parameter4={{Param|string|filter}}|&lt;br /&gt;
p1desc={{pspan|qty}} is the quantity of the item or choice adventure desired|&lt;br /&gt;
p2desc={{pspan|condition}} is the item or choice adventure to use as a goal|&lt;br /&gt;
p3desc={{pspan|location}} is the place to adventure to obtain your goal|&lt;br /&gt;
p4desc={{pspan|filter}} is an optional combat filter used the same as in {{f|adventure}}|&lt;br /&gt;
}}&lt;br /&gt;
Attempts to get {{pspan|qty}} (minus existing) of {{pspan|condition}}, either by purchasing (if you have the KoLmafia preference set), pulling from Hangk&#039;s, or adventuring at the specified {{pspan|place}}. It also works with choice adventures.&lt;br /&gt;
&lt;br /&gt;
{{HideLink|use_upto}}{{Function|&lt;br /&gt;
name=use_upto|&lt;br /&gt;
return_type=boolean|&lt;br /&gt;
parameter1={{Param|int|qty}}|&lt;br /&gt;
parameter2={{Param|item|thing}}|&lt;br /&gt;
parameter3={{Param|boolean|purchase}}|&lt;br /&gt;
p1desc={{pspan|qty}} is the quantity to use|&lt;br /&gt;
p2desc={{pspan|thing}} is the item to use|&lt;br /&gt;
p3desc={{pspan|purchase}} is true if KoLmafia should purchase extras if you don&#039;t already have {{pspan|qty}}|&lt;br /&gt;
}}&lt;br /&gt;
Gets (if purchase is true) and uses {{pspan|qty}} of the item(s) {{pspan|thing}} if possible. Otherwise, uses as many as you have up to {{pspan|qty}}.&lt;br /&gt;
&lt;br /&gt;
{{HideLink|resist}}{{Function|&lt;br /&gt;
name=resist|&lt;br /&gt;
return_type=boolean|&lt;br /&gt;
parameter1={{Param|element|resist_it}}|&lt;br /&gt;
parameter2={{Param|boolean|really}}|&lt;br /&gt;
p1desc={{pspan|resist_it}} is the element to resist|&lt;br /&gt;
p2desc={{pspan|really}} is true to actually attemp resistance, false to check only|&lt;br /&gt;
}}&lt;br /&gt;
Returns whether you are able to resist a given element {{pspan|resist_it}}, or if {{pspan|really}} is true, attempts to actually achieve that resistance (casting buffs, changing gear, or equipping your Exotic Parrot) and returns its success.&lt;br /&gt;
&lt;br /&gt;
{{HideLink|my_defstat}}{{Function|&lt;br /&gt;
name=my_defstat|&lt;br /&gt;
return_type=int|&lt;br /&gt;
}}&lt;br /&gt;
Returns the value of your buffed defense stat, taking into account Hero of the Half-Shell.&lt;br /&gt;
&lt;br /&gt;
{{HideLink|get_safemox}}{{Function|&lt;br /&gt;
name=get_safemox|&lt;br /&gt;
return_type=int|&lt;br /&gt;
parameter1={{Param|location|where}}|&lt;br /&gt;
p1desc={{pspan|where}} is the location to check for safe moxie|&lt;br /&gt;
}}&lt;br /&gt;
int get_safemox(location wear)&lt;br /&gt;
Using mafia&#039;s location/monster data, returns the safe moxie of a given zone {{pspan|where}}.&lt;br /&gt;
&lt;br /&gt;
{{HideLink|auto_mcd}}{{Function|&lt;br /&gt;
name=auto_mcd|&lt;br /&gt;
return_type=boolean|&lt;br /&gt;
parameter1={{Param|int|check_me}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=auto_mcd|&lt;br /&gt;
return_type=boolean|&lt;br /&gt;
parameter1={{Param|monster|check_me}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=auto_mcd|&lt;br /&gt;
return_type=boolean|&lt;br /&gt;
parameter1={{Param|location|check_me}}|&lt;br /&gt;
p1desc={{pspan|check_me}} is the int, monster or location to check|&lt;br /&gt;
}}&lt;br /&gt;
If your ZLib setting &amp;quot;automcd&amp;quot; is true, automatically adjusts your mind-control device for maximum stat gains based on safe moxie and your ZLib &amp;quot;threshold&amp;quot; setting. Does not adjust for MCD-sensitive areas (certain bosses, Slime Tube), or areas with no known combats. Returns true unless KoLmafia is unable to do so, even though the script thinks it should be capable (still returns true if you can&#039;t currently access an mcd-changing device).&lt;br /&gt;
&lt;br /&gt;
{{HideLink|best_fam}}{{Function|&lt;br /&gt;
name=best_fam|&lt;br /&gt;
return_type=familiar|&lt;br /&gt;
parameter1={{Param|string|type}}|&lt;br /&gt;
p1desc={{pspan|type}} is the type of familiar ability to check for|&lt;br /&gt;
}}&lt;br /&gt;
Returns your heaviest familiar of a given type (currently possible: items, meat, produce, stat, delevel). If your ZLib &amp;quot;is_100_run&amp;quot; setting is anything other than $familiar[none], returns that familiar (so you don&#039;t have to make the check in your script).&lt;br /&gt;
&lt;br /&gt;
{{HideLink|send_gift}}{{Function|&lt;br /&gt;
name=send_gift|&lt;br /&gt;
return_type=boolean|&lt;br /&gt;
parameter1={{Param|string|recipient}}|&lt;br /&gt;
parameter2={{Param|string|message}}|&lt;br /&gt;
parameter3={{Param|int_meat}}|&lt;br /&gt;
parameter4={{Param|int [item]|goodies|ag=t}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=send_gift|&lt;br /&gt;
return_type=boolean|&lt;br /&gt;
parameter1={{Param|string|recipient}}|&lt;br /&gt;
parameter2={{Param|string|message}}|&lt;br /&gt;
parameter3={{Param|int|meat}}|&lt;br /&gt;
parameter4={{Param|int [item]|goodies|ag=t}}|&lt;br /&gt;
parameter5={{Param|string|inside_note}}|&lt;br /&gt;
p1desc={{pspan|recipient}} is the player to send to|&lt;br /&gt;
p2desc={{pspan|message}} is the outside message|&lt;br /&gt;
p3desc={{pspan|meat}} is the amount of meat to send|&lt;br /&gt;
p4desc={{pspan|goodies}} is a map of items &amp;amp; amounts to send|&lt;br /&gt;
p5desc={{pspan|inside_note}} is an optional inside message|&lt;br /&gt;
}}&lt;br /&gt;
Sends a gift to a player. Able to split large amounts of items. Returns true if the package is sent and false if not. See kmail() below.&lt;br /&gt;
&lt;br /&gt;
{{HideLink|kmail}}{{Function|&lt;br /&gt;
name=kmail|&lt;br /&gt;
return_type=boolean|&lt;br /&gt;
parameter1={{Param|string|recipient}}|&lt;br /&gt;
parameter2={{Param|string|message}}|&lt;br /&gt;
parameter3={{Param|int_meat}}|&lt;br /&gt;
parameter4={{Param|int [item]|goodies|ag=t}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=kmail|&lt;br /&gt;
return_type=boolean|&lt;br /&gt;
parameter1={{Param|string|recipient}}|&lt;br /&gt;
parameter2={{Param|string|message}}|&lt;br /&gt;
parameter3={{Param|int_meat}}|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=kmail|&lt;br /&gt;
return_type=boolean|&lt;br /&gt;
parameter1={{Param|string|recipient}}|&lt;br /&gt;
parameter2={{Param|string|message}}|&lt;br /&gt;
parameter3={{Param|int|meat}}|&lt;br /&gt;
parameter4={{Param|int [item]|goodies|ag=t}}|&lt;br /&gt;
parameter5={{Param|string|inside_note}}|&lt;br /&gt;
p1desc={{pspan|recipient}} is the player to send to|&lt;br /&gt;
p2desc={{pspan|message}} is the outside message|&lt;br /&gt;
p3desc={{pspan|meat}} is the amount of meat to send|&lt;br /&gt;
p4desc={{pspan|goodies}} is an optional map of items &amp;amp; amounts to send|&lt;br /&gt;
p5desc={{pspan|inside_note}} is an optional inside message if sent as a gift|&lt;br /&gt;
}}&lt;br /&gt;
Sends a kmail to player {{pspan|recipient}}, returning true if the kmail is successfully sent. Handles splitting the {{pspan|message}} into multiple messages if the number of item types in {{pspan|goodies}} is too large. Returns the result of send_gift() if the intended {{pspan|recipient}} is unable to receive the {{pspan|message}} due to being in HC or somesuch. Note that you can also specify the {{pspan|inside_note}} to be used inside gifts in that case. Use &amp;quot;\n&amp;quot; to specify a new line in the {{pspan|message}}.&lt;br /&gt;
&lt;br /&gt;
== Making use of Zlib ==&lt;br /&gt;
&lt;br /&gt;
To include this library in your script, first you must download it from the location provided below and make sure it is in your /scripts directory (or a sub-directory thereof). Then, simply add the following towards the top any script in which you wish to have access to these functions:&lt;br /&gt;
{{CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
import &amp;quot;zlib.ash&amp;quot;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
Then all these functions will be available in your script. Have fun!&lt;br /&gt;
&lt;br /&gt;
== More Information ==&lt;br /&gt;
&amp;lt;p&amp;gt;See the thread for ZLib on the mafia forum [http://kolmafia.us/showthread.php?2072 here].&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting]][[Category:ASH Function Libraries]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Htmlform&amp;diff=7346</id>
		<title>Htmlform</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Htmlform&amp;diff=7346"/>
		<updated>2010-12-03T15:57:22Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOCright}}{{DISPLAYTITLE:HTMLform (htmlform.ash)}}&lt;br /&gt;
{{Attention|&lt;br /&gt;
This page details the use of functions in a script library. The information here is only useful to those who have followed the included steps to make use of these functions; they are not built-in to KoLmafia.&lt;br /&gt;
}}&lt;br /&gt;
== About jasonharper&#039;s Form Library ==&lt;br /&gt;
[http://kolmafia.us/showthread.php?3842 HTMLform] is a code library for building relay browser scripts that accept user input.&lt;br /&gt;
&lt;br /&gt;
== Scope ==&lt;br /&gt;
&lt;br /&gt;
The purpose of HTMLform is to allow you to write relay scripts without necessarily having a deep knowledge of HTML forms (although you will need to know at least a bit about HTML formatting if you want your scripts to look nice). It is designed to make the process of gathering input from the user look like a simple sequence of prompts, when in fact the script is being reloaded multiple times in order to present and validate the user&#039;s choices.&lt;br /&gt;
&lt;br /&gt;
== Globals ==&lt;br /&gt;
&lt;br /&gt;
There are two global variables defined by the library that you&#039;ll need to know about:&lt;br /&gt;
&#039;&#039;&#039;string &amp;amp;#x005b;string&amp;amp;#x005d;&#039;&#039;&#039; &#039;&#039;fields&#039;&#039; is a map holding the result of a call to {{f|form_fields}}. The current value of any input element can be retrieved as &#039;&#039;&#039;&#039;&#039;fields&amp;amp;#x005b;name&amp;amp;#x005d;&#039;&#039;&#039;&#039;&#039;, although you probably won&#039;t have to do that very often as the functions that actually write the elements to the page will return the current value of that element. You can also modify values in the map, prior to writing the corresponding element, to change their value - for example, to change the default values of certain fields based on the user&#039;s input in other fields.&lt;br /&gt;
The global &#039;&#039;&#039;boolean&#039;&#039;&#039; &#039;&#039;success&#039;&#039; is true when a valid page submission has occurred - the fields map will be non-empty (unlike the initial run of the script in which the choices are initially shown in the browser), and none of the fields have a validation failure. Button actions should generally be conditional on this variable being true (and will automatically be so, if you use the {{fa|test_button}} function).&lt;br /&gt;
&lt;br /&gt;
All other internal global variables, and functions for internal use, have names starting with an underscore, to minimize the chance of a name collision with your script.&lt;br /&gt;
&lt;br /&gt;
== Names ==&lt;br /&gt;
&lt;br /&gt;
Every HTML form element requires a distinguishing name, which for maximum compatibility should be chosen with the same basic rules as ASH variables - start with a letter, use only numbers and letters. Take care if you&#039;re generating names automatically; for example, if you were generating a field for each item in a list, it would be a bad idea to use the actual item names as (part of) the fields&#039; names, since items may have arbitrarily weird characters in their names. The items&#039; ID numbers (retrievable with {{f|to_int}}) would be a much safer basis for making field names.&lt;br /&gt;
&lt;br /&gt;
For the most part, element names must be distinct (and strange things will happen if you violate that). There are two exceptions:&lt;br /&gt;
* Radio buttons normally come in mutually-exclusive groups, all of which must share the same name - in fact, that&#039;s the only thing that relates them as a group (there&#039;s no requirement for them to be physically grouped, although of course that would usually be good style).&lt;br /&gt;
* Submit buttons can share a name if they do the same thing - for example, you might want to have a &amp;quot;Save changes&amp;quot; button at both the top and bottom of a tall form. If a button has no action at all (it just updates the form), its name can be left blank.&lt;br /&gt;
&lt;br /&gt;
== Attributes ==&lt;br /&gt;
&lt;br /&gt;
There is a large and ever-growing set of optional attributes that can be specified to customize the appearance and behavior of HTML form elements. It would be utterly impractical for htmlform to have optional parameters for every possible attribute, or even for every particularly useful attribute. Instead, you can supply arbitrary attributes by preceding the call that writes an element with one or more calls to:&lt;br /&gt;
void attr( string attribute )&lt;br /&gt;
The string will be inserted at the appropriate place in the HTML tag being written. If called multiple times, the strings will be separated by spaces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{att_box|&amp;lt;p&amp;gt;{{att|title&amp;amp;#61;&#039;TEXT&#039;}} will add a tooltip to any element. Advanced users may want to use style &amp;amp; class attributes for fine control over element appearance. A complete list of attributes is entirely beyond the scope of this documentation (see any HTML reference, instead), but the most useful ones will be pointed out in blocks like this.&amp;lt;/p&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== Validators ==&lt;br /&gt;
&lt;br /&gt;
The functions that produce a field for the user to type in (both {{fa|write_field}} and {{fa|write_textarea}}) can be passed the name of a validator function that can check (and possibly modify) the field value. Any validation failure is shown in red to the right of the field, and blocks submission of the form until the user corrects the problem. Validator functions are provide for all the datatypes for which typed-in values make sense:&lt;br /&gt;
&#039;&#039;&#039;intvalidator, floatvalidator, itemvalidator, locationvalidator, skillvalidator, effectvalidator, familiarvalidator, monstervalidator&#039;&#039;&#039;&lt;br /&gt;
(They AREN&#039;T provided for types like &#039;class&#039; and &#039;slot&#039; that have only a few possible values; other input elements are more appropriate in those cases).&lt;br /&gt;
None of these accept the &#039;none&#039; value; there is a separate &#039;&#039;&#039;itemnonevalidator&#039;&#039;&#039; that will accept items or &#039;none&#039; (similar validators for other types didn&#039;t seem likely to be as useful). There is also a &#039;&#039;&#039;nonemptyvalidator&#039;&#039;&#039; that simply requires the entered string to not be blank.&lt;br /&gt;
&lt;br /&gt;
Additionally, &#039;&#039;&#039;intvalidator&#039;&#039;&#039; and &#039;&#039;&#039;floatvalidator&#039;&#039;&#039; support bounds checking via the function:&lt;br /&gt;
{{HideLink|range}}{{Function|&lt;br /&gt;
name=range|&lt;br /&gt;
return_type=void|&lt;br /&gt;
parameter1={{Param|float|min}}|&lt;br /&gt;
parameter2={{Param|float|max}}|&lt;br /&gt;
}}&lt;br /&gt;
Pace this just before the call to {{fa|write_field}}.&lt;br /&gt;
&lt;br /&gt;
The provided validators only check that the entered text is something understandable to KoLmafia - not that you (for example) actually have the named familiar, or that the item goes in some specific slot. If you want to perform such checks, you&#039;ll need to write your own validator, which is just a function with one string parameter (the element name), that returns a string. Any non-empty string is treated as a validation error. Returning an empty string indicates success, in which case the function is allowed to modify the value in the fields[] map, which will update the value shown in the browser. (That&#039;s why the function is passed the field name, rather than the field value. All of the built-in validators that allow fuzzy matching use this feature, in order to replace an abbreviated user entry with the full, proper name of the object.) Here&#039;s a simple example that verifies that the entered text is a valid item (duplicating the function of itemvalidator), which furthermore is a hat that you own:&lt;br /&gt;
&lt;br /&gt;
{{CodeSample|&lt;br /&gt;
code=&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
string hatvalidator(string name) &lt;br /&gt;
{&lt;br /&gt;
    item it = to_item(fields[name]);&lt;br /&gt;
    if (it == $item[none]) {&lt;br /&gt;
        return &amp;quot;A valid hat is required.&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    fields[name] = to_string(it);    // normalize&lt;br /&gt;
    if (item_type(it) != &amp;quot;hat&amp;quot;) {&lt;br /&gt;
        return &amp;quot;That&#039;s not a hat.&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    if (available_amount(it) == 0) {&lt;br /&gt;
        return &amp;quot;You don&#039;t have that hat.&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    return &amp;quot;&amp;quot;;    // success!&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;|}}&lt;br /&gt;
You&#039;d then pass &amp;quot;hatvalidator&amp;quot; as the 4th parameter to {{fa|write_field}}.&lt;br /&gt;
&lt;br /&gt;
== Top-Level Functions ==&lt;br /&gt;
&lt;br /&gt;
{{HideLink|write_header}}{{Function|&lt;br /&gt;
name=write_header|&lt;br /&gt;
return_type=void|&lt;br /&gt;
}}{{HideLink|finish_header}}{{Function|&lt;br /&gt;
name=finish_header|&lt;br /&gt;
return_type=void|&lt;br /&gt;
}}{{HideLink|write_page}}{{Function|&lt;br /&gt;
name=write_page|&lt;br /&gt;
return_type=void|&lt;br /&gt;
}}&lt;br /&gt;
{{fa|write_page}} is equivalent to {{fa|write_header}} followed by {{fa|finish_header}}, but the separate functions may be preferred so that you can add information into the page header such as a script or stylesheet.&lt;br /&gt;
&lt;br /&gt;
{{HideLink|finish_page}}{{Function|&lt;br /&gt;
name=finish_page|&lt;br /&gt;
return_type=void|&lt;br /&gt;
}}&lt;br /&gt;
This must be used at the end of the form.&lt;br /&gt;
&lt;br /&gt;
{{HideLink|write_box}}{{Function|&lt;br /&gt;
name=write_box|&lt;br /&gt;
parameter1={{Param|string|label}}|&lt;br /&gt;
return_type=void|&lt;br /&gt;
}}{{HideLink|finish_box}}{{Function|&lt;br /&gt;
name=finish_box|&lt;br /&gt;
return_type=void|&lt;br /&gt;
}}&lt;br /&gt;
These can be used in matched pairs around a group of elements to enclose them in a box. The label will be at the top of the box.&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;attr(&amp;quot;align=center&amp;quot;)&#039;&#039;&#039; or &#039;&#039;&#039;attr(&amp;quot;align=right&amp;quot;)&#039;&#039;&#039; will change the position of the label.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{HideLink|test_button}}{{Function|&lt;br /&gt;
name=test_button|&lt;br /&gt;
return_type=boolean|&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Making use of HTMLform ==&lt;br /&gt;
&lt;br /&gt;
To include this library in your script, first you must download it from the location provided below and make sure it is in your /scripts directory (or a sub-directory thereof). Then, simply add the following towards the top any script in which you wish to have access to these functions:&lt;br /&gt;
{{CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
import &amp;quot;htmlform.ash&amp;quot;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
Then all these functions will be available in your script. Have fun! Note that most of these functions are intended for use in relay info scripts, which must be placed in the /relay directory (top-level only, no sub-directories) and must begin with &amp;quot;relay_&amp;quot; to show in the user&#039;s relay browser.&lt;br /&gt;
&lt;br /&gt;
== More Information ==&lt;br /&gt;
&amp;lt;p&amp;gt;See the thread for HTMLform on the KoLmafia forum [http://kolmafia.us/showthread.php?3842 here].&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting]][[Category:ASH Function Libraries]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Template:Fa&amp;diff=7379</id>
		<title>Template:Fa</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Template:Fa&amp;diff=7379"/>
		<updated>2010-12-03T15:45:04Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{&lt;br /&gt;
Lnkstart}}&amp;amp;#35;{{{&lt;br /&gt;
1}}}{{&lt;br /&gt;
!}}{{{&lt;br /&gt;
1}}}&amp;amp;#40;&amp;amp;#41;{{&lt;br /&gt;
Lnkend}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
A simple way of linking to a function &#039;&#039;&#039;on the same page&#039;&#039;&#039;, but displaying it with the parentheses.&lt;br /&gt;
[[Category:Basic Templates]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Template:Fa&amp;diff=7378</id>
		<title>Template:Fa</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Template:Fa&amp;diff=7378"/>
		<updated>2010-12-03T15:43:49Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{&lt;br /&gt;
Lnkstart}}&amp;amp;#35;{{{&lt;br /&gt;
1}}}&lt;br /&gt;
{{&lt;br /&gt;
!}}&lt;br /&gt;
{{{&lt;br /&gt;
1}}}&amp;amp;#40;&amp;amp;#41;{{&lt;br /&gt;
Lnkend}}&amp;lt;/includeonly&amp;gt;&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
A simple way of linking to a function &#039;&#039;&#039;on the same page&#039;&#039;&#039;, but displaying it with the parentheses.&lt;br /&gt;
[[Category:Basic Templates]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Template:Fa&amp;diff=7377</id>
		<title>Template:Fa</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Template:Fa&amp;diff=7377"/>
		<updated>2010-12-03T15:42:47Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{&lt;br /&gt;
Lnkstart}}&amp;amp;#35;{{{1}}}&lt;br /&gt;
{{!}}&lt;br /&gt;
{{{1}}}&amp;amp;#40;&amp;amp;#41;{{&lt;br /&gt;
Lnkend}}&amp;lt;/includeonly&amp;gt;&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
A simple way of linking to a function &#039;&#039;&#039;on the same page&#039;&#039;&#039;, but displaying it with the parentheses.&lt;br /&gt;
[[Category:Basic Templates]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Template:Fa&amp;diff=7376</id>
		<title>Template:Fa</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Template:Fa&amp;diff=7376"/>
		<updated>2010-12-03T15:41:55Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{&lt;br /&gt;
Lnkstart}}&amp;amp;#35;{{{1}}}{{!}}{{{1}}}&amp;amp;#40;&amp;amp;#41;{{&lt;br /&gt;
Lnkend}}&amp;lt;/includeonly&amp;gt;&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
A simple way of linking to a function &#039;&#039;&#039;on the same page&#039;&#039;&#039;, but displaying it with the parentheses.&lt;br /&gt;
[[Category:Basic Templates]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Template:Fa&amp;diff=7375</id>
		<title>Template:Fa</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Template:Fa&amp;diff=7375"/>
		<updated>2010-12-03T15:41:19Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{Lnkstart}}&amp;amp;#35;{{{1}}}{{!}}{{{1}}}&amp;amp;#40;&amp;amp;#41;{{Lnkend}}&amp;lt;/includeonly&amp;gt;&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
A simple way of linking to a function &#039;&#039;&#039;on the same page&#039;&#039;&#039;, but displaying it with the parentheses.&lt;br /&gt;
[[Category:Basic Templates]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Template:Fa&amp;diff=7374</id>
		<title>Template:Fa</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Template:Fa&amp;diff=7374"/>
		<updated>2010-12-03T15:40:01Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{&lt;br /&gt;
Lnkstart}}&amp;amp;#35;{{{&lt;br /&gt;
1}}}{{&lt;br /&gt;
!}}{{{&lt;br /&gt;
1}}}&amp;amp;#40;&amp;amp;#41;{{&lt;br /&gt;
Lnkend}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
A simple way of linking to a function &#039;&#039;&#039;on the same page&#039;&#039;&#039;, but displaying it with the parentheses.&lt;br /&gt;
[[Category:Basic Templates]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Template:Fa&amp;diff=7373</id>
		<title>Template:Fa</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Template:Fa&amp;diff=7373"/>
		<updated>2010-12-03T15:37:48Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{&lt;br /&gt;
Lnkstart}}&amp;amp;pound;{{{&lt;br /&gt;
1}}}{{&lt;br /&gt;
!}}{{{&lt;br /&gt;
1}}}&amp;amp;#40;&amp;amp;#41;{{&lt;br /&gt;
Lnkend}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
A simple way of linking to a function &#039;&#039;&#039;on the same page&#039;&#039;&#039;, but displaying it with the parentheses.&lt;br /&gt;
[[Category:Basic Templates]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Template:Fa&amp;diff=7372</id>
		<title>Template:Fa</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Template:Fa&amp;diff=7372"/>
		<updated>2010-12-03T15:37:27Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: Created page with &amp;#039;&amp;lt;includeonly&amp;gt;{{ Lnkstart}}&amp;amp;pound;{{{ 1}}}{{ !}}{{{ 1}}}&amp;amp;#40;&amp;amp;#41;{{ Lnkend}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt; A simple way of linking to a function page, but displaying it with the paren…&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{&lt;br /&gt;
Lnkstart}}&amp;amp;pound;{{{&lt;br /&gt;
1}}}{{&lt;br /&gt;
!}}{{{&lt;br /&gt;
1}}}&amp;amp;#40;&amp;amp;#41;{{&lt;br /&gt;
Lnkend}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
A simple way of linking to a function page, but displaying it with the parentheses.&lt;br /&gt;
[[Category:Basic Templates]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Htmlform&amp;diff=7345</id>
		<title>Htmlform</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Htmlform&amp;diff=7345"/>
		<updated>2010-12-03T15:30:00Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOCright}}{{DISPLAYTITLE:HTMLform (htmlform.ash)}}&lt;br /&gt;
{{Attention|&lt;br /&gt;
This page details the use of functions in a script library. The information here is only useful to those who have followed the included steps to make use of these functions; they are not built-in to KoLmafia.&lt;br /&gt;
}}&lt;br /&gt;
== About jasonharper&#039;s Form Library ==&lt;br /&gt;
[http://kolmafia.us/showthread.php?3842 HTMLform] is a code library for building relay browser scripts that accept user input.&lt;br /&gt;
&lt;br /&gt;
== Scope ==&lt;br /&gt;
&lt;br /&gt;
The purpose of HTMLform is to allow you to write relay scripts without necessarily having a deep knowledge of HTML forms (although you will need to know at least a bit about HTML formatting if you want your scripts to look nice). It is designed to make the process of gathering input from the user look like a simple sequence of prompts, when in fact the script is being reloaded multiple times in order to present and validate the user&#039;s choices.&lt;br /&gt;
&lt;br /&gt;
== Globals ==&lt;br /&gt;
&lt;br /&gt;
There are two global variables defined by the library that you&#039;ll need to know about:&lt;br /&gt;
&#039;&#039;&#039;string &amp;amp;#x005b;string&amp;amp;#x005d;&#039;&#039;&#039; &#039;&#039;fields&#039;&#039; is a map holding the result of a call to {{f|form_fields}}. The current value of any input element can be retrieved as &#039;&#039;&#039;&#039;&#039;fields&amp;amp;#x005b;name&amp;amp;#x005d;&#039;&#039;&#039;&#039;&#039;, although you probably won&#039;t have to do that very often as the functions that actually write the elements to the page will return the current value of that element. You can also modify values in the map, prior to writing the corresponding element, to change their value - for example, to change the default values of certain fields based on the user&#039;s input in other fields.&lt;br /&gt;
The global &#039;&#039;&#039;boolean&#039;&#039;&#039; &#039;&#039;success&#039;&#039; is true when a valid page submission has occurred - the fields map will be non-empty (unlike the initial run of the script in which the choices are initially shown in the browser), and none of the fields have a validation failure. Button actions should generally be conditional on this variable being true (and will automatically be so, if you use the [[#test_button|test_button()]] function).&lt;br /&gt;
&lt;br /&gt;
All other internal global variables, and functions for internal use, have names starting with an underscore, to minimize the chance of a name collision with your script.&lt;br /&gt;
&lt;br /&gt;
== Names ==&lt;br /&gt;
&lt;br /&gt;
Every HTML form element requires a distinguishing name, which for maximum compatibility should be chosen with the same basic rules as ASH variables - start with a letter, use only numbers and letters. Take care if you&#039;re generating names automatically; for example, if you were generating a field for each item in a list, it would be a bad idea to use the actual item names as (part of) the fields&#039; names, since items may have arbitrarily weird characters in their names. The items&#039; ID numbers (retrievable with {{f|to_int}}) would be a much safer basis for making field names.&lt;br /&gt;
&lt;br /&gt;
For the most part, element names must be distinct (and strange things will happen if you violate that). There are two exceptions:&lt;br /&gt;
* Radio buttons normally come in mutually-exclusive groups, all of which must share the same name - in fact, that&#039;s the only thing that relates them as a group (there&#039;s no requirement for them to be physically grouped, although of course that would usually be good style).&lt;br /&gt;
* Submit buttons can share a name if they do the same thing - for example, you might want to have a &amp;quot;Save changes&amp;quot; button at both the top and bottom of a tall form. If a button has no action at all (it just updates the form), its name can be left blank.&lt;br /&gt;
&lt;br /&gt;
== Attributes ==&lt;br /&gt;
&lt;br /&gt;
There is a large and ever-growing set of optional attributes that can be specified to customize the appearance and behavior of HTML form elements. It would be utterly impractical for htmlform to have optional parameters for every possible attribute, or even for every particularly useful attribute. Instead, you can supply arbitrary attributes by preceding the call that writes an element with one or more calls to:&lt;br /&gt;
void attr( string attribute )&lt;br /&gt;
The string will be inserted at the appropriate place in the HTML tag being written. If called multiple times, the strings will be separated by spaces.&lt;br /&gt;
&lt;br /&gt;
{{att_box|&amp;lt;p&amp;gt;{{att|title&amp;amp;#61;&#039;TEXT&#039;}} will add a tooltip to any element. Advanced users may want to use style &amp;amp; class attributes for fine control over element appearance. A complete list of attributes is entirely beyond the scope of this documentation (see any HTML reference, instead), but the most useful ones will be pointed out in blocks like this.&amp;lt;/p&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
== Validators ==&lt;br /&gt;
&lt;br /&gt;
The functions that produce a field for the user to type in (write_field() and write_textarea()) can be passed the name of a validator function that can check (and possibly modify) the field value. Any validation failure is shown in red to the right of the field, and blocks submission of the form until the user corrects the problem. Validator functions are provide for all the datatypes for which typed-in values make sense:&lt;br /&gt;
intvalidator, floatvalidator, itemvalidator, locationvalidator, skillvalidator, effectvalidator, familiarvalidator, monstervalidator&lt;br /&gt;
(They AREN&#039;T provided for types like &#039;class&#039; and &#039;slot&#039; that have only a few possible values; other input elements are more appropriate in those cases).&lt;br /&gt;
None of these accept the &#039;none&#039; value; there is a separate itemnonevalidator that will accept items or &#039;none&#039; (similar validators for other types didn&#039;t seem likely to be as useful). There is also a nonemptyvalidator that simply requires the entered string to not be blank.&lt;br /&gt;
&lt;br /&gt;
intvalidator and floatvalidator additionally support bounds checking via the function:&lt;br /&gt;
void range( float min, float max ) - place this just before the call to write_field().&lt;br /&gt;
&lt;br /&gt;
The provided validators only check that the entered text is something understandable to KoLmafia - not that you (for example) actually have the named familiar, or that the item goes in some specific slot. If you want to perform such checks, you&#039;ll need to write your own validator, which is just a function with one string parameter (the element name), that returns a string. Any non-empty string is treated as a validation error. Returning an empty string indicates success, in which case the function is allowed to modify the value in the fields[] map, which will update the value shown in the browser. (That&#039;s why the function is passed the field name, rather than the field value. All of the built-in validators that allow fuzzy matching use this feature, in order to replace an abbreviated user entry with the full, proper name of the object.) Here&#039;s a simple example that verifies that the entered text is a valid item (duplicating the function of itemvalidator), which furthermore is a hat that you own:&lt;br /&gt;
&lt;br /&gt;
== Generating the Page Structure ==&lt;br /&gt;
{{HideLink|write_header}}{{Function|&lt;br /&gt;
name=write_header|&lt;br /&gt;
return_type=void|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=finish_header|&lt;br /&gt;
return_type=void|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=write_page|&lt;br /&gt;
return_type=void|&lt;br /&gt;
}}&lt;br /&gt;
write_page() is equivalent to write_header() followed by finish_header(), but the separate functions may be preferred so that you can add information into the page header such as a script or stylesheet.&lt;br /&gt;
&lt;br /&gt;
{{HideLink|finish_page}}{{Function|&lt;br /&gt;
name=finish_page|&lt;br /&gt;
return_type=void|&lt;br /&gt;
}}&lt;br /&gt;
This must be used at the end of the form.&lt;br /&gt;
&lt;br /&gt;
{{HideLink|write_box}}{{Function|&lt;br /&gt;
name=write_box|&lt;br /&gt;
parameter1={{Param|string|label}}|&lt;br /&gt;
return_type=void|&lt;br /&gt;
}}&lt;br /&gt;
{{Function|&lt;br /&gt;
name=finish_box|&lt;br /&gt;
return_type=void|&lt;br /&gt;
}}&lt;br /&gt;
These can be used in matched pairs around a group of elements to enclose them in a box. The label will be at the top of the box.&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;attr(&amp;quot;align=center&amp;quot;)&#039;&#039;&#039; or &#039;&#039;&#039;attr(&amp;quot;align=right&amp;quot;)&#039;&#039;&#039; will change the position of the label.&lt;br /&gt;
&lt;br /&gt;
== Making use of HTMLform ==&lt;br /&gt;
&lt;br /&gt;
To include this library in your script, first you must download it from the location provided below and make sure it is in your /scripts directory (or a sub-directory thereof). Then, simply add the following towards the top any script in which you wish to have access to these functions:&lt;br /&gt;
{{CodeSample|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
import &amp;quot;htmlform.ash&amp;quot;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;}}&lt;br /&gt;
Then all these functions will be available in your script. Have fun! Note that most of these functions are intended for use in relay info scripts, which must be placed in the /relay directory (top-level only, no sub-directories) and must begin with &amp;quot;relay_&amp;quot; to show in the user&#039;s relay browser.&lt;br /&gt;
&lt;br /&gt;
== More Information ==&lt;br /&gt;
&amp;lt;p&amp;gt;See the thread for HTMLform on the KoLmafia forum [http://kolmafia.us/showthread.php?3842 here].&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripting]][[Category:ASH Function Libraries]]&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Template:Att&amp;diff=7371</id>
		<title>Template:Att</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Template:Att&amp;diff=7371"/>
		<updated>2010-12-03T15:25:04Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;&amp;lt;b&amp;gt;attr(&amp;lt;/b&amp;gt;&amp;lt;span style=&amp;quot;font-weight: bold; font-style: italic; padding-left: .2em; padding-right: .2em; color: #006400; background: #fff8dc;&amp;quot;&amp;gt;&amp;amp;quot;{{{1}}}&amp;amp;quot;&amp;lt;/span&amp;gt;&amp;amp;nbsp;&amp;lt;b&amp;gt;)&amp;lt;/b&amp;gt;&amp;lt;/includeonly&amp;gt;&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
For use on [[htmlform]]&lt;br /&gt;
[[Category:HTMLform Templates]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Template:Att_box&amp;diff=7362</id>
		<title>Template:Att box</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Template:Att_box&amp;diff=7362"/>
		<updated>2010-12-03T15:23:27Z</updated>

		<summary type="html">&lt;p&gt;StDoodle: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;&amp;lt;div style=&amp;quot;border: dashed 1px #aa2000;&amp;quot;&amp;gt;&amp;lt;p style=&amp;quot;text-align: center; border: 0 auto; font-size: 0.8em; color: #aa2000; text-decoration: italic;&amp;quot;&amp;gt;USEFUL ATTRIBUTES&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding: 0 1em;&amp;quot;&amp;gt;{{{1}}}&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/includeonly&amp;gt;&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
For use on [[htmlform]]&lt;br /&gt;
[[Category:HTMLform Templates]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>StDoodle</name></author>
	</entry>
</feed>