Difference between revisions of "My maxmp"

From Kolmafia
Jump to navigation Jump to search
imported>Grotfang
m (moved My maxmp() to My maxmp: Conformity)
imported>Grotfang
(Conform to template)
Line 1: Line 1:
[[int]] [[my_maxmp()]]
+
{{#vardefine:name|my_maxmp}}
 +
{{#vardefine:return_type|int}}
  
Returns the logged-in character's maximum MP level as an [[int]].
+
{{FunctionPage|
 +
name={{#var:name}}|
 +
function_category=Your Character|
  
The following example attempts to ensure that you are able to cast Olfaction before adventuring:
+
function1={{Function|
 +
name={{#var:name}}|
 +
aggregate={{#var:aggregate}}|
 +
return_type={{#var:return_type}}|
 +
return_also={{#var:return_also}}
 +
}}|
  
<code>
+
function_description=Returns the logged-in character's maximum MP level as an int.|
  [[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:Ash Functions |My maxmp()]]
 
  
When not logged in, this function returns 0.
+
code1={{CodeSample|
 +
title=Code Samples|
 +
description=The following example attempts to ensure that you are able to cast Olfaction before adventuring.|
 +
code=
 +
<syntaxhighlight>
 +
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);
 +
</syntaxhighlight>
 +
}}|
 +
 
 +
see_also={{SeeAlso|my_maxhp|mp_cost|restore_mp|my_advetures}}|
 +
special=When not logged in, this function returns 0.
 +
}}

Revision as of 13:26, 1 March 2010



Function Syntax

int my_maxmp()

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

Code Samples

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

See Also

my_maxhp() | mp_cost() | restore_mp() | my_advetures()

Special

When not logged in, this function returns 0.