Appearance rates: Difference between revisions
Jump to navigation
Jump to search
imported>Bale format fix |
imported>Bale No edit summary |
||
Line 17: | Line 17: | ||
}}| | }}| | ||
function_description=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.| | function_description=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.</p> | ||
<p>If there is a chance of non-combat encounters, that will be listed as the chance of encountering $monster[none].| | |||
code1={{CodeSample| | code1={{CodeSample| | ||
Line 24: | Line 25: | ||
code= | code= | ||
<syntaxhighlight> | <syntaxhighlight> | ||
foreach mob, freq in appearance_rates($location[Dungeon of Doom]) | |||
switch { | |||
case mob == $monster[none]: | |||
if(freq > 0) print("Frequency of non-combats: "+ freq + "%"); | |||
break; | |||
case freq > 0: | |||
print("Frequency of " + mob + ": " + freq + "%"); | |||
break; | |||
} | case freq == 0: | ||
print("Frequency of " + mob + ": Boss (one time encounter) or semirare encounter."); | |||
break; | |||
case freq < -1: | |||
print("Frequency of " + mob + ": Ultra-rare!"); | |||
break; | |||
case freq == -1: | |||
print("Frequency of " + mob + ": Unknown"); | |||
break; | |||
} | |||
</syntaxhighlight>}}| | </syntaxhighlight>}}| | ||
see_also={{SeeAlso|get_monsters|last_monster}}| | |||
special=When not logged in, this function still returns the same data, as it is pulled from KoLmafia's data files.| | special=When not logged in, this function still returns the same data, as it is pulled from KoLmafia's data files.| | ||
}} | }} |
Revision as of 04:11, 6 May 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.
If there is a chance of non-combat encounters, that will be listed as the chance of encountering $monster[none].
Simple Example
Prints the encounters in a zone and their rates of appearing.
foreach mob, freq in appearance_rates($location[Dungeon of Doom])
switch {
case mob == $monster[none]:
if(freq > 0) print("Frequency of non-combats: "+ freq + "%");
break;
case freq > 0:
print("Frequency of " + mob + ": " + freq + "%");
break;
case freq == 0:
print("Frequency of " + mob + ": Boss (one time encounter) or semirare encounter.");
break;
case freq < -1:
print("Frequency of " + mob + ": Ultra-rare!");
break;
case freq == -1:
print("Frequency of " + mob + ": Unknown");
break;
}
See Also
Special
When not logged in, this function still returns the same data, as it is pulled from KoLmafia's data files.