Difference between revisions of "Miscellaneous Functions"

From Kolmafia
Jump to navigation Jump to search
(Add "gCLI Command Functions" section)
 
(147 intermediate revisions by 71 users not shown)
Line 1: Line 1:
[http://goldhills.olympe-network.com/www-reddito.html www reddito di cittadinanza it] [http://irala.50webs.com/lib/erykah-badu.htm erykah badu] [http://lighteies.50webs.com/styles/felice-daniela.html felice daniela] [http://barougust.50webs.com/view/gds-it/ gds it] [http://lacydesmoines.50webs.com/html/casio-exz1/ casio exz10] [http://ikkyo.50webs.com/styles/intimo-dim/ intimo dim] [http://themelegant.50webs.com/accessori-microonde/ accessori microonde] [http://fnor.olympe-network.com/ovunque-sei1/ ovunque sei michele placido] [http://benferguson.50webs.com/content/hp-scanjet15/ hp scanjet 4670] [http://irala.50webs.com/lib/i-giganti3.htm i giganti uccidono] [http://shadowfallen.olympe-network.com/articles/lklklkl/ lklklkl] [http://equusreined.olympe-network.com/data/cercami/ cercami] [http://gustavolacerda.50webs.com/new/Video-manuela1/ video manuela arcuri nuda] [http://svetulenka.50webs.com/data/praha.html praha] [http://lighteies.50webs.com/styles/dns.html dns] [http://kasumikawaii.olympe-network.com/view/macrame/ macrame] [http://equusreined.olympe-network.com/data/fonetismo/ fonetismo] [http://sporkmoostipe.50webs.com/html/www-chilhavisto.htm www chilhavisto] [http://bervera.olympe-network.com/html/andy-warhol1/ andy warhol my hustler  i a man] [http://oizolittle.50webs.com/palma-di1.html palma di montechiaro] [http://guralyuk2.50webs.com/library/never-gonna2.htm never gonna give your up] [http://msquaredprime.50webs.com/topic/last-minute50.htm last minute sharm 8 ottobre] [http://bklyndirt.50webs.com/description/lavatrice-smeg.htm lavatrice smeg 800] [http://mirror27.50webs.com/content/cristian-castro.htm cristian castro te llame porque no supe] [http://shadowfallen.olympe-network.com/articles/p-anderson/ p anderson] [http://stulchik.50webs.com/lib/soni-soni.html soni soni] [http://irala.50webs.com/lib/hotel-amsterdam2.htm hotel amsterdam court new york] [http://gustavolacerda.50webs.com/new/un-capretto/ un capretto] [http://nymphatacita.olympe-network.com/directory/racconti-incestuosi6/ racconti incestuosi tra madre e figlio] [http://lacydesmoines.50webs.com/html/car-holder4/ car holder pda] [http://svetulenka.50webs.com/data/red-zone.html red zone] [http://myswtghst.50webs.com/mae-jong/ mae jong] [http://myswtghst.50webs.com/office-22/ office 2003 professional ita] [http://girlofink.50webs.com/styles/fiera-inquieta2/ fiera inquieta pasion de gavilanes] [http://stulchik.50webs.com/lib/dvi-femmina.html dvi femmina vga maschio] [http://angadeon.50webs.com/library/fack-it2/ fack it eamon] [http://ljivoi.50webs.com/small/olympus-c21.html olympus c400] [http://deathlyprince.50webs.com/papa-winnie.html papa winnie] [http://thecakeblog.olympe-network.com/topic/gps-geko1/ gps geko 201] [http://kasumikawaii.olympe-network.com/view/improvvisamente-lestate/ improvvisamente lestate scorsa] [http://shadowfallen.olympe-network.com/articles/plasma-philips10/ plasma philips 50pf7320] [http://anarx1st.olympe-network.com/lib/tutto-su12.html tutto su costantino vitagliano] [http://bklyndirt.50webs.com/description/see-you.htm see you better end] [http://svetulenka.50webs.com/data/vendita-online6.html vendita online intimo donna] [http://bervera.olympe-network.com/html/google-credito/ google credito al consumo] [http://ole5eyes.olympe-network.com/topic/etichette-dvd1.html etichette dvd cd] [http://dharmab.50webs.com/resources/feste-di3/ feste di capodanno] [http://sporkmoostipe.50webs.com/html/loredana-cicco.htm loredana cicco] [http://ariavaswen.olympe-network.com/resources/io-senza1/ io senza e te] [http://equusreined.olympe-network.com/data/petralona/ petralona] [http://bervera.olympe-network.com/html/fujifilm-ac/ fujifilm ac 3v] [http://fnor.olympe-network.com/batteria-gericom1/ batteria gericom overdose] [http://ariavaswen.olympe-network.com/resources/processore-amd21/ processore amd athlon 643400] [http://benferguson.50webs.com/content/mutuionline/ mutuionline] [http://gustavolacerda.50webs.com/new/narina/ narina] [http://barougust.50webs.com/view/lg-dvd15/ lg dvd cdrw masterizzatore] [http://oizolittle.50webs.com/veleno-toto.html veleno toto] [http://msquaredprime.50webs.com/topic/giacca-a.htm giacca a 2 bottoni abiti uomo] [http://ljivoi.50webs.com/small/ragazzo-di2.html ragazzo di borgata] [http://bervera.olympe-network.com/html/www-it6/ www187 it] [http://murkyjulep.50webs.com/data/micologo/ micologo] [http://shadowfallen.olympe-network.com/articles/simona2/ simona 1973] [http://themelegant.50webs.com/joseph-artur/ joseph artur] [http://gustavolacerda.50webs.com/new/bluetooth-cellular/ bluetooth cellular line per cellulari] [http://guralyuk2.50webs.com/library/le-amanti2.htm le amanti del mostro] [http://bklyndirt.50webs.com/description/warlord.htm warlord] [http://nymphatacita.olympe-network.com/directory/creative-muvo25/ creative muvo n200 1 gb] [http://chevereenvt.50webs.com/description/miss-playboy3/ miss playboy di giugno] [http://sporkmoostipe.50webs.com/html/www-lilkim.htm www lilkim com] [http://thecakeblog.olympe-network.com/topic/capitan-fantasma/ capitan fantasma] [http://angadeon.50webs.com/library/passat-11/ passat 1900 tdi 130 cv] [http://murkyjulep.50webs.com/data/and-peugeot/ and peugeot 206] [http://irala.50webs.com/lib/black-decker5.htm black decker] [http://themelegant.50webs.com/crimine-silenzioso/ crimine silenzioso] [http://ljivoi.50webs.com/small/onar-we.html onar we to poczuj] [http://shadowfallen.olympe-network.com/articles/espansioni-di/ espansioni di memoria] [http://irala.50webs.com/lib/un-bacio2.htm un bacio a mezzanotte] [http://chevereenvt.50webs.com/description/stieler-kaspar/ stieler kaspar] [http://lighteies.50webs.com/styles/sapphire-radeon34.html sapphire radeon 9600 atlantis 256mb agp] [http://ariavaswen.olympe-network.com/resources/dugi-otok/ dugi otok] [http://guralyuk2.50webs.com/library/notizie-delgiorno.htm notizie delgiorno] [http://msquaredprime.50webs.com/topic/www-dita.htm www dita net] [http://svetulenka.50webs.com/data/dolce-remi.html dolce remi] [http://lacydesmoines.50webs.com/html/jeune-photo/ jeune photo porno] [http://anarx1st.olympe-network.com/lib/ati-59.html ati 9800 pro 128mb] [http://mirror27.50webs.com/content/dizionario-siciliano.htm dizionario siciliano] [http://msquaredprime.50webs.com/topic/mac-donald1.htm mac donald] [http://kasumikawaii.olympe-network.com/view/gragon-ballz/ gragon ballz] [http://taniaotvagina.50webs.com/tv-plasma43.htm tv plasma 42 samsung ps42d5s] [http://irala.50webs.com/lib/bellissime-ragazze1.htm bellissime ragazze] [http://girlofink.50webs.com/styles/fotocopiatrice-laser3/ fotocopiatrice laser multifunzioni] [http://bklyndirt.50webs.com/description/porche-black.htm porche black] [http://sporkmoostipe.50webs.com/html/victor-gsm.htm victor gsm] [http://thecakeblog.olympe-network.com/topic/vreau-sa4/ vreau sa beau cu prieteni] [http://nymphatacita.olympe-network.com/directory/zie-vecchie/ zie vecchie pompinare] [http://fnor.olympe-network.com/hp-compaq60/ hp compaq nx8220] [http://murkyjulep.50webs.com/data/hector-y14/ hector y tito video] [http://gustavolacerda.50webs.com/new/tps-codes1/ tps codes key] [http://goldhills.olympe-network.com/testo-canzoni6.html testo canzoni maroon 5] [http://irala.50webs.com/lib/monitor-lcd111.htm monitor lcd tv pc]  == Part 7 - Miscellaneous ==
+
{{TOCright}}
<p><em>Mostly internal stuff. Some good for everyone, some only for ASH wizards.</em></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.}}
  
<p><strong>void print( string output )</strong><br />
+
== Debugging Functions ==
<strong>void print( string output, string color )</strong><br />
+
{{Flink|void|disable|string|desc=Disables the specified function.}}
Prints <i>output</i> to the CLI buffer and displays it in the status line of the main Adventuring window.  If <i>color</i> is specified any HTML in <i>output</i> is escaped and the string is wrapped in a font tag before being printed.</p>
+
{{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.}}
  
<p><strong>boolean cli_execute( string command )</strong><br />
+
== File Input/Output Functions ==
Executes the given command as if it were entered into the graphical CLI window. This can be used for CLI commands or, if you
+
{{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