To familiar: Difference between revisions
Jump to navigation
Jump to search
imported>StDoodle Created page with '{{ #vardefine:name|to_familiar}}{{ #vardefine:return_type|familiar}}{{ FunctionPage| name={{#var:name}}| function_category=Datatype Conversions| function1={{Function| name={{#v…' |
imported>Eliteofdelete No edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 5: | Line 5: | ||
FunctionPage| | FunctionPage| | ||
name={{#var:name}}| | name={{#var:name}}| | ||
function1={{Function| | function1={{Function| | ||
Line 26: | Line 25: | ||
function_description=Returns the familiar associated with either the KoL in-game ID # or name matching {{pspan|convert}}.| | function_description=Returns the familiar associated with either the KoL in-game ID # or name matching {{pspan|convert}}.| | ||
code1={{CodeSample| | |||
title=Code Samples| | |||
description=Following example shows basic to_familiar operations.|| | |||
code= | |||
<syntaxhighlight> | |||
int hobomonkey = 89; | |||
foreach it in $strings[baby gravy fairy, LaMa lAmA, spirit] | |||
print("String -"+it+"- gives familiar "+to_familiar(it), "blue"); | |||
print("Int "+hobomonkey+" gives familiar "+to_familiar(hobomonkey), "green"); | |||
</syntaxhighlight>| | |||
moreinfo= For more information of familiar numbers see [http://kol.coldfront.net/thekolwiki/index.php/Familiars_by_number Familiars by number]. | |||
<br>It gives the following output. | |||
<pre> | |||
String -baby gravy fairy- gives familiar Baby Gravy Fairy | |||
String -LaMa lAmA- gives familiar Llama Lama | |||
String -spirit- gives familiar Spirit Hobo | |||
Int 89 gives familiar Hobo Monkey | |||
</pre> | |||
}}| | |||
special=If no match is found, this function returns $familiar[ none ].| | special=If no match is found, this function returns $familiar[ none ].| | ||
}} | }} | ||
[[Category:Datatype Conversions]] |
Latest revision as of 14:45, 26 January 2015
Function Syntax
familiar to_familiar(int convert )
familiar to_familiar(string convert )
- convert is an ID # or familiar name to convert
Returns the familiar associated with either the KoL in-game ID # or name matching convert.
Code Samples
Following example shows basic to_familiar operations.
int hobomonkey = 89;
foreach it in $strings[baby gravy fairy, LaMa lAmA, spirit]
print("String -"+it+"- gives familiar "+to_familiar(it), "blue");
print("Int "+hobomonkey+" gives familiar "+to_familiar(hobomonkey), "green");
For more information of familiar numbers see Familiars by number.
It gives the following output.
String -baby gravy fairy- gives familiar Baby Gravy Fairy String -LaMa lAmA- gives familiar Llama Lama String -spirit- gives familiar Spirit Hobo Int 89 gives familiar Hobo Monkey
Special
If no match is found, this function returns $familiar[ none ].