Difference between revisions of "Datatype Conversions"

From Kolmafia
Jump to navigation Jump to search
imported>Alhifar
imported>Heeheehee
Line 3: Line 3:
 
These functions will convert 1 type of data to another.
 
These functions will convert 1 type of data to another.
  
<p><strong>string to_string( variable )</strong><br />
+
<p><strong>boolean to_boolean( variable )</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.<br />
+
Converts the ASH-based object into boolean.<br />
accepts: boolean, int, float, item, zodiac, location, familiar, class, stat, skill, effect, slot, element, monster</p>
+
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>int to_int( variable )</strong><br />
+
<p><strong>effect to_effect( variable )</strong><br />
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.<br />
+
Converts the ASH-based object into an effect.<br />
accepts: String, float, item, zodiac, location, familiar, skill, effect, slot, element, monster, boolean, class, stat</p>
+
Accepts: string, int, skill
 +
</p>
  
<p><strong>boolean to_boolean( variable )</strong><br />
+
<p><strong>familiar to_familiar( variable )</strong><br />
Converts the ASH-based object into boolean.<br />
+
Converts the ASH-based object into a familiar.<br />
Accepts: String, int</p>
+
Accepts: string, int
 +
</p>
  
 
<p><strong>float to_float( variable )</strong><br />
 
<p><strong>float to_float( variable )</strong><br />
 
Converts the ASH-based object into a float.<br />
 
Converts the ASH-based object into a float.<br />
Accepts: String, int</p>
+
Accepts: string, int, item, zodiac, location, familiar, skill, effect, slot, element, monster, boolean, class, stat</p>
 +
 
 +
<p><strong>int to_int( variable )</strong><br />
 +
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.<br />
 +
accepts: string, float, item, zodiac, location, familiar, skill, effect, slot, element, monster, boolean, class, stat</p>
  
 
<p><strong>item to_item( variable )</strong><br />
 
<p><strong>item to_item( variable )</strong><br />
Line 29: Line 40:
 
</p>
 
</p>
  
<p><strong>familiar to_familiar( variable )</strong><br />
+
<p><strong>monster to_monster( variable )</strong><br />
Converts the ASH-based object into a familiar.<br />
+
Converts the ASH-based object into a monster.<br />
Accepts: string, int
+
Accepts: string
 
</p>
 
</p>
  
Line 37: Line 48:
 
Converts the ASH-based object into a skill.<br />
 
Converts the ASH-based object into a skill.<br />
 
Accepts: string, int, effect
 
Accepts: string, int, effect
</p>
 
 
<p><strong>effect to_effect( variable )</strong><br />
 
Converts the ASH-based object into an effect.<br />
 
Accepts: string, int, skill
 
 
</p>
 
</p>
  
Line 49: Line 55:
 
</p>
 
</p>
  
<p><strong>monster to_monster( variable )</strong><br />
+
<p><strong>string to_string( variable )</strong><br />
Converts the ASH-based object into a monster.<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.<br />
Accepts: string
+
accepts: boolean, int, float, item, zodiac, location, familiar, class, stat, skill, effect, slot, element, monster</p>
</p>
 

Revision as of 21:59, 27 February 2010

Part 10 - Datatype Conversions

These functions will convert 1 type of data to another.

boolean to_boolean( variable )
Converts the ASH-based object into boolean.
Accepts: string, int

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

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

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

float to_float( variable )
Converts the ASH-based object into a float.
Accepts: string, int, item, zodiac, location, familiar, skill, effect, slot, element, monster, boolean, class, stat

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, boolean, class, stat

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

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

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

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

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