SmartStasis -- a complex script for a simple CCS

Crowther

Active member
Is it possible for SmartStasis to detect that there is no longer a reason to extend a combat, once my Bjornified familiar has dropped his item, if that was the reason for stasis-ing? It doesn't seem to do this today.
It's has been working correctly for me. I'm not sure if it was today or yesterday, but I saw a mask drop and then a quick kill.
 

chown

Member
Huh. Yeah. I just tried it on a different character and it worked fine. I may have a chance to look at it a bit more some time today.
 

Crowther

Active member
Huh. Yeah. I just tried it on a different character and it worked fine. I may have a chance to look at it a bit more some time today.
If mafia somehow didn't see the item drop, then SmartStasis will try forever to get one. If you do manage to recreate this, check _grimstoneMaskDropsCrown or _grimFairyTaleDropsCrown. Those are the variable mafia uses to track this and which BatBrain checks.
 

chown

Member
Uh. The familiar in question is the Gluttonous Green Ghost. I don't think Mafia sets either of those variables when he drops a burrito. Or, am I just confused?
 

chown

Member
I tried a couple adventures with a BRICKO chick in the Bjorn, and that appears to work fine. Here's a sample fight with the Ghost:

Code:
Visit to Dungeon: Video Game Level 1 in progress...

[663413] Video Game Level 1
Encounter: bulbous gopher fodder
Strategy: G:\kol\kolmafia\ccs\fight_optimizer.ccs [default]
Round 0: awk wins initiative!
WHAM: Running SmartStasis
Round 1: awk executes a macro!
Round 1: awk casts CANDYBLAST!
Round 2: Video Game Minion (weak) takes 38 damage.
You acquire an item: Daffy Taffy
Round 2: Video Game Minion (weak) drops 4 attack power.
Round 2: Video Game Minion (weak) drops 2 defense.
Round 2: awk executes a macro!
Round 2: awk casts CANDYBLAST!
Round 3: Video Game Minion (weak) takes 38 damage.
Round 3: Gronald takes a burrito out of his Buddy Bjorn and hands it to you. You've never been one to refuse a free burrito, even when it was probably in your best interests.
You acquire an item: bean burrito
Round 3: awk executes a macro!
Round 3: awk casts CANDYBLAST!
Round 4: Video Game Minion (weak) takes 38 damage.
Round 4: Video Game Minion (weak) drops 4 attack power.
Round 4: Video Game Minion (weak) drops 3 defense.
Round 4: awk executes a macro!
Round 4: awk casts CANDYBLAST!
Round 5: Video Game Minion (weak) takes 38 damage.
Round 5: Video Game Minion (weak) drops 4 attack power.
Round 5: Video Game Minion (weak) drops 2 defense.
Round 5: awk executes a macro!
Round 5: awk casts CANDYBLAST!
Round 6: Video Game Minion (weak) takes 38 damage.
Round 6: Video Game Minion (weak) drops 3 attack power.
Round 6: Video Game Minion (weak) drops 3 defense.
Round 6: awk executes a macro!
Round 6: awk casts CANDYBLAST!
Round 7: Video Game Minion (weak) takes 75 damage.
Round 7: awk executes a macro!
Round 7: awk casts CANDYBLAST!
Round 8: Video Game Minion (weak) takes 38 damage.
Round 8: awk executes a macro!
Round 8: awk casts CANDYBLAST!
Round 9: Video Game Minion (weak) takes 38 damage.
Round 9: Video Game Minion (weak) drops 2 attack power.
Round 9: Video Game Minion (weak) drops 3 defense.
Round 9: awk executes a macro!
Round 9: awk casts CANDYBLAST!
Round 10: Video Game Minion (weak) takes 38 damage.
Round 10: awk executes a macro!
Round 10: awk casts CANDYBLAST!
Round 11: Video Game Minion (weak) takes 38 damage.
Round 11: Video Game Minion (weak) drops 4 attack power.
Round 11: Video Game Minion (weak) drops 3 defense.
Round 11: awk executes a macro!
Round 11: awk casts CANDYBLAST!
Round 12: Video Game Minion (weak) takes 38 damage.
Round 12: Video Game Minion (weak) drops 4 attack power.
Round 12: Video Game Minion (weak) drops 4 defense.
Round 12: awk executes a macro!
Round 12: awk casts CANDYBLAST!
Round 13: Video Game Minion (weak) takes 38 damage.
Round 13: Video Game Minion (weak) drops 4 attack power.
Round 13: Video Game Minion (weak) drops 4 defense.
Round 13: awk executes a macro!
Round 13: awk casts CANDYBLAST!
Round 14: Video Game Minion (weak) takes 38 damage.
Round 14: awk executes a macro!
Round 14: awk casts CANDYBLAST!
Round 15: Video Game Minion (weak) takes 38 damage.
Round 15: Video Game Minion (weak) drops 4 attack power.
Round 15: Video Game Minion (weak) drops 4 defense.
Round 15: awk executes a macro!
Round 15: awk casts CANDYBLAST!
Round 16: Video Game Minion (weak) takes 38 damage.
Round 16: awk executes a macro!
Round 16: awk casts CANDYBLAST!
Round 17: Video Game Minion (weak) takes 38 damage.
Round 17: awk executes a macro!
Round 17: awk casts CANDYBLAST!
Round 18: Video Game Minion (weak) takes 38 damage.
Round 18: awk executes a macro!
Round 18: awk casts CANDYBLAST!
Round 19: Video Game Minion (weak) takes 38 damage.
Round 19: Video Game Minion (weak) drops 4 attack power.
Round 19: Video Game Minion (weak) drops 2 defense.
Round 19: awk executes a macro!
Round 19: awk casts CANDYBLAST!
Round 20: Video Game Minion (weak) takes 38 damage.
Round 20: awk executes a macro!
Round 20: awk casts CANDYBLAST!
Round 21: Video Game Minion (weak) takes 38 damage.
Round 21: awk executes a macro!
Round 21: awk casts CANDYBLAST!
Round 22: Video Game Minion (weak) takes 38 damage.
Round 22: Video Game Minion (weak) drops 2 attack power.
Round 22: Video Game Minion (weak) drops 2 defense.
Round 22: awk executes a macro!
Round 22: awk casts CANDYBLAST!
Round 23: Video Game Minion (weak) takes 38 damage.
Round 23: awk executes a macro!
Round 23: awk casts CANDYBLAST!
Round 24: Video Game Minion (weak) takes 38 damage.
Round 24: Video Game Minion (weak) drops 2 attack power.
Round 24: Video Game Minion (weak) drops 2 defense.
Round 24: awk executes a macro!
Round 24: awk casts CANDYBLAST!
Round 25: Video Game Minion (weak) takes 38 damage.
Round 25: Video Game Minion (weak) drops 2 attack power.
Round 25: Video Game Minion (weak) drops 2 defense.
Round 25: Video Game Minion (weak) takes 7 damage.
Round 25: You lose 766 hit points
WHAM: Starting evaluation and performing of attack
WHAM: We are going to 2-shot with Stuffed Mortar Shell and Stuffed Mortar Shell.
Round 25: awk executes a macro!
Round 25: awk casts STUFFED MORTAR SHELL!
Round 26: Video Game Minion (weak) drops 4 attack power.
Round 26: Video Game Minion (weak) drops 2 defense.
WHAM: Starting evaluation and performing of attack
WHAM: We are going to 2-shot with Weapon of the Pastalord and Weapon of the Pastalord.
Round 26: awk executes a macro!
Round 26: awk casts WEAPON OF THE PASTALORD!
Round 27: Video Game Minion (weak) takes 5228 damage.
Round 27: Video Game Minion (weak) takes 5245 damage.
Round 27: awk wins the fight!
After Battle: You gain 8 Mana Points
After Battle: Gronald surveys the scene from your back and sighs.
After Battle: Tronald says, "the uncontrollable urge to dance is evidence of repressed sexual longing," and does a little soft-shoe.
After Battle: Flumflem pirouettes in the air, searching for scattered items. Maybe he was a pierougi in a past life.
After Battle: Tronald does a crazy dance around the Maypole.
You acquire an item: slice of pizza
You acquire an item: vial of holy water
After Battle: You gain 617 Strengthliness
After Battle: You gain 1625 Wizardliness
After Battle: You gain 610 Sarcasm

In mallmode, best MP restorative is: magical mystery juice @ 14659.154929577466 meat total.
In mallmode, best HP restorative is: scroll of drastic healing @ 358.6666666666667 meat total.
Requests complete.

Note that Candyblast dropped its candy, as well. (Side-issue: why not switch to a reusable item?) I have an Angry Jung Man for my familiar. I don't think there's a reason to extend combat past round 3, and if I just swap the BRICKO chick for the Ghost, it works as I would like it to.
 

Theraze

Active member
You REALLY need a higher verbosity if you want us to have even the slightest guess as to why you're getting the behaviour you do...
 

Crowther

Active member
Note that Candyblast dropped its candy, as well. (Side-issue: why not switch to a reusable item?) I have an Angry Jung Man for my familiar. I don't think there's a reason to extend combat past round 3, and if I just swap the BRICKO chick for the Ghost, it works as I would like it to.
Take a look at batfactors.txt. There's a second where every line starts with "crown". Notice that some familiars are marked with "r3". That means they don't do their special action after round three. Notice that BRICJO chick (and ghost) don't say "r3".
Code:
crown   123     BRICKO chick    0       0       item BRICKO brick
Candyblast can be a cheap spell even without the candy drops. As Theraze points out, it takes a lot of verbosity to figure out why a spell is preferred.
 

chown

Member
It doesn't seem particularly relevant that other familiars don't do anything after round 3 in the crown, since the chick and ghost are apparently the same in that respect. Or, are you responding to my mention of "round 3"? I was just referring to the fact that the burrito had dropped in round 3 of that fight.

Also, Candyblast is indeed cheap, but since it costs 8 MP, I don't see how it could ever be cheaper than using a dictionary, except when SmartStasis thinks it might get candy. I don't know how to tell if that's the issue, but if so then it seems like it may be similar to the burrito issue.

Here is an excerpt from some fights with "zlib verbosity = 9". Let me know if there's something more that I can provide. Turn [663689] is a battle with the Ghost in the Bjorn. The burrito dropped in round 4. The previous turn, [663688], shows a fight with the chick in the Bjorn. And, [663690] is just me manually showing one reasonable strategy for defeating my foes. Namely, reusable combat items until the burrito drops, and then attack with weapon. (Note also that in [663688], WHAM decided to use a shard of double-ice. Which is yet another odd thing. The way I did it was clearly better.):

View attachment excerpt.txt
 

Crowther

Active member
It doesn't seem particularly relevant that other familiars don't do anything after round 3 in the crown, since the chick and ghost are apparently the same in that respect. Or, are you responding to my mention of "round 3"? I was just referring to the fact that the burrito had dropped in round 3 of that fight.
I didn't see that the item in question actually dropped in round 3 and took it to mean it would never drop after round 3. Stupid coincidence.
 

zarqon

Well-known member
r25 Update

Happy New Year everyone! My name is SmartStasis and these are my New Year's resolutions.

This year, I resolve to correctly use any action with the "attract" or "copy" keywords to attract and copy monsters; not only Olfaction, spooky putty, and Rain-doh black boxes, like I used to do back in 2015!

This year, I resolve to lend a helping hand to Avatars of Sneaky Pete. I resolve to keep them full of Love, but still help them pickpocket for goals. Also, if they've already Thrown a Party, and they have Incite Riot, AND they haven't Incited said Riot yet, then instead of Love I resolve to bring them to maximum Hate as quickly as possible so they can have a most efficacious Riot. I will accomplish this by picking sharks and jumping pockets! Er... you know what I mean.

I resolve to treat pirate insult books as a custom category rather than specific items!

I resolve to help those collecting blood for our dear walrus friend Waldorf, by throwing tin snips as I may.

I resolve to point out in this thread that the recent BatBrain update may help some of the stasis issues reported by making me less picky about which items I look for when considering familiar drops. I want to help!

I resolve to remember that our dear walrus friend's name is Walford, not Waldorf.

Here's to a Smart 2016, everyone! I look forward to fulfilling these resolutions alongside each of you that consult me.
 

caphector

Member
How well should this work in Bad Moon? I've been running into issues where SmarttStasis does this:

[720] The Laugh Floor
Encounter: CH Imp
Strategy: /home/duncan/.kolmafia/ccs/BumCheekAscend.ccs [default]
Round 0: caphector wins initiative!
WHAM: Running SmartStasis
WHAM: SS has finished the fight. Aborting script execution.
WHAM: Running SmartStasis
WHAM: SS has finished the fight. Aborting script execution.
You're on your own, partner.

Generally I can jump into the fight and auto-attack a couple times and win; not sure what is triggering the failure to fight.
 

Theraze

Active member
Actually no, it's a BatBrain/SmartStasis problem, because SS says that the fight is done/won and returns nothing. It's not WHAM's fault that BatBrain tells it that the fight is over.
 

zarqon

Well-known member
Just a reminder: bugs reported at low verbosities are nigh impossible to debug. A verbosity of 9 is a good starting point. I use SS every day and if I encounter serious issues I fix them. So any issues you have are issues I do not, and I therefore require more detailed information to have even a clue as to where to look for the source of the issue.

@caphector: I've never had any problems with SS in Bad Moon. Granted my last Bad Moon run was quite a while back. Your issue may or may not have something to do with something BatBrain or SmartStasis or WHAM may or may not be doing (cf. above note).

@adeyke: I added a lot of newer items and skills to batfactors recently, so BatBrain knows about abstraction upgrades. Whether or not it will choose them is an unknown, however. I'm considering an update to BatBrain that considers item results from actions to be worth much more if they are goals, which ought to force BatBrain's hand in this regard if you set upgraded abstractions as goals.

Setting goals for that sort of thing could be a bit fiddly though, so I'm game to hear what sort of automation you might have in mind. Would always upgrading abstractions if you lack the upgrade be desirable?

@Theraze, @txrangersxx: Both are presumptuous conclusions without seeing a higher-verbosity output. I've pretty much accepted that the BatBrain / SmartStasis / WHAM threads are interchangeable as far as bug reports go, since due to the interplay of the scripts users have no good clues as to which of the three is responsible for errors encountered. Attempting to direct users to report the bug in the appropriate thread is a lost cause, since even I'm not sure what the cause is for low-verbosity reports. At least it looks like the ZLib thread has stopped getting modifier_eval() bug reports caused by BatBrain!

EDIT: r26 solves an issue that may be behind some of these errors. SS now checks if an item is "once" before submitting with repeat conditions; if yes, it simply enqueues the item and moves on to other items rather than submitting a stasis macro per item. Since the Crimbo rewards seem to be frequently selected as stasis items, this ought to drastically reduce (if not eliminate) round-sync errors. An additional benefit is that it will make combats faster!
 
Last edited:
Regarding abstractions, it seems there are probably two main ways people are going to want the upgrades to go. Players with a machine elf will likely be getting plenty of the base abstractions and are probably only spending their 5 free turns daily in the tunnels, so they'd want to automatically upgrade. Players without the elf have the machine tunnels as their only source of abstractions, so they probably would rather it not upgrade unless they've told it to, either manually or through goals.

Would a setting be sufficient to toggle the behavior? Off, it'll follow the generic item goals thing, and on, it'll upgrade as an automatic action.
 

Crowther

Active member
Players with mall access would probably want to upgrade their abstraction.

EDIT: At least last time I looked. It's been over a week.
 

Marty Knee

New member
I keep receiving this message whenever I attempt to use WHAM:

Bad monster value: "X-32-F Combat Training Snowman" (BatBrain.ash, line 1735)
Consult script 'WHAM.ash' not found.
You're on your own, partner.

Is there a fix for this or am I just out of luck for now?
 
I keep receiving this message whenever I attempt to use WHAM:

Bad monster value: "X-32-F Combat Training Snowman" (BatBrain.ash, line 1735)
Consult script 'WHAM.ash' not found.
You're on your own, partner.

Is there a fix for this or am I just out of luck for now?
That's happening because your KoLmafia is out of date and thus doesn't know what that is. This has nothing to do with WHAM, SS or BatBrain.
 
SS appears to once again be stopping battles it thinks it's already done, though I can't get it to reliably do so. It has happened so far today with the guant ghuol and the pooltergeist, both when i fought two back to back. Mafia r16723, SS and WHAM etc. are all updated. Did something get changed in the last couple days that might alter the way it sees combat numbers?
 
Top