Datatype Conversions

From Kolmafia
Revision as of 16:00, 26 June 2007 by imported>Efilnikufecin (New conversion methods)
Jump to navigation Jump to search

Data Type Conversions

These functions will convert 1 type of data to another.

string to_string( variable )
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.
accepts: boolean, int, float, item, zodiac, location, familiar, class, stat, skill, effect, slot, element, monster

int to_int( variable )
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.
accepts: String, float, item, zodiac, location, familiar, skill, effect, slot, element, monster
may accept: boolean, class, stat

boolean to_boolean( variable )
Converts the ASH-based object into boolean.
Accepts: String
may accept: Int

float to_float( variable )
Converts the ASH-based object into a float.
Accepts: String
may accept: int

item to_item( variable )
Converts the ASH-based object into an item.
Accepts: string, int

zodiac to_zodiac( variable )
Converts the ASH-based object into a zodiac.
Accepts: string

location to_location( variable )
Converts the ASH-based object into a location.
Accepts: string, int

familiar to_familiar( variable )
Converts the ASH-based object into a familiar.
Accepts: string, int

class to_class( variable )
Converts the ASH-based object into a class.
Accepts: string

stat to_stat( variable )
Converts the ASH-based object into a stat.
Accepts: string

skill to_skill( variable )
Converts the ASH-based object into a skill.
Accepts: string, int, effect

effect to_effect( variable )
Converts the ASH-based object into an effect.
Accepts: string, int, skill

slot to_slot( variable )
Converts the ASH-based object into a slot.
Accepts: string, int, item

element to_element( variable )
Converts the ASH-based object into an element.
Accepts: string, int

monster to_monster( variable )
Converts the ASH-based object into a monster.
Accepts: string, int