Restore hp: Difference between revisions
imported>Grotfang mNo edit summary |
imported>Bale target 0 |
||
Line 17: | Line 17: | ||
}}| | }}| | ||
function_description=Restores your HP, following your current recovery settings as closely as possible. This function only attempts to surpass {{pspan|target}}, not to arrive as closely as possible to it. If your current KoLmafia recovery settings are lower than your current HP (or off), this function will restore the bare minimum necessary to reach {{pspan|target}} using the restores you have checked. If, however, you have your recovery setting set to "Try to recover up to 100% health," this function will follow that preference if possible. This function will do nothing and return false if you have not checked any restore items. Otherwise, this function returns true if your HP is at or equal to {{pspan|target}} when finished. If {{pspan|target}} is set above your current max HP, this function will attempt to restore to that amount and report its success based on that goal, not the number used for {{pspan|target}}.| | function_description=Restores your HP, following your current recovery settings as closely as possible. This function only attempts to surpass {{pspan|target}}, not to arrive as closely as possible to it. If your current KoLmafia recovery settings are lower than your current HP (or off), this function will restore the bare minimum necessary to reach {{pspan|target}} using the restores you have checked. If, however, you have your recovery setting set to "Try to recover up to 100% health," this function will follow that preference if possible.</p> | ||
<p>If {{pspan|target}} is zero then it will restore HP according to KoLmafia's recovery settings.</p> | |||
<p>This function will do nothing and return false if you have not checked any restore items. Otherwise, this function returns true if your HP is at or equal to {{pspan|target}} when finished. If {{pspan|target}} is set above your current max HP, this function will attempt to restore to that amount and report its success based on that goal, not the number used for {{pspan|target}}.| | |||
code1={{CodeSample| | code1={{CodeSample| |
Revision as of 08:00, 3 May 2010
Function Syntax
boolean restore_hp(int target )
- target is the minimum HP desired after the function is run.
Restores your HP, following your current recovery settings as closely as possible. This function only attempts to surpass target, not to arrive as closely as possible to it. If your current KoLmafia recovery settings are lower than your current HP (or off), this function will restore the bare minimum necessary to reach target using the restores you have checked. If, however, you have your recovery setting set to "Try to recover up to 100% health," this function will follow that preference if possible.
If target is zero then it will restore HP according to KoLmafia's recovery settings.
This function will do nothing and return false if you have not checked any restore items. Otherwise, this function returns true if your HP is at or equal to target when finished. If target is set above your current max HP, this function will attempt to restore to that amount and report its success based on that goal, not the number used for target.
Code Sample
This sample attempts to restore your HP to full.
if (my_hp() < my_maxhp()) {
restore_hp(my_maxhp());
}
CLI Equivalent
The CLI command "restore" has similar functionality.
See Also
my_hp() | my_mp() | my_maxhp() | my_maxmp() | restore_mp()