To monster

From Kolmafia
Revision as of 21:02, 24 March 2015 by imported>Bale (r15633: monster to_monster( int ))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function Syntax

monster to_monster(string name )

  • name is the monster name to convert

monster to_monster(int id )

  • id is KoL's id number for a monster

Returns the specified monster name as a monster, or converts KoL's monster id into its monster value.

Code Samples

Following example shows basic to_monster operations.

string first, second, third;

first = "goth giant";
second = "beefy bat";
third = "flock of sta";

print(first+" gives "+to_monster(first)+".", "blue");
print(second+" gives "+to_monster(second)+".", "blue");
print(third+" gives "+to_monster(third)+".", "blue");

It gives the following output.

goth giant gives Goth Giant.
beefy bat gives beefy bodyguard bat.
flock of sta gives Flock of Stab-Bats.

Special

Since direct casting with $monster[ ] is already case-insensitive and accepts partial matches, this function is only useful for converting a string variable to a monster.