Trying to target a specific monster in appearance_rates

Theraze

Active member
Trying to see if there's a good way to decide if a monster is a wandering/non-standard in a zone. The best option I've found so far appears to be checking
Code:
boolean monsterfound = false; foreach mon,rate in appearance_rates(my_location()) if (mon == last_monster() && rate > 0) monsterfound = true;
but if it's possible to go straight to
Code:
if (appearance_rates(my_location())[last_monster()] > 0)
that would be significantly easier... for me, at least. :) Is that sort of thing actually possible, or is my first (working) code the best way to do this?

Basically, trying to come up with some good avoidance for the windchimes/phones getting broken in WHAM (cause by BatBrain saying they're always good in those locations) and running 13 thousand attempted turns. That's a whole lot of wasted server hits. Winterbay can hardcode the item as an override, but if there's a good way to make BatBrain smarter without needing to keep calling slow and messy code, I can actually suggest fixing the root in a useful way rather then just muttering to myself. :)
 

nworbetan

Member
If you run that second line by itself in the gcli, it'll complain about the syntax, but this:
Code:
float [monster] rate = appearance_rates(my_location()); if (rate[last_monster()] > 0)
is nearly as short, and looks valid to me.

disclaimer: I have no clue what the contents of appearance_rates() actually are, so I'm completely trusting that you know what you're doing with that info. :p
 
Last edited:

Theraze

Active member
Winterbay's suggestion is probably what I should suggest for BatBrain, since even if it's an unknown rate, any valid monster for that zone should be noted as such, and we expect items for their zone to be usable. :) Thanks!
 

Theraze

Active member
> ash my_location()

Returned: Fantasy Airship
nocombats => false
zone => Beanstalk
parent => Plains
parentdesc => Nearby Plains
bounty => burned-out arcanodiode

> ash last_monster()

Returned: none
base_hp => 0
base_attack => 0
base_defense => 0
base_initiative => 0
attack_element => none
defense_element => none
min_meat => 0
max_meat => 0
base_mainstat_exp => 0.0
phylum => none
poison => none
boss => false

> ash appearance_rates(my_location())[last_monster()]

Returned: 25.0
Shiny. :) Thanks hola.

Amusingly, that's the current rate for 'none' (non-combats) at the Fantasy Airship. Did we actually have an easy way to check mafia's current noncombat rates for specific zones? Because we do now... :)
 

Bale

Minion
Amusingly, that's the current rate for 'none' (non-combats) at the Fantasy Airship. Did we actually have an easy way to check mafia's current noncombat rates for specific zones? Because we do now... :)

Combat rate for $monster[none] has been the only way I know to do that, but now it is easier to do.
 

zarqon

Well-known member
ZLib's has_goal() has been checking that since it existed. :)

Also, what suggestion for BatBrain? Getting back to scripting after a two-week hiatus due to the world's recent "prevent Zarqon scripting" conspiracy. Going to check the BatBrain thread now...
 

Theraze

Active member
The suggestion was originally regarding wandering monsters with zone-specific items and skills... The specific case was the bugbear chefs during the war, as they aren't a valid target for chimes/phones, but BatBrain happily suggests them because they 'should' be. Same goes for wandering/holiday monsters in the war... BatBrain thinks they should be fine. Other affected areas would be things like holiday monsters under water... guessing that summon levituga would probably fail there, etc.
 
Top