Miscellaneous Functions: Difference between revisions
Add "gCLI Command Functions" section |
|||
(6 intermediate revisions by the same user not shown) | |||
Line 16: | Line 16: | ||
{{Flink|buffer|load_html|string|desc=Works like visit_url(), but for debugging.}} | {{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.}} | {{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 == | == Map Management Functions == | ||
''Note: Information about maps (including creating, assigning, and removing keys, can be found at [[Data Structures#Maps|Map Data Structures]].'' | ''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|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.}} | ||
Line 50: | Line 58: | ||
== Property Functions == | == Property Functions == | ||
{{Flink|boolean [string]|get_all_properties|string|boolean|desc=Returns a map of all user or global properties.}} | {{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}} | ||
{{Flink|string|get_property|string|boolean|desc=Gets a global or user preference as appropriate.}} | {{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.}} | {{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 == | == 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|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|boolean|batch_close|desc=Used to mark the end of a block of functions to operate in batch mode (see page for details).}} | ||
Line 71: | Line 76: | ||
{{Flink|string|get_version|desc=Returns the most recent KoLmafia version.}} | {{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.}} | {{Flink|string|get_player_id|string|desc=Returns the user id number of a given player.}} | ||
{{FunctionEmbed|is_dark_mode|desc=yes}} | {{FunctionEmbed|is_dark_mode|format=signature|desc=yes}} | ||
{{Flink|string|to_json|aggregate|desc=Converts a simple aggregate into JSON.}} | {{Flink|string|to_json|aggregate|desc=Converts a simple aggregate into JSON.}} | ||
Latest revision as of 14:55, 23 December 2020
Chat Functions
void chat_clan( string )
void chat_clan( string, string )
void chat_macro( string )
void chat_notify( string, string )
void chat_private( string, string )
boolean is_online( string )
boolean [string] who_clan()
boolean can_faxbot( monster )
boolean faxbot( monster )
Debugging Functions
void disable( string )
void enable( string )
buffer load_html( string )
string make_url( string, boolean, boolean )
File Input/Output Functions
boolean buffer_to_file( buffer, string )
- Saves a buffer to a text file. Returns
true
on success,false
on failure.
string [int] file_to_array( string )
- Reads data from a text file and returns a map of strings containing each line.
buffer file_to_buffer( string )
- Loads the entire contents of a text file into a buffer.
boolean file_to_map( string, aggregate )
boolean map_to_file( aggregate, string )
gCLI Command Functions
- Executes a string as a gCLI command. Returns
true
on success,false
on failure.
string cli_execute_output( string )
- 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.
void clear( aggregate )
Time Functions
string format_date_time( string, string, string )
int gameday_to_int()
string gameday_to_string()
string now_to_string( string )
string time_to_string()
string today_to_string()
SVN Functions
There is much additional information in the SVN Primer.
boolean svn_exists( string )
boolean svn_at_head( string )
record svn_info( string )
User Interaction
void print( string, [string] )
void print_html( string )
void logprint( string )
void wait( int )
void waitq( int )
boolean user_confirm( string )
Property Functions
boolean [string] get_all_properties( string, boolean )
boolean property_exists( string, boolean? )
- Checks whether a property exists.
boolean property_has_default( string )
- Checks if a property has a built-in default value.
string property_default_value( string )
- 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 )
void set_property( string, string )
string remove_property( string, boolean? )
- Removes or resets a property and returns its previous value.
boolean rename_property( string, string )
- Renames a property. Returns
true
on success,false
on failure.
Other Functions
- 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()
batch_close()
for details).boolean batch_close()
int get_revision()
string get_version()
string get_player_id( string )
- Checks if the current KoLmafia theme is dark mode.
string to_json( aggregate )
Additional functions that are considered not really to be ash functions are available in Misc ASH Features