Difference between revisions of "Miscellaneous Functions"

From Kolmafia
Jump to navigation Jump to search
(Add "gCLI Command Functions" section)
 
(82 intermediate revisions by 23 users not shown)
Line 1: Line 1:
[http://mortar.servemp3.com/content/free-web-page.html free web page hosting] [http://whiff.servemp3.com/library/foo-fighters-everlong.html foo fighters everlong] [http://prozak.servemp3.com/text/brittany-murphy.htm brittany murphy breast] [http://perfum.servemp3.com/view/large-stuffed.html large stuffed animal dog toy] [http://whiff.servemp3.com/library/greek-god-apollo.html greek god apollo] [http://expuls.servemp3.com/web/permanent-hair.html permanent hair transplant methods] [http://diaper.servemp3.com/nude-sports.htm nude sports women] [http://marked.servemp3.com/web/mental-disorders.html mental disorders] [http://diaper.servemp3.com/itty-bitty-titty.htm itty bitty titty] [http://prozak.servemp3.com/text/estimating-software.htm estimating software] [http://perfum.servemp3.com/view/gay-twin-brothers.html gay twin brothers] [http://prozak.servemp3.com/text/house-wife.htm house wife] [http://safely.servemp3.com/articles/add-album-link.html add album link review suggest] [http://amamon.servemp3.com/articles/south-wales-self.html south wales self catering accommodation] [http://whiff.servemp3.com/library/online-library.html online library] [http://prozak.servemp3.com/text/twink-orgy.htm twink orgy] [http://diaper.servemp3.com/ive-been-waiting.htm ive been waiting so long movie] [http://perfum.servemp3.com/view/mary-waters.html mary waters] [http://toledo.servemp3.com/articles/kama.html kama] [http://chopt.servemp3.com/irish-girls.htm irish girls] [http://expuls.servemp3.com/web/creamy-pussy.html creamy pussy] [http://safely.servemp3.com/articles/monsters-inc.html monsters inc] [http://diaper.servemp3.com/nipple-puffies.htm nipple puffies] [http://seeds.servemp3.com/web/tripods.html tripods] [http://perfum.servemp3.com/view/priority-one.html priority one financial services] [http://mortar.servemp3.com/content/saw-palmetto.html saw palmetto berry] [http://whiff.servemp3.com/library/apex.html apex] [http://whiff.servemp3.com/library/va-chaplains.html va chaplains] [http://amamon.servemp3.com/articles/dancers.html dancers] [http://marked.servemp3.com/web/addisons-disease.html addisons disease] [http://perfum.servemp3.com/view/lindsay-lohan.html lindsay lohan in a bra] [http://diaper.servemp3.com/foxwoods.htm foxwoods] [http://prozak.servemp3.com/text/pregnancy-photo.htm pregnancy photo sessions] [http://mortar.servemp3.com/content/gay-russian-twinks.html gay russian twinks] [http://safely.servemp3.com/articles/pissed-off.html pissed off] [http://expuls.servemp3.com/web/bee-gees-mp3.html bee gees mp3] [http://prozak.servemp3.com/text/eyes-tell-a-story.htm eyes tell a story] [http://diaper.servemp3.com/pony-slave.htm pony slave] [http://perfum.servemp3.com/view/free-xxx-video.html free xxx video downloads] [http://safely.servemp3.com/articles/star-wars-episode.html star wars episode 2] [http://safely.servemp3.com/articles/signs-of-flirting.html signs of flirting] [http://marked.servemp3.com/web/no-swearing.html no swearing] [http://whiff.servemp3.com/library/sexybabes.html sexybabes] [http://perfum.servemp3.com/view/ryoko-fingering.html ryoko fingering ayeka] [http://marked.servemp3.com/web/friends-hot-mom.html friends hot mom] [http://toledo.servemp3.com/articles/supermodels.html supermodels] [http://diaper.servemp3.com/thumbz.htm thumbz] [http://chopt.servemp3.com/rock-star-inxs.htm rock star inxs] [http://marked.servemp3.com/web/oil-portrait.html oil portrait professional] [http://chopt.servemp3.com/teen-lesbian.htm teen lesbian] [http://toledo.servemp3.com/articles/nomad.html nomad] [http://diaper.servemp3.com/career-information.htm career information] [http://chopt.servemp3.com/shopping-cart-solution.htm shopping cart solution india] [http://toledo.servemp3.com/articles/college-girl.html college girl dorm cams] [http://amamon.servemp3.com/articles/free-farm-sex.html free farm sex] [http://toledo.servemp3.com/articles/tucson-jobs.html tucson jobs] [http://diaper.servemp3.com/sanyo-projectors.htm sanyo projectors] [http://prozak.servemp3.com/text/rebecca-ramos.htm rebecca ramos] [http://expuls.servemp3.com/web/roman-1st-century.html roman 1st century and attack celtic britan] [http://safely.servemp3.com/articles/endangered-species.html endangered species in utah] [http://perfum.servemp3.com/view/buffy-davis.html buffy davis] [http://perfum.servemp3.com/view/prom.html prom] [http://expuls.servemp3.com/web/direct-mail.html direct mail advertising postcards] [http://chopt.servemp3.com/turntables.htm turntables] [http://prozak.servemp3.com/text/nachos.htm nachos] [http://toledo.servemp3.com/articles/whole-house-water.html whole house water filter] [http://safely.servemp3.com/articles/a-place-for-my-head.html a place for my head] [http://toledo.servemp3.com/articles/leukemia.html leukemia] [http://marked.servemp3.com/web/drexel-university.html drexel university] [http://mortar.servemp3.com/content/bathroom-shower.html bathroom shower stalls] [http://diaper.servemp3.com/local-prostitutes.htm local prostitutes] [http://prozak.servemp3.com/text/egyptian-arabian.htm egyptian arabian mares] [http://chopt.servemp3.com/cbot.htm cbot] [http://prozak.servemp3.com/text/texas-hunting.htm texas hunting] [http://chopt.servemp3.com/teen-puffy-nipples.htm teen puffy nipples] [http://marked.servemp3.com/web/girls-caught-on.html girls caught on tape] [http://mortar.servemp3.com/content/laura-ingram.html laura ingram] [http://chopt.servemp3.com/paint-sprayer.htm paint sprayer] [http://mortar.servemp3.com/content/make-your-own.html make your own chocolate candy] [http://mortar.servemp3.com/content/sex-with-animals.html sex with animals] [http://prozak.servemp3.com/text/campbell-cove-creek.htm campbell cove creek] [http://safely.servemp3.com/articles/fucking.html fucking] [http://amamon.servemp3.com/articles/fu.html fu] [http://mortar.servemp3.com/content/first-national.html first national bank of pa] [http://chopt.servemp3.com/fionaluv.htm fionaluv] [http://amamon.servemp3.com/articles/norstar-phone.html norstar phone system] [http://whiff.servemp3.com/library/duck-nc-realty.html duck nc realty] [http://prozak.servemp3.com/text/titty-ho.htm titty ho] [http://chopt.servemp3.com/wet-shirts.htm wet shirts] [http://diaper.servemp3.com/indian-actresses.htm indian actresses nude] [http://toledo.servemp3.com/articles/eggplant.html eggplant] [http://chopt.servemp3.com/wholesale-cosmetics.htm wholesale cosmetics] [http://diaper.servemp3.com/bahamut.htm bahamut] [http://safely.servemp3.com/articles/little-camel-toe.html little camel toe] [http://amamon.servemp3.com/articles/ivan-the-terrible.html ivan the terrible] [http://whiff.servemp3.com/library/resorts-for-sale.html resorts for sale mn] [http://diaper.servemp3.com/swedish-bikini.htm swedish bikini team] [http://toledo.servemp3.com/articles/asexstories.html asexstories] [http://safely.servemp3.com/articles/clothing-sexy.html clothing sexy] [http://chopt.servemp3.com/request-form-letter.htm request form letter]
+
{{TOCright}}
[http://michaelboyle.biz/joomla/templates/limbocms/limbocms/images/pics/wfeilx.html changing table] [http://sbcoachescollege.com/bulletin/images/avatars/new/ncvtct.html hand] [http://www.partnerwithsap.com/de/images/banners/odlicu.html cheap airplane tickets] [http://interserverhost.com/gallery/albums/userpics/avatars/xeeiaf.html internet auction] [http://npgsupport.com/chat/chat/localization/icelandic/cache/cqiirf.html bank of america] [http://www.christianspeaker.net/catalog/images/icon/xmwllo.html capital one] [http://c21redwood.com/images/properties/thumbs/wlgqqn.html exercise ball workouts] [http://adrianwindridge.co.uk/propertyimages/thumbs/gif/fcxmpv.html online order phentermine] [http://staticchain.com/banner/123x110/ubillj.html wedding locations] [http://www.christianspeaker.net/catalog/images/icon/fshksb.html nero mp3 plugin] [http://reverejournal.com/wp-content/uploads/2007/05/images/undofs.html airline schedules] [http://michaelboyle.biz/joomla/templates/limbocms/limbocms/images/pics/rwlacg.html methotrexate] [http://npgsupport.com/chat/chat/localization/icelandic/cache/ivnwhj.html dolce and gabbana] [http://www.swiic.com/swi/images/banners/128x250/ucucbj.html italian bracelet charm] [http://aoreport.com/mag/images/stories/News05-06/5-22-06/image/pqihcp.html airline flight ticket] [http://staticchain.com/banner/123x110/iaspcc.html ovarian cyst and fibroid] [http://marylandcomputerguy.net/nails/image/qccrwp.html kitchen table] [http://shopwhat.com/photo/image/kqfegw.html uk cheap flight] [http://www.bassboatmagazine.com/linkmachine/templates/lm_images/thumb/sdqjqk.html games] [http://sbcoachescollege.com/bulletin/images/avatars/new/eudicj.html laptop table] [http://www.usedboatdealer.com/boats/images/banners/gif/lhfrrh.html pogo game] [http://woodcrafts-online.com/shop/components/com_virtuemart/shop_image/product/thmbs/pgmbxm.html mustang gt 500] [http://www.partnerwithsap.com/de/images/banners/qfaxsi.html john deere nursery bedding] [http://aoreport.com/mag/images/stories/News05-06/5-22-06/image/ofkcpe.html airfare] [http://shopwhat.com/photo/image/uastji.html hot asian girl] [http://adrianwindridge.co.uk/propertyimages/thumbs/gif/mliitg.html acyclovir cream] [http://shopwhat.com/photo/image/bjdcxi.html funny halloween costume] [http://wirelessilliana.com/sullivanpack341/gallery341/g2data/image/ersxac.html hot xxx sex] [http://c21redwood.com/images/p
+
== Chat Functions ==
 +
{{Flink|void|chat_clan|string}}
 +
{{Flink|void|chat_clan|string|string|desc=Sends a message to clan chat.}}
 +
{{Flink|void|chat_macro|string|desc=Submits a chat macro to KoL.}}
 +
{{Flink|void|chat_notify|string|string|desc=Sends a notification to the player's own chat.}}
 +
{{Flink|void|chat_private|string|string|desc=Sends a private message to another player.}}
 +
{{Flink|boolean|is_online|string|desc=Check to see if a player is online.}}
 +
{{Flink|boolean [string]|who_clan|desc=Returns a list of whom is in your clan and if they are in chat.}}
 +
{{Flink|boolean|can_faxbot|monster|desc=Check to see if a monster can be faxed.}}
 +
{{Flink|boolean|faxbot|monster|desc=Attempts to receive a fax of a given monster.}}
 +
 
 +
== Debugging Functions ==
 +
{{Flink|void|disable|string|desc=Disables the specified function.}}
 +
{{Flink|void|enable|string|desc=Enables the specified function.}}
 +
{{Flink|buffer|load_html|string|desc=Works like visit_url(), but for debugging.}}
 +
{{Flink|string|make_url|string|boolean|boolean|desc=Crafts the URL to visit.}}
 +
 
 +
== File Input/Output Functions ==
 +
{{FunctionEmbed|buffer_to_file|format=signature|desc=yes}}
 +
{{FunctionEmbed|file_to_array|format=signature|desc=yes}}
 +
{{FunctionEmbed|file_to_buffer|format=signature|desc=yes}}
 +
{{Flink|boolean|file_to_map|string|aggregate|desc=Loads a map from a tab-delimited text file.}}
 +
{{Flink|boolean|map_to_file|aggregate|string|desc=Saves a map to a tab-delimited text file.}}
 +
 
 +
== gCLI Command Functions ==
 +
{{FunctionEmbed|cli_execute|format=signature|desc=yes}}
 +
{{FunctionEmbed|cli_execute_output|format=signature|desc=yes}}
 +
 
 +
== Map Management Functions ==
 +
''Note: Information about maps (including creating, assigning, and removing keys, can be found at [[Data Structures#Maps|Map Data Structures]].''
 +
 
 +
{{Flink|int|count|aggregate|desc=Returns the number of defined keys for the specified aggregate.}}
 +
{{Flink|void|clear|aggregate|desc=Removes all keys from the specified aggregate.}}
 +
 
 +
== Time Functions ==
 +
{{Flink|string|format_date_time|string|string|string|desc=Reformats dates.}}
 +
{{Flink|int|gameday_to_int|desc=Returns the current KoL date as an integer.}}
 +
{{Flink|string|gameday_to_string|desc=Returns the current KoL date as a string.}}
 +
{{Flink|int|gametime_to_int|desc=Returns the current KoL time in ms as an integer.}}
 +
{{Flink|string|now_to_string|string|desc=Returns current local time/date in SimpleDateFormat format.}}
 +
{{Flink|string|time_to_string|desc=Returns the current local time in HH:mm:ss z format.}}
 +
{{Flink|string|today_to_string|desc=Returns the current local day in ISO format.}}
 +
 
 +
== SVN Functions ==
 +
''There is much additional information in the [[SVN Primer]]''.
 +
{{Flink|boolean|svn_exists|string|desc=Returns true if a valid working copy named projectname exists in the svn/ folder.}}
 +
{{Flink|boolean|svn_at_head|string|desc=Returns true if projectname exists, is a valid working copy, and is currently at the same revision number as the repository.}}
 +
{{Flink|record|svn_info|string|desc=Returns a record containing additional information about the given projectname: svnurl, last author, last revision, last change date.}}
 +
 
 +
== User Interaction ==
 +
{{Flink|void|print|string|{{opt|string}}|desc=Prints to CLI and status line of Adventuring window, optionally in a specified color.}}
 +
{{Flink|void|print_html|string|desc=Prints to CLI, parsing any included html.}}
 +
{{Flink|void|logprint|string|desc=Prints to the session log.}}
 +
{{Flink|void|wait|int}}
 +
{{Flink|void|waitq|int|desc=Sleeps for the specified number of seconds.}}
 +
{{Flink|boolean|user_confirm|string|desc=Allows user input in Y/N format.}}
 +
 
 +
== Property Functions ==
 +
{{Flink|boolean [string]|get_all_properties|string|boolean|desc=Returns a map of all user or global properties.}}
 +
{{FunctionEmbed|property_exists|format=signature|desc=yes}}
 +
{{FunctionEmbed|property_has_default|format=signature|desc=yes}}
 +
{{FunctionEmbed|property_default_value|format=signature|desc=yes}}
 +
{{Flink|string|get_property|string}}
 +
{{Flink|string|get_property|string|boolean|desc=Gets a global or user preference as appropriate.}}
 +
{{Flink|void|set_property|string|string|desc=Sets a global or user preference as appropriate.}}
 +
{{FunctionEmbed|remove_property|format=signature|desc=yes}}
 +
{{FunctionEmbed|rename_property|format=signature|desc=yes}}
 +
 
 +
== Other Functions ==
 +
{{FunctionEmbed|abort|format=signature|desc=yes}}
 +
{{FunctionEmbed|all_monsters_with_id|format=signature|desc=yes}}
 +
{{Flink|void|batch_open|desc=Used to mark the beginning of a block of functions to operate in batch mode (see page for {{f|batch_close}} for details).}}
 +
{{Flink|boolean|batch_close|desc=Used to mark the end of a block of functions to operate in batch mode (see page for details).}}
 +
{{Flink|int|get_revision|desc=Returns the current KoLmafia revision number.}}
 +
{{Flink|string|get_version|desc=Returns the most recent KoLmafia version.}}
 +
{{Flink|string|get_player_id|string|desc=Returns the user id number of a given player.}}
 +
{{FunctionEmbed|is_dark_mode|format=signature|desc=yes}}
 +
{{Flink|string|to_json|aggregate|desc=Converts a simple aggregate into JSON.}}
 +
 
 +
Additional functions that are considered not really to be ash functions are available in [[Miscellaneous ASH Features#Special Syntax Functions|Misc ASH Features]]
 +
 
 +
[[Category:Scripting]]

Latest revision as of 14:55, 23 December 2020

Chat Functions

void chat_clan( string )

void chat_clan( string, string )

Sends a message to clan chat.

void chat_macro( string )

Submits a chat macro to KoL.

void chat_notify( string, string )

Sends a notification to the player's own chat.

void chat_private( string, string )

Sends a private message to another player.

boolean is_online( string )

Check to see if a player is online.

boolean [string] who_clan()

Returns a list of whom is in your clan and if they are in chat.

boolean can_faxbot( monster )

Check to see if a monster can be faxed.

boolean faxbot( monster )

Attempts to receive a fax of a given monster.


Debugging Functions

void disable( string )

Disables the specified function.

void enable( string )

Enables the specified function.

buffer load_html( string )

Works like visit_url(), but for debugging.

string make_url( string, boolean, boolean )

Crafts the URL to visit.


File Input/Output Functions

boolean buffer_to_filebuffer, string )

Saves a buffer to a text file. Returns true on success, false on failure.

string [int] file_to_arraystring )

Reads data from a text file and returns a map of strings containing each line.

buffer file_to_bufferstring )

Loads the entire contents of a text file into a buffer.

boolean file_to_map( string, aggregate )

Loads a map from a tab-delimited text file.

boolean map_to_file( aggregate, string )

Saves a map to a tab-delimited text file.


gCLI Command Functions

boolean cli_executestring )

Executes a string as a gCLI command. Returns true on success, false on failure.

string cli_execute_outputstring )

Executes a gCLI command, capturing and returning the gCLI output.

Map Management Functions

Note: Information about maps (including creating, assigning, and removing keys, can be found at Map Data Structures.

int count( aggregate )

Returns the number of defined keys for the specified aggregate.

void clear( aggregate )

Removes all keys from the specified aggregate.


Time Functions

string format_date_time( string, string, string )

Reformats dates.

int gameday_to_int()

Returns the current KoL date as an integer.

string gameday_to_string()

Returns the current KoL date as a string.

int gametime_to_int()

Returns the current KoL time in ms as an integer.

string now_to_string( string )

Returns current local time/date in SimpleDateFormat format.

string time_to_string()

Returns the current local time in HH:mm:ss z format.

string today_to_string()

Returns the current local day in ISO format.


SVN Functions

There is much additional information in the SVN Primer.

boolean svn_exists( string )

Returns true if a valid working copy named projectname exists in the svn/ folder.

boolean svn_at_head( string )

Returns true if projectname exists, is a valid working copy, and is currently at the same revision number as the repository.

record svn_info( string )

Returns a record containing additional information about the given projectname: svnurl, last author, last revision, last change date.


User Interaction

void print( string, [string] )

Prints to CLI and status line of Adventuring window, optionally in a specified color.

void print_html( string )

Prints to CLI, parsing any included html.

void logprint( string )

Prints to the session log.

void wait( int )

void waitq( int )

Sleeps for the specified number of seconds.

boolean user_confirm( string )

Allows user input in Y/N format.


Property Functions

boolean [string] get_all_properties( string, boolean )

Returns a map of all user or global properties.

boolean property_existsstring, boolean? )

Checks whether a property exists.

boolean property_has_defaultstring )

Checks if a property has a built-in default value.

string property_default_valuestring )

Returns the default value of a property, or an empty string if a default value does not exist.

string get_property( string )

string get_property( string, boolean )

Gets a global or user preference as appropriate.

void set_property( string, string )

Sets a global or user preference as appropriate.

string remove_propertystring, boolean? )

Removes or resets a property and returns its previous value.

boolean rename_propertystring, string )

Renames a property. Returns true on success, false on failure.

Other Functions

void abortstring? )

Immediately halts the current script and all queued functions.

boolean [monster] all_monsters_with_id()

Returns a map of all monsters that have a non-zero monster ID.

void batch_open()

Used to mark the beginning of a block of functions to operate in batch mode (see page for batch_close() for details).

boolean batch_close()

Used to mark the end of a block of functions to operate in batch mode (see page for details).

int get_revision()

Returns the current KoLmafia revision number.

string get_version()

Returns the most recent KoLmafia version.

string get_player_id( string )

Returns the user id number of a given player.

boolean is_dark_mode()

Checks if the current KoLmafia theme is dark mode.

string to_json( aggregate )

Converts a simple aggregate into JSON.


Additional functions that are considered not really to be ash functions are available in Misc ASH Features