Difference between revisions of "Get power"
Jump to navigation
Jump to search
imported>Slyz (Created page with '{{ #vardefine:name|get_power}}{{ #vardefine:return_type|int}}{{ FunctionPage| name={{#var:name}}| function_category=Item Management| function1={{Function| name={{#var:name}}| a…') |
imported>Eliteofdelete |
||
(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 power of the item {{pspan|it}}| | + | function_description=Returns the power of the item {{pspan|it}} or 0 if the item doesn't have a power| |
+ | code1={{CodeSample| | ||
+ | title=Code Samples| | ||
+ | description=Lists out the current power of the gear you are wearing.| | ||
+ | code= | ||
+ | <syntaxhighlight> | ||
+ | int total; | ||
+ | item thing; | ||
+ | foreach it in $slots[] { | ||
+ | thing = equipped_item(it); | ||
+ | if (thing != $item[none]) | ||
+ | print("The "+thing+" worn in the "+it+" slot has a power rating of "+get_power(thing)+".", "blue"); | ||
+ | total += get_power(thing); | ||
+ | } | ||
+ | print("The total power of your gear is "+total+".", "green"); | ||
+ | </syntaxhighlight>| | ||
+ | |||
+ | }}| | ||
}} | }} | ||
+ | |||
+ | [[Category:Item Management]] |
Latest revision as of 03:35, 14 January 2015
Function Syntax
- it is the item to check for.
Returns the power of the item it or 0 if the item doesn't have a power
Code Samples
Lists out the current power of the gear you are wearing.
int total;
item thing;
foreach it in $slots[] {
thing = equipped_item(it);
if (thing != $item[none])
print("The "+thing+" worn in the "+it+" slot has a power rating of "+get_power(thing)+".", "blue");
total += get_power(thing);
}
print("The total power of your gear is "+total+".", "green");