Difference between revisions of "Miscellaneous Functions"

From Kolmafia
Jump to navigation Jump to search
imported>Bale
(organization)
imported>Bale
(organization)
Line 8: Line 8:
 
{{Flink|boolean|is_online|string|desc=Check to see if a player is online.}}
 
{{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 [string]|who_clan|desc=Returns a list of whom is in your clan and if they are in chat.}}
 
== Time Functions ==
 
{{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.}}
 
  
 
== Debugging Functions ==  
 
== Debugging Functions ==  
Line 28: Line 20:
 
{{Flink|int|count|aggregate|desc=Returns the number of defined keys for the specified aggregate.}}
 
{{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.}}
 
{{Flink|void|clear|aggregate|desc=Removes all keys from the specified aggregate.}}
 +
 +
== Time Functions ==
 +
{{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.}}
  
 
== User Interaction ==
 
== User Interaction ==

Revision as of 10:57, 24 November 2011

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.


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.


Map Management Functions

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.

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

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.


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.


Other Functions

void abort( [string] )

Aborts the current script with an optional message.

boolean cli_execute( string )

Executes the given command as if it were entered into the CLI.

string get_property( string )

Gets a global or user preference as appropriate.

void set_property( string, string )

Sets a global or user preference as appropriate.

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.


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