Difference between revisions of "My maxhp"

From Kolmafia
Jump to navigation Jump to search
imported>ZammyWarrior
imported>Zarqon
(more links, consistent formatting, logged-out info)
Line 1: Line 1:
'''int my_maxhp()'''<br/>
+
[[int]] [[my_maxhp()]]
Returns your highest available HP level
+
 
 +
Returns your current maximum HP as an [[int]].
 +
 
 +
This example attempts to restore you to full health if you have less than half of your possible HP.
 +
 
 +
<code>
 +
  if ([[my_hp()]] < ([[my_maxhp()]] / 2)) {
 +
    [[restore_hp()|restore_hp]]([[my_maxhp()]]);
 +
  }
 +
</code>
 
[[Category:Your Character | My maxhp()]]
 
[[Category:Your Character | My maxhp()]]
 
[[Category:Ash Functions |My maxhp()]]
 
[[Category:Ash Functions |My maxhp()]]
<pre>if(my_hp() == 0){
+
 
restore_hp(mymax_hp());
+
When not logged in, this function returns 0.
} </pre>
 

Revision as of 14:42, 29 January 2009

int my_maxhp()

Returns your current maximum HP as an int.

This example attempts to restore you to full health if you have less than half of your possible HP.

 if (my_hp() < (my_maxhp() / 2)) {
   restore_hp(my_maxhp());
 }

When not logged in, this function returns 0.