To monster: Difference between revisions
Jump to navigation
Jump to search
imported>StDoodle Created page with '{{ #vardefine:name|to_monster}}{{ #vardefine:return_type|monster}}{{ FunctionPage| name={{#var:name}}| function_category=Datatype Conversions| function1={{Function| name={{#var…' |
imported>Bale r15633: monster to_monster( int ) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 5: | Line 5: | ||
FunctionPage| | FunctionPage| | ||
name={{#var:name}}| | name={{#var:name}}| | ||
function1={{Function| | function1={{Function| | ||
Line 16: | Line 15: | ||
}}| | }}| | ||
function_description=Returns the specified monster {{pspan|name}} as a monster.| | function2={{Function| | ||
name={{#var:name}}| | |||
aggregate={{#var:aggregate}}| | |||
return_type={{#var:return_type}}| | |||
return_also={{#var:return_also}}| | |||
parameter1={{Param|int|id}}| | |||
p1desc={{Pspan|id}} is KoL's id number for a monster| | |||
}}| | |||
function_description=Returns the specified monster {{pspan|name}} as a monster, or converts KoL's monster {{pspan|id}} into its monster value.| | |||
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.| | ||
}} | }} | ||
[[Category:Datatype Conversions]] |
Latest revision as of 21:02, 24 March 2015
Function Syntax
monster to_monster(string name )
- name is the monster name to convert
- 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.