Difference between revisions of "Miscellaneous Functions"

From Kolmafia
Jump to navigation Jump to search
imported>Efilnikufecin
 
imported>Raeith
Line 1: Line 1:
 +
== Part 6 - Miscellaneous ==
 +
<p><em>Mostly internal stuff. Some good for everyone, some only for ASH wizards.</em></p>
  
Part 6 - Miscellaneous
+
<p><strong>void print( string helloworld )</strong><br />
 +
Prints the given string to the graphical CLI window and to the status line of the main Adventuring window</p>
  
Mostly internal stuff. Some good for everyone, some only for ASH wizards.
+
<p><strong>boolean cli_execute( string command )</strong><br />
 +
Executes the given command as if it were entered into the graphical CLI window. This can be used for CLI commands or, if you&#8217;re careful and not an asshat, for raw URLs.<br />
 +
See the [http://kolmafia.sourceforge.net/scripting.html CLI manual] for more details.</p>
  
void print( string helloworld )
+
<p><strong>void wait( int delay )</strong><br />
Prints the given string to the graphical CLI window and to the status line of the main Adventuring window
+
Does nothing for the desired number of seconds.</p>
  
boolean cli_execute( string command )
+
<p><strong>string get_property( string key )<br />
Executes the given command as if it were entered into the graphical CLI window. This can be used for CLI commands or, if you’re careful and not an asshat, for raw URLs. See the CLI manual for more details.
+
boolean set_property( string key, string value )</strong><br />
Sample:Hedging
+
Gets or sets a stored property from your character&#8217;s .kcs file.<br />
 +
The KoLmafia [http://www.wiki.kolmafia.us/index.php/%28ASHRM%29_KoLMafia_Properties properties] page contains details on many of the keys that are available for access.</p>
  
void wait( int delay )
+
<p><strong>string boolean_to_string( boolean flag )<br />
Does nothing for the desired number of seconds.
+
string int_to_string( int number )<br />
 +
string float_to_string( float number )<br />
 +
string item_to_string( item it )<br />
 +
string zodiac_to_string( zodiac sign )<br />
 +
string location_to_string( location place )<br />
 +
string familiar_to_string( class cl )<br />
 +
string class_to_string( class cl )<br />
 +
string stat_to_string( stat st )<br />
 +
string skill_to_string( skill sk )<br />
 +
string effect_to_string( effect ef )<br />
 +
string element_to_string( element el )<br />
 +
string slot_to_string( slot sl )<br />
 +
string monster_to_string( monster eek )</strong><br />
 +
Converts in-game variables to printable counterparts. The print command will cast non-string values properly now, but these are still useful for building URLs and setting properties.</p>
  
string get_property( string key )
+
<p><strong>boolean string_to_boolean( string str )<br />
boolean set_property( string key, string value )
+
int string_to_int( string str )<br />
Gets or sets a stored property from your character’s .kcs file. The KoLmafia properties page contains details on many of the keys that are available for access.
+
float string_to_float( string str )<br />
Sample:Battlefield_gather
+
item string_to_item( string str )<br />
 +
zodiac string_to_zodiac( string str )<br />
 +
location string_to_location( string str )<br />
 +
familiar string_to_familiar( string str )<br />
 +
class string_to_class( string str )<br />
 +
stat string_to_stat( string str )<br />
 +
skill string_to_skill( string str )<br />
 +
effect string_to_effect( string str )<br />
 +
slot string_to_slot( string str )<br />
 +
element string_to_element( string str )<br />
 +
monster string_to_monster( string str )</strong><br />
 +
Converts strings to ASH variables. Useful for converting the result of a get_property() call intoa legitimate value.</p>
  
string boolean_to_string( boolean flag )
+
<p><strong>int item_to_int( item it )<br />
string int_to_string( int number )
+
int skill_to_int ( skill sk )<br />
string float_to_string( float number )
+
int effect_to_int ( effect eff )<br />
string item_to_string( item it )
+
int familiar_to_int ( familiar pet )<br />
string zodiac_to_string( zodiac sign )
+
int slot_to_int ( slot sl )<br />
string location_to_string( location place )
+
int element_to_int ( element el )</strong><br />
string familiar_to_string( class cl )
+
Converts the ASH-based object into the number that will be recognized by the KoL server. Needed when you&#8217;re building raw URLs from time to time.</p>
string class_to_string( class cl )
 
string stat_to_string( stat st )
 
string skill_to_string( skill sk )
 
string effect_to_string( effect ef )
 
string element_to_string( element el )
 
string slot_to_string( slot sl )
 
string monster_to_string( monster eek )
 
Converts in-game variables to printable counterparts. The print command will cast non-string values properly now, but these are still useful for building URLs and setting properties.
 
  
boolean string_to_boolean( string str )
+
<p><strong>item int_to_item( int nItem )<br />
int string_to_int( string str )
+
skill int_to_skill ( int nSkill )<br />
float string_to_float( string str )
+
effect int_to_effect ( int nEffect )<br />
item string_to_item( string str )
+
familiar int_to_familiar ( int nFamiliar )<br />
zodiac string_to_zodiac( string str )
+
slot int_to_slot ( int nSlot )<br />
location string_to_location( string str )
+
element int_to_element ( int nElement )</strong><br />
familiar string_to_familiar( string str )
+
Converts the KoL-based number into an associated ASH object. These aren&#8217;t the commands you&#8217;re looking for. You can go about your business.</p>
class string_to_class( string str )
 
stat string_to_stat( string str )
 
skill string_to_skill( string str )
 
effect string_to_effect( string str )
 
slot string_to_slot( string str )
 
element string_to_element( string str )
 
monster string_to_monster( string str )
 
Converts strings to ASH variables. Useful for converting the result of a get_property() call intoa legitimate value.
 
  
int item_to_int( item it )
+
<p><strong>void file_to_map( string file_to_load, map map_to_fill )<br />
int skill_to_int ( skill sk )
+
void map_to_file( map map_to_save, string file_to_write )</strong><br />
int effect_to_int ( effect eff )
+
Loads and saves maps as tab-delimited text files.</p>
int familiar_to_int ( familiar pet )
 
int slot_to_int ( slot sl )
 
int element_to_int ( element el )
 
Converts the ASH-based object into the number that will be recognized by the KoL server. Needed when you’re building raw URLs from time to time.
 
  
item int_to_item( int nItem )
+
<p><strong>int random( int range )</strong><br />
skill int_to_skill ( int nSkill )
+
Generates a random integer between 0 and (range-1) inclusive.</p>
effect int_to_effect ( int nEffect )
 
familiar int_to_familiar ( int nFamiliar )
 
slot int_to_slot ( int nSlot )
 
element int_to_element ( int nElement )
 
  
Converts the KoL-based number into an associated ASH object. These aren’t the commands you’re looking for. You can go about your business.
+
<p><strong>int round( float ratio )<br />
 +
int floor( float ratio )<br />
 +
int ceil( float ratio )<br />
 +
int truncate( float ratio )</strong><br />
 +
Returns an integer near the given real number. Respectively, it returns the nearest, next lowest, next highest, and decimal-stripped integer.</p>
  
void file_to_map( string file_to_load, map map_to_fill )
+
<p><strong>int count( map )</strong><br />
void map_to_file( map map_to_save, string file_to_write )
+
Returns the number of defined keys for the aggregate.</p>
Loads and saves maps as tab-delimited text files.
 
  
int random( int range )
+
<p><strong>void clear( map )</strong><br />
Generates a random integer between 0 and (range-1) inclusive.
+
Remove all keys from a map. </p>
  
int round( float ratio )
+
<p><strong>void disable( string function_name )<br />
int floor( float ratio )
+
void enable( string function_name )</strong><br />
int ceil( float ratio )
+
For debugging purposes disables or enables the indicated function</p>
int truncate( float ratio )
 
Returns an integer near the given real number. Respectively, it returns the nearest, next lowest, next highest, and decimal-stripped integer.
 
  
int count( map )
+
<p><strong>float square_root( float value )</strong><br />
Returns the number of defined keys for the aggregate.
+
returns the square root of the passed value</p>
 
 
void clear( map )
 
Remove all keys from a map.
 
 
 
void disable( string function_name )
 
void enable( string function_name )
 
For debugging purposes disables or enables the indicated function
 
 
 
float square_root( float value )
 
returns the square root of the passed value
 

Revision as of 04:06, 9 January 2007

Part 6 - Miscellaneous

Mostly internal stuff. Some good for everyone, some only for ASH wizards.

void print( string helloworld )
Prints the given string to the graphical CLI window and to the status line of the main Adventuring window

boolean cli_execute( string command )
Executes the given command as if it were entered into the graphical CLI window. This can be used for CLI commands or, if you’re careful and not an asshat, for raw URLs.
See the CLI manual for more details.

void wait( int delay )
Does nothing for the desired number of seconds.

string get_property( string key )
boolean set_property( string key, string value )

Gets or sets a stored property from your character’s .kcs file.
The KoLmafia properties page contains details on many of the keys that are available for access.

string boolean_to_string( boolean flag )
string int_to_string( int number )
string float_to_string( float number )
string item_to_string( item it )
string zodiac_to_string( zodiac sign )
string location_to_string( location place )
string familiar_to_string( class cl )
string class_to_string( class cl )
string stat_to_string( stat st )
string skill_to_string( skill sk )
string effect_to_string( effect ef )
string element_to_string( element el )
string slot_to_string( slot sl )
string monster_to_string( monster eek )

Converts in-game variables to printable counterparts. The print command will cast non-string values properly now, but these are still useful for building URLs and setting properties.

boolean string_to_boolean( string str )
int string_to_int( string str )
float string_to_float( string str )
item string_to_item( string str )
zodiac string_to_zodiac( string str )
location string_to_location( string str )
familiar string_to_familiar( string str )
class string_to_class( string str )
stat string_to_stat( string str )
skill string_to_skill( string str )
effect string_to_effect( string str )
slot string_to_slot( string str )
element string_to_element( string str )
monster string_to_monster( string str )

Converts strings to ASH variables. Useful for converting the result of a get_property() call intoa legitimate value.

int item_to_int( item it )
int skill_to_int ( skill sk )
int effect_to_int ( effect eff )
int familiar_to_int ( familiar pet )
int slot_to_int ( slot sl )
int element_to_int ( element el )

Converts the ASH-based object into the number that will be recognized by the KoL server. Needed when you’re building raw URLs from time to time.

item int_to_item( int nItem )
skill int_to_skill ( int nSkill )
effect int_to_effect ( int nEffect )
familiar int_to_familiar ( int nFamiliar )
slot int_to_slot ( int nSlot )
element int_to_element ( int nElement )

Converts the KoL-based number into an associated ASH object. These aren’t the commands you’re looking for. You can go about your business.

void file_to_map( string file_to_load, map map_to_fill )
void map_to_file( map map_to_save, string file_to_write )

Loads and saves maps as tab-delimited text files.

int random( int range )
Generates a random integer between 0 and (range-1) inclusive.

int round( float ratio )
int floor( float ratio )
int ceil( float ratio )
int truncate( float ratio )

Returns an integer near the given real number. Respectively, it returns the nearest, next lowest, next highest, and decimal-stripped integer.

int count( map )
Returns the number of defined keys for the aggregate.

void clear( map )
Remove all keys from a map.

void disable( string function_name )
void enable( string function_name )

For debugging purposes disables or enables the indicated function

float square_root( float value )
returns the square root of the passed value