Difference between revisions of "My maxmp"

From Kolmafia
Jump to navigation Jump to search
imported>ZammyWarrior
imported>Zarqon
(more links, better example, consistent formatting, logged-out info)
Line 1: Line 1:
'''int my_maxmp()'''<br/>
+
[[int]] [[my_maxmp()]]
Returns your highest possible MP level
+
 
 +
Returns the logged-in character's maximum MP level as an [[int]].
 +
 
 +
The following example attempts to ensure that you are able to cast Olfaction before adventuring:
 +
 
 +
<code>
 +
  [[location]] bountylocation = $location[Hole in the Sky];
 +
  if ([[my_maxmp()]] < [[mp_cost()|mp_cost]]($[[skill]][transcendant olfaction])) {
 +
    [[print()|print]]("You are unable to cast Olfaction.","red");
 +
  } else {
 +
    [[restore_mp()|restore_mp]]([[mp_cost()|mp_cost]]($[[skill]][transcendant olfaction]));
 +
  }
 +
  [[adventure()|adventure]]([[my_adventures()]],bountylocation);
 +
</code>
 
[[Category:Your Character | My maxmp()]]
 
[[Category:Your Character | My maxmp()]]
 
[[Category:Ash Functions |My maxmp()]]
 
[[Category:Ash Functions |My maxmp()]]
<pre>if(my_mp() == 0){
+
 
restore_mp(mymax_mp());
+
When not logged in, this function returns 0.
} </pre>
 

Revision as of 14:51, 29 January 2009

int my_maxmp()

Returns the logged-in character's maximum MP level as an int.

The following example attempts to ensure that you are able to cast Olfaction before adventuring:

 location bountylocation = $location[Hole in the Sky];
 if (my_maxmp() < mp_cost($skill[transcendant olfaction])) {
   print("You are unable to cast Olfaction.","red");
 } else {
   restore_mp(mp_cost($skill[transcendant olfaction]));
 }
 adventure(my_adventures(),bountylocation);

When not logged in, this function returns 0.