SmartStasis -- a complex script for a simple CCS

Crowther

Active member
Can someone help me? SmartStasis has decided to only use the skill LASAGNA BANDAGES, even when I am at full HP.
People have looked, but the source of this problem hasn't been found. You can remove Lasagna Bandage and Saucy Salve from batfactors.txt (in the data directory), but that means those skills will never be used, even when they are profitable.
 

Theraze

Active member
The general answer is that the value for stasis is better than the value for casting the item... your output doesn't tell us the HP/MP restoration values (or whether you've gotten those set properly, either by using Bale's UR or manually) so we can't directly validate how much it's considering each point of MP to cost, but...

Basically, step one, validate you do have _meatperhp and _meatpermp being set. If you don't use UR, there's directions above in this thread on how to manually generate those during your login. These are needed to decide how much your casts cost, as well as to decide how much to prioritize stasis healing.

Step two, if you still care and want it explained... turn verbosity to 9 and paste from beginning of combat until the first round of stasis actually begins. That gives us the consideration of stasis, the familiar consideration, the items, all that lovely stuff.
 

rlbond86

Member
The general answer is that the value for stasis is better than the value for casting the item... your output doesn't tell us the HP/MP restoration values (or whether you've gotten those set properly, either by using Bale's UR or manually) so we can't directly validate how much it's considering each point of MP to cost, but...

Except that if I am at full HP, the values should be zero because I cannot actually gain more HP.
 

Theraze

Active member
But you can continue doing stasis, doing 0 damage to the enemy and guaranteeing another round of stasis. And if the mp restoration value is set to 0, then your healing spells are 'free' because they resolve out to have no cost...
 

Crowther

Active member
SmartStasis doesn't agree with me about when stasis is profitable. I started posting about this on the WHAM thread, but now I know I'm having trouble with StartStasis specifically. The stasis action chosen is less profitable than the attack action. Manually I've done Sing and it seems clearly profitable. I'm confused. I notice this happening most often at low levels. Am I reading something wrong? It chose Stealth Mistletoe as the best (-85 profit), but it probably would have chosen Saucy Salve if I hadn't disabled that.
Code:
[25] Outskirts of The Knob
Encounter: Knob Goblin Barbecue Team
Strategy: /root/.kolmafia/ccs/Destroy.ccs [default]
Round 0: Crowther wins initiative!
Running ZLib version: r36 (current)
1 HP costs 5.1μ. ( 71 / 71 )
1 MP costs 17μ. ( 25 / 103 )
Running BatBrain version: 1.23 (current)
Running SmartStasis version: 3.15 (current)
bowl of cottage cheese (60.0 @ +35.0): 31μ * 81.0% = 25.11
Knob Goblin pants (8.0 @ +35.0): 30μ * 10.8% = 3.24
Knob Goblin tongs (20.0 @ +35.0): 25μ * 27.0% = 6.75
Value of stat gain: 123.75μ
bowl of cottage cheese (60.0 @ +35.0): 31μ * 81.0% = 25.11
Knob Goblin pants (8.0 @ +35.0): 30μ * 10.8% = 3.24
Knob Goblin tongs (20.0 @ +35.0): 25μ * 27.0% = 6.75
Value of stat gain: 123.75μ
ATT: 12 (5.0% × 1, death in 1184)
DEF: 11 (97.73% × 19.08 (4) (3) (3) (3) (5), win in 1)
HP: 12.6, Value: 353.85 μ
Parsed round number: 1
Building options...
Options built! (33 actions)
Profit per round: ActionProfitDamageOtherbase; Mini-Hipster (3.83μ)25.5μ0 
(0.67) (0.67) Actual: 2.34 (-1.64 μ/dmg)Att: -0.21 (0 DPR) Def: -0.21 HP: 
-1.28 MP: 1.28
Building custom actions...
Queued: pickpocket
Building options...
Options built! (33 actions)
Custom actions built! (0 actions)
Stasis action chosen: skill 5023 (round 2, profit: -85)
bowl of cottage cheese (60.0 @ +35.0): 31μ * 81.0% = 25.11
Knob Goblin pants (8.0 @ +35.0): 30μ * 10.8% = 3.24
Knob Goblin tongs (20.0 @ +35.0): 25μ * 27.0% = 6.75
Value of stat gain: 123.02μ
Attack action chosen: attack (round 2, profit: 25.5)
This monster is not your huckleberry.
Stasis loop complete (queue still contains 1 actions).
This monster is not your huckleberry.
Constructed macro: scrollwhendone; sub batround; endsub; pickpocket; call 
batround; 
Round 1: Crowther executes a macro!
Round 1: Crowther tries to steal an item!
You acquire an item: bowl of cottage cheese
Happened: pickpocket
Parsed round number: 2
You snatched a bowl of cottage cheese (31μ)!
Knob Goblin pants (8.0 @ +35.0): 30μ * 10.8% = 3.24
Knob Goblin tongs (20.0 @ +35.0): 25μ * 27.0% = 6.75
Value of stat gain: 123.75μ
Revised monster value: 148.74
Happened: stolen
Building options...
Options built! (33 actions)
SmartStasis complete.
You're on your own, partner.
 

rlbond86

Member
But you can continue doing stasis, doing 0 damage to the enemy and guaranteeing another round of stasis. And if the mp restoration value is set to 0, then your healing spells are 'free' because they resolve out to have no cost...

I do use UR, so it's not this.
 

Theraze

Active member
With rlbond86, first part still holds true... healing spells guarantee (barring familiar or other damage sources) that your combat will go another round. If the cost of stasisprofit-(_meatpermp*lasagna) is more than your stasis amount, stasis is a good idea... which is just about always with a Cocoabo, NZPR, hobo monkey, or anything else that can actually generate meat. Even just a star starfish can be considered profitable, if you need ANY mp at all from the beginning... which is why we need more logs to tell you what exactly is going on. :)

Regarding why Crowther's stasis wasn't happening... two major possibilities. One, it could be considering the value of losing the adventure if they get a critical hit. If that happens, stasis is bad. Two, it could also be considering that your familiar could just as easily finish off the fight, so hoping it will go on isn't worth too much effort. But I'd think that the first is the more likely case, since it follows good logic in terms of Profit(tm). :)
 

Crowther

Active member
Regarding why Crowther's stasis wasn't happening... two major possibilities. One, it could be considering the value of losing the adventure if they get a critical hit. If that happens, stasis is bad. Two, it could also be considering that your familiar could just as easily finish off the fight, so hoping it will go on isn't worth too much effort. But I'd think that the first is the more likely case, since it follows good logic in terms of Profit(tm). :)
Okay, that's the breaks. It might very well be a balance issue that only applies to me. It worked better for me back before Boris. As it is now, it will rarely hipster stasis on day one and most of day two, so I end up spending many turns meat farming and I can't afford to cast inigos. A very tiny risk of being beaten up is probably acceptable. I stasised by hand yesterday and never got hit for more than 1 HP (except when I failed to notice it was a scaling hipster fight, oops). Luckily, thanks to Boris, I acquired so much karma I'm about to run out of things to spend it on. I may as well take a break from ascending to dig into SmartStasis and figure out how to balance things to my tastes.

Once question. I noticed that attack was more profitable than the skill selected for stasis. Is that because attack is not considered for stasis?
 

Theraze

Active member
Stasis means continuing the fight and not killing the mob. As attack will kill the mob, it's not stasis. If your attack won't kill the mob, it might be considered for stasis... but with a fumble chance to damage yourself, it will rarely be your best option, as you'll never fumble a seal tooth.
 

Crowther

Active member
Stasis means continuing the fight and not killing the mob. As attack will kill the mob, it's not stasis. If your attack won't kill the mob, it might be considered for stasis... but with a fumble chance to damage yourself, it will rarely be your best option, as you'll never fumble a seal tooth.
Yeah, that's the problem. On the combat I'm currently debugging, there are ways to stasis for 11 rounds, but none of them are profitable, so profitable options that allow stasis to go for 9 rounds (salsaball and suckerpunch) are being rejected.

So, I added a "if (opt.profit < 0) continue;" to stasis_action's loop in BatBrain and things are working much better. That's just a kludge, a better trade off between profit and rounds could be made.

Is profit per round or for all rounds (kill_round)?

EDIT: Ooooh, yeah, baby. That's so much better. I switched from <0 to <10, just in case. Now I understand why it would stasis some times (when kill_round matched) and not others.

EDIT: Maybe this could explain my Saucy Salve problem. The way I read the code, extending stasis by even one round is more important than any amount of profit. Saucy Salve beats most other forms of extending stasis.
 
Last edited:

zarqon

Well-known member
Profit as calculated by to_profit() is per round (even for multi-round stunners), but the attack_action() sort considers total-combat profit assuming you spam the action to kill the mosnter. The stasis sort, however, only considers the current round.

Setting an upper limit on profit will probably result in failure to stasis against huckleberries (such as gremlins). This is why the stasis sort considers profit secondary to extending combat.
 

Crowther

Active member
Profit as calculated by to_profit() is per round (even for multi-round stunners), but the attack_action() sort considers total-combat profit assuming you spam the action to kill the mosnter. The stasis sort, however, only considers the current round.

Setting an upper limit on profit will probably result in failure to stasis against huckleberries (such as gremlins). This is why the stasis sort considers profit secondary to extending combat.
Okay, that does make things extra complicated. I don't use SmartStasis for huckleberries, so I'm guessing I've fixed my problem. My intuition says there could be a single profit metric that assigns a higher value to rounds for huckleberries, but I'm not seeing a simple fix now.

It does seem odd to me that the existence of a non-profitable skill for extending stasis longer causes a profitable skill to be ignored and no stasis to be done. Or is this a problem with how BatBrain/SmartStasis are being used? I'll totally admit I'm out of my league here.

EDIT:

I've been thinking about this a lot (too much) and it seems this sorting is also the source of my Saucy Salve problems. Basically, SmartStasis does a good job starfishing in hardcore, until you perm Saucy Salve, Lasagna Bandages or Stealth Mistletoe. Then it will not stasis most monsters that can't survive 25ish rounds with spices, sing, or suckerpunch. I've adjusted that sort to use my own metric and it works better than before I permed those skills. It's almost creepy how good it is.

I know I'm a bit ahead of the curve with perming hardcore skills, but I suspect more and more people will show up after they perm these skills wondering why things aren't working like before. Now that I can finally understand what's happening, I suspect I'll continue to fine tune my own personal fork. I don't know how other people use SmartStasis. This stuff is amazingly awesome.
 
Last edited:

Tom Sawyer

Member
People have looked, but the source of this problem hasn't been found. You can remove Lasagna Bandage and Saucy Salve from batfactors.txt (in the data directory), but that means those skills will never be used, even when they are profitable.


Well this had been driving me bat shit crazy for a while. I have all the skills possible HC permed. And when I use WHAM and smart-stasis esp when using my bandersnatch it would use saucy salve for 20 combat rounds which to me was a huge waste of MP. So I took the line out and sure enough it started using Lasagna bandages so I took THAT out.

Now it seems to be doing fine :)
 

shazbot

Member
Siphon Spirits is looking a little tricky.

First, always use it to get goal drinks.

Second, always use it when red. Wait, no, because maybe you only want to get drinks that boost your primestat.

Well, always use it for primestat red-aura drinks then? Okay.

Maybe some players want to use it for any red-aura drink regardless of stat, to get maximum +turns from their familiar. Okay, we'll need a setting, perhaps named siphon_primestat_only. If it's false, it won't discriminate based on stat.

Should we pay attention to level requirements? Probably most HC players will not reach level 8 on Day 1, so they wouldn't even be able to drink a Day 1 red-aura drink. They should thus stick to blue or orange. But maybe they want to stockpile drinks for later!

I'm kind of drawing a blank on how best to support this. Those who requested support for it: how would you like SS to support this skill? Am I on the right track with the first couple bits at least?

Any sort of update? I like roippi's idea, which gives a variable for configuration. Doing it if it's a goal is good, but beyond there I understand the confusion. I can't speak for others, but most uses cases for me are simply to gather red aura drinks, similar to my typical use case for stomping boots which is arbitrarily gathering paste. It would be neat to see this as an option.
 

Winterbay

Active member
Any idea why SmartStasis decides to stun with magical mystery juice?

Code:
[COLOR=purple]Custom action: use 2947 (stun first with use 518)[/COLOR]
[COLOR=black]Auto-funk:      merging 'use 518' and 'use 2947'.[/COLOR]
Round 1: Winterbay executes a      macro!
Pirate insults known: 3 (1.79%)
Round 1: Winterbay uses the      magical mystery juice and uses the The Big Book of Pirate Insults!
You      gain 16 Mana Points
You acquire an effect: Embarrassed (duration: 1      Adventure)
Round 2: toothy pirate takes 1 damage.
Round 2: toothy      pirate takes 3 damage.
You lose 3 hit points
 

BigVinnie

New member
I've been thinking about this a lot (too much) and it seems this sorting is also the source of my Saucy Salve problems. Basically, SmartStasis does a good job starfishing in hardcore, until you perm Saucy Salve, Lasagna Bandages or Stealth Mistletoe. Then it will not stasis most monsters that can't survive 25ish rounds with spices, sing, or suckerpunch. I've adjusted that sort to use my own metric and it works better than before I permed those skills. It's almost creepy how good it is.

I know I'm a bit ahead of the curve with perming hardcore skills, but I suspect more and more people will show up after they perm these skills wondering why things aren't working like before. Now that I can finally understand what's happening, I suspect I'll continue to fine tune my own personal fork. I don't know how other people use SmartStasis. This stuff is amazingly awesome.

Please forgive my asking, but it seems like you have found a solution to the SaucySalve problem. If so, would you mind sharing it? I'm on the second day of my first Sauceror run (yes, I'm a bit of a n00b), and SmartStasis keeps blowing all of my MP on SaucySalve. A fix would be fantastic!
 

Crowther

Active member
Any idea why SmartStasis decides to stun with magical mystery juice?
Knob Goblin seltzer too and only when funkslinging. It happened with a cocktail napkin too. (Seen via WHAM)
Please forgive my asking, but it seems like you have found a solution to the SaucySalve problem. If so, would you mind sharing it? I'm on the second day of my first Sauceror run (yes, I'm a bit of a n00b), and SmartStasis keeps blowing all of my MP on SaucySalve. A fix would be fantastic!
Well, my fix is to not make extending combat an absolute priority over profit. What I did works very well for me, but could be bad for you.The details are here.
 

Theraze

Active member
Just hit the gremlins with Crowther's SS round-fix and it properly stasised the right gremlin and killed the others. Seems like it's working fine in all cases...
 

shazbot

Member
I've been having an issue with things getting stuck. I'm using WHAM, but I think it's getting stuck in SS. Here's what I'm seeing repeated over and over-

Code:
Queued: skill 7021
Constructed macro: scrollwhendone; sub finito; skill 7021; endsub; call finito; repeat hasskill 7021 && (!hpbelow 1824.0 && hpbelow 1859 && !mpbelow 1890.0 && !pastround 26)
Round 224: oh shazbot executes a macro!
KoLmafia thinks it is round 225 but KoL thinks it is round 8
Parsed round number: 8
Stasis action chosen: skill 7021 (round 8, profit: 24.4)
hobo nickel (15.0 @ +65.0): 50μ * 24.75% = 12.38
Attack action chosen: attack (round 8, profit: 24.04)

This is against ice hobos with a stocking mimic, so it's trying to stasis for meat. There was a single bandage with Richard. I've used it and seen this not repeating, so I'm guessing it's a miscalculation involving that skill and healing?
 
Top