Difference between revisions of "Datatype Conversions"

From Kolmafia
Jump to navigation Jump to search
imported>Efilnikufecin
(New conversion methods)
imported>Efilnikufecin
(See discussion thread on kolmafia.us)
Line 25: Line 25:
 
Converts the ASH-based object into an item.<br />
 
Converts the ASH-based object into an item.<br />
 
Accepts: string, int
 
Accepts: string, int
</p>
 
 
<p><strong>zodiac to_zodiac( variable )</strong><br />
 
Converts the ASH-based object into a zodiac.<br />
 
Accepts: string
 
 
</p>
 
</p>
  
 
<p><strong>location to_location( variable )</strong><br />
 
<p><strong>location to_location( variable )</strong><br />
 
Converts the ASH-based object into a location.<br />
 
Converts the ASH-based object into a location.<br />
Accepts: string, int
+
Accepts: string
 
</p>
 
</p>
  
Line 40: Line 35:
 
Converts the ASH-based object into a familiar.<br />
 
Converts the ASH-based object into a familiar.<br />
 
Accepts: string, int
 
Accepts: string, int
</p>
 
 
<p><strong>class to_class( variable )</strong><br />
 
Converts the ASH-based object into a class.<br />
 
Accepts: string
 
</p>
 
 
<p><strong>stat to_stat( variable )</strong><br />
 
Converts the ASH-based object into a stat.<br />
 
Accepts: string
 
 
</p>
 
</p>
  
Line 64: Line 49:
 
<p><strong>slot to_slot( variable )</strong><br />
 
<p><strong>slot to_slot( variable )</strong><br />
 
Converts the ASH-based object into a slot.<br />
 
Converts the ASH-based object into a slot.<br />
Accepts: string, int, item
+
Accepts: item
</p>
 
 
 
<p><strong>element to_element( variable )</strong><br />
 
Converts the ASH-based object into an element.<br />
 
Accepts: string, int
 
 
</p>
 
</p>
  
 
<p><strong>monster to_monster( variable )</strong><br />
 
<p><strong>monster to_monster( variable )</strong><br />
 
Converts the ASH-based object into a monster.<br />
 
Converts the ASH-based object into a monster.<br />
Accepts: string, int
+
Accepts: string
 
</p>
 
</p>

Revision as of 14:05, 27 June 2007

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

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

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

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: item

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