Difference between revisions of "Miscellaneous Functions"

From Kolmafia
Jump to navigation Jump to search
(hajl.cheefmsn.com)
(Add "gCLI Command Functions" section)
 
(165 intermediate revisions by 84 users not shown)
Line 1: Line 1:
<div style='display:none;width=1px;'><a href="http://www.azresults.com/search.php?qq=Buy%20BRAND%20Gelonida%2F%20Codeine%20online" >Buy BRAND Gelonida/ Codeine online</a>  <br>
+
{{TOCright}}
<a href="http://www.azresults.com/search.php?qq=Nissan%20%2D%20Official%20Site" >Nissan - Official Site</a>  <br>
+
== Chat Functions ==
<a href="http://www.azresults.com/search.php?qq=The%20Levitra%20Catalog" >The Levitra Catalog</a>  <br>
+
{{Flink|void|chat_clan|string}}
<a href="http://www.azresults.com/search.php?qq=Best%20Prices%20on%20Carisoprodol" >Best Prices on Carisoprodol</a>  <br>
+
{{Flink|void|chat_clan|string|string|desc=Sends a message to clan chat.}}
<a href="http://www.azresults.com/search.php?qq=Free%20Shipping%20on%20Carisoprdol%20Orders" >Free Shipping on Carisoprdol Orders</a>  <br>
+
{{Flink|void|chat_macro|string|desc=Submits a chat macro to KoL.}}
<a href="http://www.azresults.com/search.php?qq=Best%20Online%20Casino%20Sites" >Best Online Casino Sites</a>  <br>
+
{{Flink|void|chat_notify|string|string|desc=Sends a notification to the player's own chat.}}
<a href="http://www.azresults.com/search.php?qq=Xerox%20Global%20Services" >Xerox Global Services</a>  <br>
+
{{Flink|void|chat_private|string|string|desc=Sends a private message to another player.}}
<a href="http://www.azresults.com/search.php?qq=Get%20Free%20Payroll%20Service%20Price%20Quotes" >Get Free Payroll Service Price Quotes</a>  <br>
+
{{Flink|boolean|is_online|string|desc=Check to see if a player is online.}}
<a href="http://www.azresults.com/search.php?qq=Generic%20BIAXIN%20in%20Cheapest%20Online%20Pharmacy" >Generic BIAXIN in Cheapest Online Pharmacy</a>  <br>
+
{{Flink|boolean [string]|who_clan|desc=Returns a list of whom is in your clan and if they are in chat.}}
<a href="http://www.azresults.com/search.php?qq=Criminal%20Justice%20Schools" >Criminal Justice Schools</a>  <br>
+
{{Flink|boolean|can_faxbot|monster|desc=Check to see if a monster can be faxed.}}
<a href="http://www.azresults.com/search.php?qq=Naturalizer%20Shoes" >Naturalizer Shoes</a>  <br>
+
{{Flink|boolean|faxbot|monster|desc=Attempts to receive a fax of a given monster.}}
<a href="http://www.azresults.com/search.php?qq=Ktl%20Inc%2E%20Loan%20Lending" >Ktl Inc. Loan Lending</a>  <br>
+
 
<a href="http://www.azresults.com/search.php?qq=Compare%20Levitra%20prices" >Compare Levitra prices</a>  <br>
+
== Debugging Functions ==
<a href="http://www.azresults.com/search.php?qq=Phentermine%2037%2E5mg%20Guaranteed%20Low%20Price%2C%20Fast%20Delivery" >Phentermine 37.5mg Guaranteed Low Price, Fast Delivery</a>  <br>
+
{{Flink|void|disable|string|desc=Disables the specified function.}}
<a href="http://www.azresults.com/search.php?qq=Buy%20Diazepam" >Buy Diazepam</a>  <br>
+
{{Flink|void|enable|string|desc=Enables the specified function.}}
<a href="http://www.azresults.com/search.php?qq=Your%20Reliable%20Online%20Pharmacy" >Your Reliable Online Pharmacy</a>  <br>
+
{{Flink|buffer|load_html|string|desc=Works like visit_url(), but for debugging.}}
<a href="http://www.azresults.com/search.php?qq=Strong%20Hoodia%20Diet%20Pills" >Strong Hoodia Diet Pills</a>  <br>
+
{{Flink|string|make_url|string|boolean|boolean|desc=Crafts the URL to visit.}}
<a href="http://www.azresults.com/search.php?qq=Low%20interest%20loans%2E" >Low interest loans.</a>  <br>
+
 
<a href="http://www.azresults.com/search.php?qq=Sears%20Heating%20and%20Cooling%20System" >Sears Heating and Cooling System</a>  <br>
+
== File Input/Output Functions ==
<a href="http://www.azresults.com/search.php?qq=Flood%20Squad%2DWater%20Fire%20Damage%20Restoration%20Removal" >Flood Squad-Water Fire Damage Restoration Removal</a>  <br>
+
{{FunctionEmbed|buffer_to_file|format=signature|desc=yes}}
<a href="http://www.azresults.com/search.php?qq=Plumbing%20Estimates" >Plumbing Estimates</a>  <br>
+
{{FunctionEmbed|file_to_array|format=signature|desc=yes}}
<a href="http://www.azresults.com/search.php?qq=Free%20Debt%20Consolidation%20Evalutations%20800%2D810%2D3390" >Free Debt Consolidation Evalutations 800-810-3390</a>  <br>
+
{{FunctionEmbed|file_to_buffer|format=signature|desc=yes}}
<a href="http://www.azresults.com/search.php?qq=Best%20Prices%20on%20Tramadol" >Best Prices on Tramadol</a>  <br>
+
{{Flink|boolean|file_to_map|string|aggregate|desc=Loads a map from a tab-delimited text file.}}
<a href="http://www.azresults.com/search.php?qq=AccuQuote%20%2D%20Free%20Term%20Life%20Insurance%20Quotes" >AccuQuote - Free Term Life Insurance Quotes</a>  <br>
+
{{Flink|boolean|map_to_file|aggregate|string|desc=Saves a map to a tab-delimited text file.}}
<a href="http://www.azresults.com/search.php?qq=Best%20Price%20on%20Net%20for%20ZITHROMAX" >Best Price on Net for ZITHROMAX</a>  <br>
+
 
<a href="http://www.azresults.com/search.php?qq=BEST%20PLACE%20TO%20BUY%20EFFEXOR" >BEST PLACE TO BUY EFFEXOR</a>  <br>
+
== gCLI Command Functions ==
<a href="http://www.azresults.com/search.php?qq=Compare%20Diazepam%20prices" >Compare Diazepam prices</a>  <br>
+
{{FunctionEmbed|cli_execute|format=signature|desc=yes}}
<a href="http://www.azresults.com/search.php?qq=Ecosystems%20Environmental%20Services%20Inc" >Ecosystems Environmental Services Inc</a>  <br>
+
{{FunctionEmbed|cli_execute_output|format=signature|desc=yes}}
<a href="http://www.azresults.com/search.php?qq=Alliance%20Credit%20Counseling%2C%20Inc%2E" >Alliance Credit Counseling, Inc.</a>  <br>
+
 
<a href="http://www.azresults.com/search.php?qq=Urology%20Team%20PA" >Urology Team PA</a>  <br>
+
== Map Management Functions ==
<a href="http://www.azresults.com/search.php?qq=Purchase%20Ativan%20online" >Purchase Ativan online</a>  <br>
+
''Note: Information about maps (including creating, assigning, and removing keys, can be found at [[Data Structures#Maps|Map Data Structures]].''
+
 
</div>
+
{{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