Goal exists

From Kolmafia
Revision as of 02:57, 5 November 2014 by imported>Bale (r10756)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function Syntax

boolean goal_exists(string type )

  • type is checked to see if it is a goal. Valid goal types are:
    • choiceadv
    • autostop,
    • meat
    • health
    • mana
    • item

This function returns true if there are any goals that match type.

CodeSample

Version of is_goal() that accepts a stat and return true if it is a goal.

boolean is_goal( stat gstat ) {
   matcher stat_goal = create_matcher( "\\d+ "+to_lower_case(gstat), g );
   foreach i,g in get_goals() 
      if( stat_goal.find() )
         return true;
   return false;
}

See Also

adventure() | add_item_condition() | get_goals() | is_goal()