Difference between revisions of "Miscellaneous Functions"

From Kolmafia
Jump to navigation Jump to search
(Add "gCLI Command Functions" section)
 
(145 intermediate revisions by 70 users not shown)
Line 1: Line 1:
[http://cannibalholocaust.ronyon.info/ cannibal holocaust film dvd] [http://castingveline.scypus.info/ casting veline] [http://contiinsospeso.unbak.info/ conti in sospeso film dvd] [http://usedcars.sprag.info/ used cars] [http://ladydianamorente.scypus.info/ lady diana morente] [http://armadimetalli.sprag.info/ armadi metalli] [http://giocoscacchi.ercast.info/ gioco scacchi] [http://thewayyou.nytromobile.info/ the way you] [http://mp3radioflash.sprag.info/ mp3 radio flash stick 1gb] [http://golg.ercast.info/ golg] [http://martinal.embrac.info/ martina l] [http://numanumaeie.berhym.info/ numa numa eie] [http://highwaypursuit.boyro.info/ highway pursuit] [http://biancheriaintima.sprag.info/ biancheria intima] [http://romanorap.rotic.info/ romano rap] [http://clarkjosiah.unbak.info/ clark josiah latimer] [http://crashday-trailer.scypus.info/ crash day - trailer 2] [http://eleonoradimiele.unbak.info/ eleonora dimiele] [http://cvisione.sprag.info/ c visione] [http://battipagliaaci.nytromobile.info/ battipaglia aci trasporti] [http://mousewirelessmicrosoft.embrac.info/ mouse wireless microsoft] [http://cdanni6070.nytromobile.info/ cd anni 60 70] [http://morahjohnes.sprag.info/ morah johnes] [http://uthaithaniprovincia.embrac.info/ uthai thani provincia] [http://rabaul.scypus.info/ rabaul] [http://unicosplendid.ercast.info/ unico splendid 11 hp] [http://fotodicazzipiccoli.sprag.info/ foto di cazzi piccoli] [http://ufficioamalfi.boyro.info/ ufficio amalfi] [http://stanza3sesso.unbak.info/ stanza 3 sesso] [http://ercast.info/ ercast.info] [http://ricercanumeri.sprag.info/ ricerca numeri cellulare] [http://pattinsonhughlee.berhym.info/ pattinson hugh lee] [http://thuthuca.scypus.info/ thuthuca] [http://control1mg30cpr.rotic.info/ control 1mg 30 cpr] [http://navigatorigps.sprag.info/ navigatori gps symbian] [http://richmond509.rotic.info/ richmond 509] [http://senzarespiro.berhym.info/ senza respiro raf] [http://nytromobile.info/ nytromobile.info] [http://ronyon.info/ ronyon.info] [http://embrac.info/ embrac.info] [http://cis.scypus.info/ c i s] [http://smasnc.berhym.info/ sma snc] [http://ercast.info/ ercast.info] [http://quilmes.rotic.info/ quilmes] [http://rotic.info/ rotic.info] [http://berhym.info/index2_1000.html index] [http://sacroeprofano.sprag.info/ sacro e profano] [http://immaginidiorchi.embrac.info/ immagini di orchi] [http://ripetitoresegnale.berhym.info/ ripetitore segnale telecomando accessori] [http://dvd-r8xprinco.ronyon.info/ dvd - r 8x princo] [http://mercedesml55.ercast.info/ mercedes ml 55] [http://bryanadamslive.ercast.info/ bryan adams live at slane castle ireland 2000] [http://cartonepornogratis.sprag.info/ cartone porno gratis] [http://acertm4152lmi.nytromobile.info/ acer tm 4152lmi] [http://vipnudefotomontaggi.boyro.info/ vip nude fotomontaggi] [http://vaer.berhym.info/ vaer] [http://topjeans.nytromobile.info/ top jeans] [http://sanguedicaino.ercast.info/ sangue di caino] [http://technocom.sprag.info/ techno com] [http://wwwgiochionlie.nytromobile.info/ www giochi onlie] [http://lagodigardaalberghi.berhym.info/ lago di garda alberghi] [http://newkeyssatpage.ronyon.info/ new keys sat page] [http://udothundervision.berhym.info/ udo thundervision] [http://andreushans.berhym.info/ andreus hans] [http://ceibala.berhym.info/ ceiba la-] [http://jethrotull.rotic.info/ jethrotull] [http://cavosvideoplaystation.sprag.info/ cavo s video playstation] [http://unbak.info/ unbak.info] [http://telomolla.rotic.info/ telo molla] [http://giocarealacasa.scypus.info/ giocare a la casa stregata] [http://allcelebritynet.embrac.info/ allcelebrity net] [http://paclandnamco.boyro.info/ pac land namco] [http://everybodyriseicp.rotic.info/ everybody rise icp] [http://tuttefacoltauniversitarie.ercast.info/ tutte facolta universitarie di napoli] [http://amoremiospogliati.unbak.info/ amore mio spogliati che poi ti spiego] [http://trzeci.rotic.info/ trzeci] [http://tiechristiandior.rotic.info/ tie christian dior occhiali] [http://suoneriacellulare.berhym.info/ Suoneria cellulare samsung t100] [http://sdabocconi.unbak.info/ sda bocconi] [http://sprag.info/index1_1000.html map] [http://chariopegasus.nytromobile.info/ chario pegasus] [http://ps2tft.scypus.info/ ps2 tft] [http://zyxelzyairg-560.berhym.info/ zyxel zyair g-560] [http://bollettetelefoniche.sprag.info/ bollette telefoniche] [http://matroxqid.boyro.info/ matrox qid] [http://dabrowskiignacy.nytromobile.info/ dabrowski ignacy] [http://lettoriperpc.ronyon.info/ lettori per pc] [http://unbak.info/ unbak.info] [http://roasio.unbak.info/ roasio] [http://berhym.info/ berhym.info] [http://orlandointrattenimento.ronyon.info/ orlando intrattenimento] [http://lettoredvdkiss.scypus.info/ lettore dvd kiss dp-500] [http://sunapericulos.ronyon.info/ suna periculos] [http://ziaevelina.sprag.info/ zia evelina] [http://diamondpornostar.embrac.info/ diamond pornostar] [http://dvd12v.berhym.info/ dvd 12v] [http://alignmentforli.unbak.info/ alignment forli -cesena] [http://videopornozippati.boyro.info/ video porno zippati] [http://pcpavilion.scypus.info/ pc pavilion] [http://ilballodelcammello.ercast.info/ il ballo del cammello] [http://fuckeamon.embrac.info/ fuck eamon] [http://socketa.berhym.info/ socket a] [http://ufficiopalermo.ercast.info/ ufficio palermo] [http://storiadinewyork.sprag.info/ storia di new york] [http://dvdphilipspet.sprag.info/ dvd philips pet] [http://giochigratisinternet.sprag.info/ giochi gratis internet] [http://cybershotsony.embrac.info/ cybershot sony] [http://centerofcultural.scypus.info/ center of cultural echange portland mai] [http://telaiocarbon.nytromobile.info/ telaio carbon] [http://goldengoose.ercast.info/ golden goose] [http://ferrari208turbo.nytromobile.info/ ferrari 208 turbo intercooler] [http://ricevitoredigitale.boyro.info/ ricevitore digitale terrestre telesystem] [http://nikonmc-eu1.sprag.info/ nikon mc-eu1] [http://nytromobile.info/ nytromobile.info] [http://devics.scypus.info/ devics] [http://tellmeup.unbak.info/ tell me up] [http://clockworkorange.embrac.info/ clock work orange] [http://concejala.berhym.info/ concejala] [http://twistedmetal3.rotic.info/ twisted metal 3] [http://ponygirlsirjeff.unbak.info/ Ponygirl sirjeff] [http://visualfoxpro.sprag.info/ visual foxpro 6 0] [http://carrelloelevatori.embrac.info/ carrello elevatori] [http://ipodstereo.boyro.info/ ipod stereo] [http://paura.rotic.info/ paura] [http://esameperititecnici.nytromobile.info/ esame periti tecnici palermo] [http://gfsvedese.scypus.info/ gf svedese] [http://discodiripristino.unbak.info/ disco di ripristino xp download] [http://triopasseggino.berhym.info/ trio passeggino ct 01] [http://ultimodecapitato.scypus.info/ ultimo decapitato in iraq] [http://mazzidirose.nytromobile.info/ mazzi di rose] [http://catamarani.unbak.info/ catamarani] [http://phentermineonline.boyro.info/ phentermine online pharmacy] [http://orgasmomaschile.embrac.info/ Orgasmo maschile] [http://lancialybradiesel.scypus.info/ lancia lybra diesel] [http://elisavidamia.unbak.info/ elisa vida mia] [http://tarnfiume.embrac.info/ tarn fiume] [http://rotic.info/ rotic.info] [http://ladanzadeivagabondi.rotic.info/ la danza dei vagabondi] [http://berhym.info/ berhym.info] [http://casellapostaelettronica.unbak.info/ casella posta elettronica] [http://ladygolpe.embrac.info/ lady golpe] [http://asusx700.rotic.info/ asus x700] [http://autolivellante.ercast.info/ autolivellante] [http://tv50plasmapanasonic.ronyon.info/ tv 50 plasma panasonic] [http://harddiskportatile.ercast.info/ hard disk portatile 20 gb] [http://leharf.ercast.info/ lehar f] [http://asusp4p800-mx.ronyon.info/ asus p4p800-mx] [http://mimizanplage.ronyon.info/ mimizan plage] [http://topformcx.berhym.info/ top form cx] [http://hotelacopenhagen.rotic.info/ hotel a copenhagen]  == 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