My hp: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Grotfang
m moved My hp() to My hp: Conformity
imported>Grotfang
Conform to template
Line 1: Line 1:
[[int]] [[my_hp()]]
{{#vardefine:name|my_hp}}
{{#vardefine:return_type|int}}


Returns your current HP level as an [[int]].
{{FunctionPage|
name={{#var:name}}|
function_category=Your Character|


The following example will attempt to heal you to full health if your HP has reached 0.
function1={{Function|
name={{#var:name}}|
aggregate={{#var:aggregate}}|
return_type={{#var:return_type}}|
return_also={{#var:return_also}}
}}|


<code>
function_description=Returns your current HP level as an int.|
  if ([[my_hp()]] == 0) {
    [[restore_hp()|restore_hp]]([[my_maxhp()]]);
  }
</code>
[[Category:Your Character | My hp()]]
[[Category:Ash Functions |My hp()]]


When not logged in, this function returns 0.
code1={{CodeSample|
title=Code Samples|
description=The following example will attempt to heal you to full health if your HP has reached 0.|
code=
<syntaxhighlight>
if(my_hp() == 0) {
  restore_hp(my_maxhp());
}
</syntaxhighlight>
}}|
 
see_also={{SeeAlso|my_maxhp|restore_hp}}|
special=When not logged in, this function returns 0.
}}

Revision as of 13:41, 1 March 2010



Function Syntax

int my_hp()

Returns your current HP level as an int.

Code Samples

The following example will attempt to heal you to full health if your HP has reached 0.

if(my_hp() == 0) {
   restore_hp(my_maxhp());
}

See Also

my_maxhp() | restore_hp()

Special

When not logged in, this function returns 0.