Difference between revisions of "To stat"

From Kolmafia
Jump to navigation Jump to search
imported>Bale
(was missing)
 
imported>Eliteofdelete
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{
 
{{
 
#vardefine:name|to_stat}}{{
 
#vardefine:name|to_stat}}{{
#vardefine:return_type|skill}}{{
+
#vardefine:return_type|stat}}{{
  
 
FunctionPage|
 
FunctionPage|
 
name={{#var:name}}|
 
name={{#var:name}}|
function_category=Datatype Conversions|
 
  
 
function1={{Function|
 
function1={{Function|
Line 12: Line 11:
 
return_type={{#var:return_type}}|
 
return_type={{#var:return_type}}|
 
return_also={{#var:return_also}}|
 
return_also={{#var:return_also}}|
parameter1={{Param|int|convert}}|
+
parameter1={{Param|string|convert}}|
 
}}|
 
}}|
  
 
function_description=When supplied a string, returns the stat that corresponds to the specified parameter {{pspan|convert}}.|
 
function_description=When supplied a string, returns the stat that corresponds to the specified parameter {{pspan|convert}}.|
  
needscode=yes|
+
code1={{CodeSample|
 +
title=Code Samples|
 +
description=Following example shows basic to_stat operations.||
 +
code=
 +
<syntaxhighlight>
 +
string first, second, third;
 +
 
 +
first = "mox";
 +
second = "moxie";
 +
third = "MuSclE";
 +
 
 +
print(first+" gives "+to_stat(first)+".", "blue");
 +
print(second+" gives "+to_stat(second)+".", "blue");
 +
print(third+" gives "+to_stat(third)+".", "blue");
 +
</syntaxhighlight>|
 +
moreinfo=
 +
It gives the following output.
 +
<pre>
 +
mox gives none.
 +
moxie gives Moxie.
 +
MuSclE gives Muscle.
 +
</pre>
 +
}}|
  
 
see_also={{SeeAlso|to_item|to_skill|to_monster}}|
 
see_also={{SeeAlso|to_item|to_skill|to_monster}}|
Line 23: Line 44:
 
special=If no match is found for {{pspan|convert}}, this function returns $stat[ none ].|
 
special=If no match is found for {{pspan|convert}}, this function returns $stat[ none ].|
 
}}
 
}}
 +
 +
[[Category:Datatype Conversions]]

Latest revision as of 15:43, 26 January 2015

Function Syntax

stat to_stat(string convert )

When supplied a string, returns the stat that corresponds to the specified parameter convert.

Code Samples

Following example shows basic to_stat operations.

string first, second, third;

first = "mox";
second = "moxie";
third = "MuSclE";

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

It gives the following output.

mox gives none.
moxie gives Moxie.
MuSclE gives Muscle.

See Also

to_item() | to_skill() | to_monster()

Special

If no match is found for convert, this function returns $stat[ none ].