To element

From Kolmafia
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Function Syntax

element to_element(string name )

  • name is the element name to convert

Returns the specified element name as an element.

Code Samples

Following example shows basic to_element operations.

foreach it in $strings[hot, colD, slime, SpookY, stench]
   print("The string -"+it+"- gives element: "+to_element(it), "blue");

It gives the following output.

The string -hot- gives element: hot
The string -colD- gives element: none
The string -slime- gives element: slime
The string -SpookY- gives element: none
The string -stench- gives element: stench

Special

Note that this function is case-sensitive, as with direct casting. Anything besides the following list will return $element[ none ], including strings with extra or missing characters: cold, hot, sleaze, spooky, stench, slime.