Winterbay's Helpful Automatic Monsterbasher (WHAM)

Winterbay

Active member
Hmmm... Somehow SS did not set the roundnumber to maxrounds when the fight ended, but continued to parse the round-number so that it was set to 3 when control was passed back to WHAM. That sounds like a SS-bug. I'll re-post it over there I think.
 

fronobulax

Developer
Staff member
Characters are sober and latest versions ran fine.

I prefer a high level of automation and will gladly trade optimality in play for increased automation. I get impatient when WHAM turns over control to me and then when I finish combat have to restart bccascend and have it (re)check everything. I actually think about using the "a" word (as in it "a"s me) when I get manual control and then one hit the monster. I get confused when neither SmartStasis or WHAM casts entangling noodles. I do note that sometimes I get hit pretty badly before control is given to me which makes me question some of the upstream decision making - upstream all the way back to the decision to adventure in that place ;-)

So, if my goal is to maximize automation and only stop to avoid Beaten Up what parameters should I be paying attention to? What verbosity is going to be helpful to help explain why decisions are being made? Is there any automagic way to detect that BatBrain and KoL have different ideas about monster stats or is that something I need to check manually if it seems to be the same monster that stops automation without any other obvious reason.

Thanks for the work. I always feel a little impressed when WHAM decides to two hit a monster with a lower cost spell.
 

Winterbay

Active member
Getting the script to not abort is easier the more skills you have available, as the script will have more options to analyse and build a potential solution with. However a general tips is to make sure you have enough MP to cast some somewhat heavy skills, as this will make sure the script has at least one option available. Another is to make sure you have enough HP to survive a few hits from the monsters in question since that will also increase the amount of available options.

An idea I just had was to add an option to let the script execute the best 5-skill combo and then recalculate no matter if it thinks it'll kill the monster in 5 turns or not, iff you will survive more than that number of hits. The script also has a slight problem parsing stunning done before the calculations take place meaning that even if you may survive for more than 3 rounds because you have stunned the monster the script won't always realise this.
 

zanmatoer

Member
I think this is WHAM rather than BatBrain related, but WHAM seems to be massively over-using Broadside.

It is an amazing skill (4 round stun is kinda ridiculous), but it does cost 10mp. WHAM appears to use it in 90% of combats, which is causing significant meat drain! Usually a single Mighty Axing will do the job, especially as WHAM (almost) always opens with a bellow.

Other than that, WHAM is awesome, so thanks!
 

Winterbay

Active member
Yeah, I've been noticing this as well. It's not been a big problem for me as I've gotten used to using a double-ice cap as headgear for most of the round so I generally have way too much MP anyway, but it can be a problem. I'll see if I can move the check for that further along (when we know how we will end the fight).
 

Theraze

Active member
What probably needs to happen (and I was starting to test on my local copy of DAM) is something like
Code:
   if (round < maxround && !is_our_huckleberry() && get_action($skill[broadside]).stun > 0 &&
        m_dpr(0,0)*(kill_rounds(attack_action() < 5 ? kill_rounds(attack_action() - 1 : 4)*meatperhp > mp_cost($skill[broadside])*meatpermp)
      macro(get_action($skill[broadside]));
That's using the code I'd left in SmartStasis... I actually completely removed it from my DAM and let it decide when to use it, no custom code at all, and it generally only uses it when it seems to make sense. :) Usually. There's still some of that "why did you want to delevel and stun them if you're going to one-hit them anyways!" pondering, but...
 

Winterbay

Active member
I've added a stun()-function to my local copy and will be tweaking that to something that may or may not be similar to the above. The problem is that kill_rounds(attack_action()) won't give me very much useful information since the entire point of WHAM is to pick a combination of skills for most of the time, so I'll have to find another solution.
 

Theraze

Active member
Yeah... but if you have access to how many items are on the enqueue stack total, you should know how many rounds you're taking, right? Not sure... does BatBrain allow access to total stack size yet?
 

zanmatoer

Member
Very true about the double-ice cap. Broadside becomes a big problem in places like the pirate cove pre-fledges and the war (although less-so). Anywhere where you can't wear the massively overpowered ice cap, basically :D

WHAM also seems to underestimate the damage a single Mighty Axing will do on my main (who now starts with full Feasting and most of Shouting), but calculates it more accurately on my multi with much less banked skills. Not really sure as to the actual reason, though.

EDIT: What's the most effective way to disable Broadside completely until the issue is fixed (assuming Winterbay isn't so awesome that it'll be fixed up real quick)?
 
Last edited:

Winterbay

Active member
The quickest way is to not learn it :)
Apart form that you can search for the function-calls to stun() and comment them out with //.

That said 1.9 has been uploaded which, hopefully, should not stun as much with broadside (or intimidate as much) as 1.8. Let me know if it's working or not as I just got Broadside today so won't be able to see any effect of it until tomorrow.
 

zanmatoer

Member
Awesome!

It still appears to be overusing Broadside, but to a much less extreme extent. I think the problem might lie with BatBrain's estimation of how much damage Mighty Axing does.

I can't really comment on WHAM's usage of Bellow, as I'm doing the war currently, where bellowing makes perfect sense every battl- scratch that, WHAM just killed a dook in the barn without bellowing first! I think the new incarnation is a significant improvement that'll be perfected when Mighty Axing's damage is better spaded.

Thanks again.
 

Donavin69

Member
I'm having a problem that when a monster is stasised for long enough that it ends up dieing before Wham tries to kill it, I get an abort.

Sorry for the really long code, but that's how the fight goes. It doesn't happen all the time, but frequently enough for me to turn up Verbosity to capture this:
PHP:
[36640] Icy Peak
Encounter: Knott Yeti
Strategy: C:\KOLMafia\ccs\default.ccs [knott yeti]
Round 0: cheesecake_baby wins initiative!
Round 1: cheesecake_baby tries to steal an item!
Round 2: Richard Cheese climbs up and sits on your shoulder, and hands you some Meat. Huh, where did he find that?
You gain 65 Meat.
Running ZLib version: r35 (current)
Starting Don's Icy Peak script
Foe is Knott Yeti
Round 2: cheesecake_baby casts RUN LIKE THE WIND!
Round 3: knott yeti takes 8 damage.
You lose 7 hit points
Round 3: cheesecake_baby casts BREAK IT ON DOWN!
Round 4: knott yeti takes 10 damage.
Round 4: cheesecake_baby casts POP AND LOCK IT!
Round 5: knott yeti takes 19 damage.
You acquire an effect: Rave Nirvana (duration: 1 Adventure)
Round 5: cheesecake_baby casts DISCO DANCE OF DOOM!
Round 6: knott yeti takes 7 damage.
Round 6: knott yeti drops 5 attack power.
Round 6: knott yeti drops 5 defense.
Round 6: cheesecake_baby casts DISCO DANCE II: ELECTRIC BOOGALOO!
Round 7: knott yeti takes 8 damage.
You acquire an effect: Disco Nirvana (duration: 1 Adventure)
Round 7: knott yeti drops 7 attack power.
Round 7: knott yeti drops 7 defense.
Round 7: Richard Cheese's bells jingle merrily.
Finished Don's Icy Peak script
Running ZLib version: r35 (current)
1 HP costs 10μ. ( 758 / 765 )
1 MP costs 17μ. ( 284 / 761 )
Factoring in Mayflower bouquet: 0 damage, stun 0.065
Running BatBrain version: 1.20 (current)
Running SmartStasis version: 3.14 (current)
Running WHAM version: 1.9 (current)
WHAM: We currently think that the round number is: 0
WHAM: No need to do anything with this monster.
yeti fur (30.0 @ +40.0): 92μ * 42.0% = 38.64
Value of stat gain: 390.16μ
No valid attacks.
No valid attacks.
No valid attacks.
No valid attacks.
No valid attacks.
yeti fur (30.0 @ +40.0): 92μ * 42.0% = 38.64
Value of stat gain: 390.16μ
ATT: 103 (6% × 3.45, death in 3660)
DEF: 90 (95.45% × 517.25 (25), win in 2)
HP: 48, Value: 1,702.9 μ
Parsed round number: 7
WHAM: We currently think that the round number is: 7
WHAM: You have no profitable MP restoratives.
WHAM: You have no profitable HP restoratives.
WHAM: Setting up variables via BatBrain
WHAM: Monster HP is 48.0.
WHAM: Running SmartStasis
Profit per round: ActionProfitDamageOtherbase; Mayflower bouquet; Hobo Monkey (75μ)75μ--
yeti fur (30.0 @ +40.0): 92μ * 42.0% = 38.64
yeti fur (30.0 @ +40.0): 92μ * 42.0% = 38.64
Value of stat gain: 390.16μ
Attack action chosen: use 2646
Queued: skill 50; skill 52; skill 51
Constructed macro: scrollwhendone; sub batround; if haseffect 8 || haseffect 264 || haseffect 282 || haseffect 283 || haseffect 284; abort "BatBrain abort: poisoned"; endif; if pastround 49; abort "Stopping fight because it has gone on for too long (set WHAM_maxround to a higher value if you think this was in error)"; endif; endsub; ; call batround; skill 50; skill 52; skill 51; call batround; 
Round 7: cheesecake_baby executes a macro!
Round 7: cheesecake_baby casts BREAK IT ON DOWN!
Round 8: knott yeti takes 6 damage.
Round 8: cheesecake_baby casts RUN LIKE THE WIND!
Round 9: knott yeti takes 10 damage.
Round 9: cheesecake_baby casts POP AND LOCK IT!
Round 10: knott yeti takes 15 damage.
You acquire an item: yeti fur
Happened: skill 50
Happened: skill 52
Happened: skill 51
Parsed round number: 10
You snatched a yeti fur (92μ)!
Value of stat gain: 390.16μ
Revised monster value: 1,664.26
Happened: stolen
Stasis action chosen: skill 5021 (profit: 73.0)
Value of stat gain: 390.16μ
Attack action chosen: use 1705
Queued: skill 5021
Constructed macro: scrollwhendone; sub batround; if haseffect 8 || haseffect 264 || haseffect 282 || haseffect 283 || haseffect 284; abort "BatBrain abort: poisoned"; endif; if pastround 49; abort "Stopping fight because it has gone on for too long (set WHAM_maxround to a higher value if you think this was in error)"; endif; endsub; sub finito; skill 5021; call batround; endsub; call finito; repeat hasskill 5021 && (!hpbelow 758.0 && hpbelow 765 && !mpbelow 278.0 && !pastround 25 && !match "hands you some Meat")
Round 10: cheesecake_baby executes a macro!
Round 10: cheesecake_baby casts SUCKERPUNCH!
Round 11: knott yeti takes 1 damage.
Round 11: knott yeti drops 1 attack power.
Round 11: knott yeti drops 1 defense.
Round 11: cheesecake_baby casts SUCKERPUNCH!
Round 12: knott yeti takes 1 damage.
Round 12: knott yeti drops 1 attack power.
Round 12: knott yeti drops 1 defense.
Round 12: Richard Cheese holds out the Mayflower bouquet toward your opponent. He stops to smell the flowers instead of attacking you.
Round 12: cheesecake_baby casts SUCKERPUNCH!
Round 13: knott yeti takes 1 damage.
Round 13: knott yeti drops 1 attack power.
Round 13: knott yeti drops 1 defense.
Round 13: cheesecake_baby casts SUCKERPUNCH!
Round 14: knott yeti takes 1 damage.
Round 14: knott yeti drops 1 attack power.
Round 14: knott yeti drops 1 defense.
Round 14: Richard Cheese holds out the Mayflower bouquet toward your opponent. He stops to smell the flowers instead of attacking you.
Round 14: cheesecake_baby casts SUCKERPUNCH!
Round 15: knott yeti takes 1 damage.
Round 15: knott yeti drops 1 attack power.
Round 15: knott yeti drops 1 defense.
Round 15: cheesecake_baby casts SUCKERPUNCH!
Round 16: knott yeti takes 1 damage.
Round 16: knott yeti drops 1 attack power.
Round 16: knott yeti drops 1 defense.
Round 16: cheesecake_baby casts SUCKERPUNCH!
Round 17: knott yeti takes 1 damage.
Round 17: knott yeti drops 1 attack power.
Round 17: knott yeti drops 1 defense.
Round 17: cheesecake_baby casts SUCKERPUNCH!
Round 18: knott yeti takes 1 damage.
Round 18: knott yeti drops 1 attack power.
Round 18: knott yeti drops 1 defense.
Round 18: Richard Cheese holds out the Mayflower bouquet toward your opponent. He stops to smell the flowers instead of attacking you.
Round 18: cheesecake_baby casts SUCKERPUNCH!
Round 19: knott yeti takes 1 damage.
Round 19: knott yeti drops 1 attack power.
Round 19: knott yeti drops 1 defense.
Round 19: cheesecake_baby casts SUCKERPUNCH!
Round 20: knott yeti takes 1 damage.
Round 20: knott yeti drops 1 attack power.
Round 20: knott yeti drops 1 defense.
Round 20: cheesecake_baby casts SUCKERPUNCH!
Round 21: knott yeti takes 1 damage.
Round 21: knott yeti drops 1 attack power.
Round 21: knott yeti drops 1 defense.
Round 21: cheesecake_baby casts SUCKERPUNCH!
Round 22: knott yeti takes 1 damage.
Round 22: knott yeti drops 1 attack power.
Round 22: knott yeti drops 1 defense.
Round 22: cheesecake_baby casts SUCKERPUNCH!
Round 23: knott yeti takes 1 damage.
Round 23: knott yeti drops 1 attack power.
Round 23: knott yeti drops 1 defense.
Round 23: Richard Cheese's bells jingle merrily.
Round 23: cheesecake_baby casts SUCKERPUNCH!
Round 24: knott yeti takes 1 damage.
Round 24: knott yeti drops 1 attack power.
Round 24: knott yeti drops 1 defense.
Round 24: cheesecake_baby casts SUCKERPUNCH!
Round 25: knott yeti takes 1 damage.
Round 25: knott yeti drops 1 attack power.
Round 25: knott yeti drops 1 defense.
Round 25: cheesecake_baby casts SUCKERPUNCH!
Round 26: knott yeti takes 1 damage.
Round 26: knott yeti drops 1 attack power.
Round 26: knott yeti drops 1 defense.
Round 26: cheesecake_baby wins the fight!
After Battle: Richard Cheese sits on your fallen opponent's body, blows a smoke ring, and winks at you.
You gain 1419 Meat
You gain 3 Strengthliness
You gain 14 Wizardliness
You gain 15 Chutzpah
Happened: skill 5021
Happened: skill 5021
Happened: skill 5021
Happened: skill 5021
Happened: skill 5021
Happened: skill 5021
Happened: skill 5021
Happened: skill 5021
Happened: skill 5021
Happened: skill 5021
Happened: skill 5021
Happened: skill 5021
Happened: skill 5021
Happened: skill 5021
Happened: skill 5021
Happened: skill 5021
Parsed round number: 26
Stasis action chosen: use 2678 (profit: 75.02)
No valid attacks.
WHAM: SmartStasis complete.
WHAM: We currently think that the round number is: 26
WHAM: Starting evaluation and performing of attack
WHAM: We currently think that the round number is: 26
WHAM: You will kill the monster in 2 rounds with your basic attack.
WHAM: The monster will take more than 30 rounds to kill you.
WHAM: Monster is weak. We are just going to bash its head in. It'll take 2 rounds.
Parsed round number: 0
WHAM: Empty macro generated. Please check, aborting.
You're on your own, partner.

Any advice as to what I should change to make this not abort?
 

Winterbay

Active member
I see two problems : 1) Batbrain failed to set the round number to 31 when the fight ended and thus WHAM did not abort correctly and 2) SS tries to Stasis even though your Hobo Monkey has already handed you its meat (probably because that happened before WHAM/SS was called) thereby prolonging the fight more than strictly profitable.
I've actually got no idea how to solve any of those...

I guess changing all if(finished()) to if(finished() || contains_text(page, "WINWINWIN")) may work for the first issue though.
 

Donavin69

Member
I guess changing all if(finished()) to if(finished() || contains_text(page, "WINWINWIN")) may work for the first issue though.
I modified my version of BatBrain to have the boolean finished() return true if the page contained WINWINWIN and I didn't have any problems today :)

Thanks!
 

fronobulax

Developer
Staff member
Nit - WHAM considers Lunging Thrust Smack even when the weapon is ranged.

Observation - "WHAM: The fight has gone on for longer than your WHAM_maxround setting. Reverting power to manual." gets pretty consistently printed when WHAM loses a fight. No message or one indicating that WHAM knows the fight is over and lost would be more useful, IMO.

Tangent - Would someone please remind me why "KoLmafia thinks it is round 3 but KoL thinks it is round 2" is a useful message and not just clutter that has been OBE and could be removed?

Thanks.

Edit: "considers" above as in lists it as a possible option when WHAM reverts to manual control in the relay browser.
 

Winterbay

Active member
1) Hmm... It shouldn't do that. It goes over iterateskills, which in turns comes from allMySkills which in turn is encapsulated in ok()-calls and LTS should not be OK if your weapon is ranged. ANy specific weapon or all ranged weapons?

2) Yes, I noticed that today as well and will have a look at it.

3) Ehhm... I don't think it is. That said the reason for the message coming up so much at the moment is that SmartStasis submits an empty macro for one round which makes KoL and Mafia get out of sync in regards to the round of the battle.
 

Veracity

Developer
Staff member
Would someone please remind me why "KoLmafia thinks it is round 3 but KoL thinks it is round 2" is a useful message and not just clutter that has been OBE and could be removed?
Arrogant, a little? Not that I know what "OBE" is supposed to mean; the first two google hits - Order of the British Empire and Out of Body Experience - are, possibly, the only ways I've actually seen that acronym used.

We don't depend on things by round number any more, so tracking round number is primarily cosmetic: for us to display in the gCLI and session logs, the title of Fight! pages. We also pass the round number to consult scripts, for them to do with what they wish. It would be nice if our tracking were accurate.

However, since KoL itself tells us in an HTML comment what it thinks the round number is, it seems to me that we could just extract that and save it and use it for the above purposes: logging, the title bar and consult scripts.

KoLmafia's message HAS proven useful: RoyalTonberry told me that he discovered that such-and-such an action did not consume a round specifically because KoLmafia told him about losing synch when he did it. Does that make it a spading tools? :) Regardless, synching up with KoL's round number would still let you notice things like that.

The tricky thing is to make sure that logging continues to look the same, in my opinion.
 

fronobulax

Developer
Staff member
Overtaken By Events.

I could have phrased the round question better but I did remember a lot of discussion and I thought it was one of those things that could go away. Since it had not gone away I figured my memory is faulty. I was thinking it was primarily cosmetic but if it is useful for spading (and I now understand how) I can live with it. Either way my curiosity behind the question has been addressed.

17-alarm Saucepan which is not the ranged weapon that I thought it was. Would someone please pass me my crow sandwich?
 

fronobulax

Developer
Staff member
Well after my faux pas concerning ranged saucepans, I hesitate to say anything but...

Sauceror. In Junkyard.
WHAM: Unable to determine a valid combat strategy. For your benefit here are the numbers for you combat skills.
WHAM: Lunging Thrust-Smack 9.976151 potential damage.
WHAM: Basic attack 3.9240494 potential damage with a hitchance of 8.795455%.

Since I have adequate MO and several combat damage spells available this is not the list I was expecting. Operator error again or something else?
 
Top