Difference between revisions of "Get monsters"

From Kolmafia
Jump to navigation Jump to search
imported>Grotfang
imported>Grotfang
Line 23: Line 23:
 
code=
 
code=
 
<syntaxhighlight>
 
<syntaxhighlight>
CODE GOES HERE
+
monster [int] monster_list = get_monsters($location[giant castle]);
 +
float total_meat = 0;
 +
int counter = 0;
 +
foreach int in monster_list {
 +
  total_meat = total_meat + monster_drop(monster_list[int]);
 +
  counter = counter + 1;
 +
}
 +
float final = total_meat / counter;
 +
print(final);
 +
 
 
</syntaxhighlight>
 
</syntaxhighlight>
 
}}|
 
}}|
  
 
see_also={{SeeAlso|FIRST|SECOND|ETC}}|
 
see_also={{SeeAlso|FIRST|SECOND|ETC}}|
cli_equiv=LIST_CLI_EQUIVALENT_INFO|
 
more_info=A_LINE_TO_NOTIFY_OF_EXTERNAL_INFO|
 
 
special=SPECIAL_NOTES_SUCH_AS_NOT-LOGGED-IN_VALUE
 
special=SPECIAL_NOTES_SUCH_AS_NOT-LOGGED-IN_VALUE
 
}}
 
}}

Revision as of 02:34, 4 March 2010



Function Syntax

monster [int] get_monsters(location loc )

  • loc is the location you want to get the monsters for.

This function returns a map of every monster in a given location. Useful for iterating over for more specific information on an area.

Code Samples

This function returns predicted meat drop rates for a specified location.

monster [int] monster_list = get_monsters($location[giant castle]);
float total_meat = 0;
int counter = 0;
foreach int in monster_list {
   total_meat = total_meat + monster_drop(monster_list[int]);
   counter = counter + 1;
}
float final = total_meat / counter;
print(final);

See Also

FIRST() | SECOND() | ETC()

Special

SPECIAL_NOTES_SUCH_AS_NOT-LOGGED-IN_VALUE