Difference between revisions of "Get power"
Jump to navigation
Jump to search
imported>Slyz m |
imported>Eliteofdelete |
||
(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 18: | Line 17: | ||
function_description=Returns the power of the item {{pspan|it}} or 0 if the item doesn't have a power| | 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");