Adv cost: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Darzil
Created page with "{{ #vardefine:name|adv_cost}}{{ #vardefine:return_type|int}}{{ FunctionPage| name={{#var:name}}| function1={{Function| name={{#var:name}}| aggregate={{#var:aggregate}}| ret..."
 
imported>Relyk
little more readable
 
(One intermediate revision by one other user not shown)
Line 16: Line 16:
}}|
}}|


function_description=Returns the adventure cost for the next cast of the given skill {{pspan|use_me}}.}}
function_description=Returns the adventure cost for the next cast of the given skill {{pspan|use_me}}.|
 
code1={{CodeSample|
title=Code Samples|
description=Checks if the skill will use adventures and asks to confirm before using the skill.|
code=
<syntaxhighlight>
boolean use_skill_confirm(skill sk) {
  if(adv_cost(sk) > 0) {
      string confirmMessage = "This skill will cost " + adv_cost(sk) + " adventures if you cast it."
                              + "\n Do you want to continue?";
      return user_confirm(confirmMessage) && use_skill(1, sk);
  }
}
</syntaxhighlight>
}}|
see_also={{SeeAlso|soulsauce_cost|mp_cost}}|
 
}}


[[Category:Skills and Effects]]
[[Category:Skills and Effects]]

Latest revision as of 22:56, 17 October 2015

Function Syntax

int adv_cost(skill use_me )

  • use_me is the skill to check the cost of

Returns the adventure cost for the next cast of the given skill use_me.

Code Samples

Checks if the skill will use adventures and asks to confirm before using the skill.

boolean use_skill_confirm(skill sk) {
   if(adv_cost(sk) > 0) {
      string confirmMessage = "This skill will cost " + adv_cost(sk) + " adventures if you cast it."
                              + "\n Do you want to continue?";
      return user_confirm(confirmMessage) && use_skill(1, sk);
   }
}

See Also

soulsauce_cost() | mp_cost()