Difference between revisions of "Adv cost"

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>Bale
(add code and see also)
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=Asks user if they want to abort rather than expend adventures by casting a skill.|
 +
code=
 +
<syntaxhighlight>
 +
void adv_check(skill sk) {
 +
  if(adv_cost(sk) > 0 && user_confirm("This skill will cost " + adv_cost(sk) + " adventures if you cast it. \n Do you want to continue?"))
 +
      abort("Aborted by user because skill costs adventures to cast!");
 +
}
 +
</syntaxhighlight>
 +
}}|
 +
see_also={{SeeAlso|soulsauce_cost|mp_cost}}|
 +
 
 +
}}
  
 
[[Category:Skills and Effects]]
 
[[Category:Skills and Effects]]

Revision as of 06:45, 4 November 2014

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

Asks user if they want to abort rather than expend adventures by casting a skill.

void adv_check(skill sk) {
   if(adv_cost(sk) > 0 && user_confirm("This skill will cost " + adv_cost(sk) + " adventures if you cast it. \n Do you want to continue?"))
      abort("Aborted by user because skill costs adventures to cast!");
}

See Also

soulsauce_cost() | mp_cost()