Appearance rates: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Heeheehee
No edit summary
imported>Heeheehee
mNo edit summary
Line 24: Line 24:
<syntaxhighlight>
<syntaxhighlight>
float[monster] freq = appearance_rates($location[Castle]);
float[monster] freq = appearance_rates($location[Castle]);
print(
print("Encounters in the Castle:");
foreach m in freq {
foreach m in freq {
   string str = m.to_string();
   string str = m.to_string();

Revision as of 19:06, 6 March 2010



Function Syntax

float [monster] appearance_rates(location place )

  • place is the adventuring location to parse

Returns a map, keyed by monster, with the appearance rate percentages as decimal values (ie a 30% rate monster has a value of 30.0). Bosses, semirare encounters, and other one-time-only monsters have a value of 0.0; ultra-rare monsters have a negative value (the actual value varies; test by looking for value < 0, not value == -1). Does not account for combat rate modifiers, olfaction, etc.

Simple Example

Prints the encounters in a zone and their rates of appearing.

float[monster] freq = appearance_rates($location[Castle]);
print("Encounters in the Castle:");
foreach m in freq {
   string str = m.to_string();
   if(str=="none") str = "Noncombats";
   if(freq[m]>0 && m != $monster[none]) print("Frequency of " + str + ": " + freq[m] + "%");
   if(freq[m]==-1) print("Frequency of " + str + ": Unknown");
   else print("Frequency of " + str + ": Unlikely (either semirare, boss, or ultra-rare)");
}

special=When not logged in, this function still returns the same data, as it is pulled from KoLmafia's data files.