To monster: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bale
mNo edit summary
imported>Eliteofdelete
No edit summary
Line 17: Line 17:
function_description=Returns the specified monster {{pspan|name}} as a monster.|
function_description=Returns the specified monster {{pspan|name}} as a monster.|


needscode=yes|
code1={{CodeSample|
title=Code Samples|
description=Following example shows basic to_monster operations.||
code=
<syntaxhighlight>
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");
</syntaxhighlight>|
moreinfo=
It gives the following output.
<pre>
goth giant gives Goth Giant.
beefy bat gives beefy bodyguard bat.
flock of sta gives Flock of Stab-Bats.
</pre>
}}|


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.|
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.|

Revision as of 15:44, 26 January 2015

Function Syntax

monster to_monster(string name )

  • name is the monster name to convert

Returns the specified monster name as a monster.

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.