Datatype Conversions

From Kolmafia
Revision as of 11:31, 20 January 2007 by imported>Efilnikufecin
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Data Type Conversions

These functions will convert 1 type of data to another.

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.

effect skill_to_effect( skill sk )
skill effect_to_skill( effect ef)

Returns the desired association between skills and the effects that they produce.
Sample:Skill_upkeep

slot item_to_slot( item it )
Returns the natural slot for the item, if it is equippable.