Difference between revisions of "My maxhp"

From Kolmafia
Jump to navigation Jump to search
imported>Zarqon
(more links, consistent formatting, logged-out info)
imported>Bale
m
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[int]] [[my_maxhp()]]
+
{{
 +
#vardefine:name|my_maxhp}}{{
 +
#vardefine:return_type|int}}{{
  
Returns your current maximum HP as an [[int]].
+
FunctionPage|
 +
name={{#var:name}}|
  
This example attempts to restore you to full health if you have less than half of your possible HP.
+
function1={{Function|
 +
name={{#var:name}}|
 +
aggregate={{#var:aggregate}}|
 +
return_type={{#var:return_type}}|
 +
return_also={{#var:return_also}}
 +
}}|
  
<code>
+
function_description=Returns your current maximum HP as an int.|
  if ([[my_hp()]] < ([[my_maxhp()]] / 2)) {
 
    [[restore_hp()|restore_hp]]([[my_maxhp()]]);
 
  }
 
</code>
 
[[Category:Your Character | My maxhp()]]
 
[[Category:Ash Functions |My maxhp()]]
 
  
When not logged in, this function returns 0.
+
code1={{CodeSample|
 +
title=Code Samples|
 +
description=This example attempts to restore you to full health if you have less than half of your possible HP.|
 +
code=
 +
<syntaxhighlight>
 +
if(my_hp() < (my_maxhp() / 2)) {
 +
  restore_hp(my_maxhp());
 +
}
 +
</syntaxhighlight>
 +
}}|
 +
 
 +
see_also={{SeeAlso|my_maxmp|my_hp}}|
 +
special=When not logged in, this function returns 0.
 +
}}
 +
[[Category:Your Character]]

Latest revision as of 21:33, 21 May 2010

Function Syntax

int my_maxhp()

Returns your current maximum HP as an int.

Code Samples

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());
}

See Also

my_maxmp() | my_hp()

Special

When not logged in, this function returns 0.