Difference between revisions of "All monsters with id"

From Kolmafia
Jump to navigation Jump to search
(Created page with "<onlyinclude>{{{{{format|Function2}}} |name=all_monsters_with_id |function1.return_type={{type|boolean}} {{opt|{{type|monster}}}} |function1.description=Returns a map of all m...")
 
(No difference)

Latest revision as of 11:54, 23 December 2020

Function Syntax

boolean [monster] all_monsters_with_id()

Returns a map of all monsters that have a non-zero monster ID.

This function always retrieves the up-to-date internal list of known monsters. This function is needed because $monsters[] contains a list of monsters that is fixed when an ASH script begins execution, and does not change while the script is running. (See this post for explanation)

Code Samples

Show all monsters that drop at least 200 meat.

foreach mon in all_monsters_with_id()
{
   if ( mon.min_meat >= 200 )
   {
      print( `{mon}: {mon.min_meat}-{mon.max_meat}` );
   }
}