Miscellaneous Functions: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
No edit summary
Add "gCLI Command Functions" section
 
(139 intermediate revisions by 66 users not shown)
Line 1: Line 1:
[http://batswing.info/index3_1000.html site] [http://spy-cams.misserve.info/ spy cams] [http://surfin-u-s-a.wrawler.info/ surfin u s a] [http://router-adsl-wifi-108.indulger.info/ router adsl wifi 108] [http://stroam.info/index2_666.html index] [http://stroam.info/index1_666.html index] [http://googlr.downslip.info/ googlr] [http://asustek-pm17ts.wrawler.info/ asustek pm17ts] [http://kinkikids.indulger.info/ kinkikids] [http://largine.downslip.info/ largine] [http://downslip.info/index1_1000.html url] [http://www-com-samanta.batswing.info/ www com samanta] [http://licking-cum-ass.burblers.info/ Licking cum ass] [http://what-i-am.downslip.info/ what i am] [http://colpa-mia.stroam.info/ colpa mia] [http://bank-photo.unfeeble.info/ bank photo] [http://avsl-89.indulger.info/ avsl 89] [http://mg-tf-km-zero.burblers.info/ mg tf km zero] [http://h.downslip.info/ h] [http://nefelina.unfeeble.info/ nefelina] [http://leonard-mann.batswing.info/ leonard mann] [http://shila.stroam.info/ shila] [http://sacode.batswing.info/ sacode] [http://cover-hot-party-spring-2004.indulger.info/ cover hot party spring 2004] [http://syncmaster-710v.misserve.info/ syncmaster 710v] [http://router-adsl-wireless-108-mbps.batswing.info/ router adsl wireless 108 mbps] [http://cavuto.misserve.info/ cavuto] [http://levanto.batswing.info/ levanto] [http://philips-109e50-19.batswing.info/ philips 109e50 19] [http://misserve.info/index1_666.html site] [http://misserve.info/index4_250.html index] [http://asus-a4s.stroam.info/ asus a4s] [http://elkhart.batswing.info/ elkhart] [http://blip-and-blop.unfeeble.info/ blip and blop] [http://preisner.burblers.info/ preisner] [http://peugeot-106-xn.stroam.info/ peugeot 106 xn] [http://nec-lcd1770nx.batswing.info/ nec lcd1770nx] [http://www-aermec-com.batswing.info/ www aermec com] [http://microfono-anni-50.stroam.info/ microfono anni 50] [http://remotely.indulger.info/ remotely] [http://mpeg2-for-nero.unfeeble.info/ mpeg2 for nero] [http://www-motogp-com.downslip.info/ www motogp com] [http://chat-amicos.stroam.info/ Chat amicos] [http://tv-sexy-idex.indulger.info/ tv sexy idex] [http://xd-card-128.indulger.info/ xd card 128] [http://scanner-4370.batswing.info/ scanner 4370] [http://toyota-prius.batswing.info/ toyota prius] [http://manna-sex.wrawler.info/ manna sex] [http://toshiba-lcd-tv-30.misserve.info/ toshiba lcd tv 30] [http://bul-et.misserve.info/ bul et] [http://lexmark-x1155.stroam.info/ lexmark x1155] [http://indulger.info/index8_666.html page] [http://fercam.batswing.info/ fercam] [http://pacthwork.wrawler.info/ pacthwork] [http://unfeeble.info/index5_1000.html home] [http://new-jork.misserve.info/ new jork] [http://indulger.info/index6_1000.html map] [http://batswing.info/index4_250.html site] [http://www-artetv-com.burblers.info/ www artetv com] [http://por-tu-amor.burblers.info/ por tu amor] [http://corairs.burblers.info/ corairs] [http://energizer-2300.misserve.info/ energizer 2300] [http://renault-dynamic-2003.stroam.info/ renault dynamic 2003] [http://indulger.info/index1_666.html homepage] [http://copilu-minune.burblers.info/ copilu minune] [http://burblers.info/index6_1000.html site] [http://the-zero-boys.burblers.info/ the zero boys] [http://pc-lcd.burblers.info/ pc lcd] [http://misserve.info/ misserve.info] [http://trucco-smackdown-vs-raw-2006.batswing.info/ trucco smackdown vs raw 2006] [http://risma-carta-a4.batswing.info/ risma carta a4] [http://backstreet.misserve.info/ backstreet] [http://maia-hi.downslip.info/ maia hi] [http://you-see-i-m-loving-you.downslip.info/ you see i m loving you] [http://garlasco.batswing.info/ garlasco] [http://caca.indulger.info/ caca] [http://calumo.stroam.info/ calumo] [http://i-don-t-know-wanna.stroam.info/ i don t know wanna] [http://franco-oh-franco.unfeeble.info/ franco oh franco] [http://hdv-sony.batswing.info/ hdv sony] [http://revo-3030.burblers.info/ revo 3030] [http://www-sex300-com.downslip.info/ www sex300 com] [http://pink-panthe.burblers.info/ pink panthe] [http://busty-girl.downslip.info/ Busty girl] [http://porte.misserve.info/ porte] [http://boys-roma-ultras-1972.misserve.info/ boys roma ultras 1972] [http://dvd-r-5-1.batswing.info/ dvd r 5 1] [http://chocobo-racing.indulger.info/ chocobo racing] [http://eh-up-and-down.indulger.info/ eh up and down] [http://david.batswing.info/ david] [http://kilauea.downslip.info/ kilauea] [http://microsoft-mappoint.downslip.info/ microsoft mappoint] [http://isabelle.misserve.info/ isabelle] [http://vdo-dayton-gps.wrawler.info/ vdo dayton gps] [http://cd-key-need-for-speed.burblers.info/ cd key need for speed] [http://samsung-721s-mm.unfeeble.info/ samsung 721s mm] [http://nueva-era.unfeeble.info/ nueva era] [http://gwent.indulger.info/ gwent] [http://lykke-may-andersen.downslip.info/ lykke may andersen] [http://kidq.unfeeble.info/ kidq]
{{TOCright}}
[http://living-in-a-lie.burblers.info/ living in a lie] [http://fray-mocho.burblers.info/ fray mocho] [http://router-wireless-belkin.batswing.info/ router wireless belkin] [http://tomtom-car-holder.stroam.info/ tomtom car holder] [http://linki.indulger.info/ linki] [http://bebe-confort-high-trek.batswing.info/ bebe confort high trek] [http://wrawler.info/index5_1000.html home] [http://behringer-ex1200.downslip.info/ behringer ex1200] [http://remote-keys.wrawler.info/ remote keys] [http://legge-196-2003.batswing.info/ legge 196 2003] [http://ventosa-pda.burblers.info/ ventosa pda] [http://sps-ahi.indulger.info/ sps ahi] [http://hergen.misserve.info/ hergen] [http://tacco-11.batswing.info/ tacco 11] [http://upd-player
== 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