To familiar: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bale
mNo edit summary
imported>Eliteofdelete
No edit summary
 
Line 25: 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}}.|


needscode=yes|
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 ].|

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