SmartStasis -- a complex script for a simple CCS

Theraze

Active member
Well, that's the thing that zarqon was asking for a mafia FReq for, but I'm not sure how to word properly... when a KoL macro aborts, hand control back to the script instead of aborting. Let the script be responsible for making it work.
 

zarqon

Well-known member
That indicates that mafia only aborts for macro errors after the consult script is done -- SS finishes, and mafia sees the page contains a macro error, and aborts.

I've been thinking -- adding the BALLS "haveskill" check around skills might resolve this issue, but it's not immediately evident where this should be added -- when building skills or when enqueueing them. During enqueueing makes more sense, since if a skill is in your list, you definitely have it. Probably I will only add it for skills which are enqueued with repeat conditions, but that means the insertion of batround between actions needs to be reworked as well.
 

Bale

Minion
Even better, it would be possible to put !hasskill as a conditional for using the second best stasis option instead. That way the script will simply keep going if the skill runs out!
 
I'm not sure SS is making the best use of my OP shield.

Code:
consult smartstasis.ash
attack with weapon

Does not seem to be throwing the shield at all.

Code:
consult smartstasis.ash
skill throw shield
attack with weapon

Has been casting entangling noodles then throwing the shield. I'm not sure but I think that critical noodles would be better. I'm plinking in this case, so I think I'd want the longer stun more than extra damage.

Code:
skill throw shield
consult smartstasis.ash
attack with weapon

Would cause trouble with things like Pick Pocket, yes?
 

zarqon

Well-known member
Winterbay, your sig applies again! That's certainly easier than wrapping all skills (and eventually items) in if checks. Will add this to enqueue(action,repeatconditions) since it really only applies there -- the default condition of haveskill n/haveitem n will be added if applicable, checking the id for multiple items/skills as well.

Bale, your proposal would complicate the macro considerably, considering that there are numerous repeat conditions. It should only move on to another stasis action if it stopped due to running out of an item/skill -- the other conditions should still cause an abort. It's possible, foreaching over the sorted options and adding the top n valid stasis actions with initial conditionals and the usual repeat conditions, but it's not high on my list of things to do -- if you figure it out and post it I'd be happy to work it in, however.

@redwulf: I'm sure the shield isn't in batfactors yet.
 

Theraze

Active member
If you want mafia to abort the script rather than automation when it encounters KoL combat macro errors, that would be a feature request.

Perhaps a better solution would be to only abort automation for KoL combat errors if they happen outside a consult script, allowing the consult script itself the option of handling the error. That would actually completely solve all of these issues, albeit in a fairly ugly way. SS could submit a limited-use action with a "repeat" and KoL would execute it until it ran out -- then print an error. Since mafia wouldn't abort, BB would rebuild options and combat would continue as though an actual smart availability check were built in. It's rather inelegant to use KoL errors effectively as repeat conditions, but it's arguably better for users as it allows automation to continue.

I may actually make this feature request if you don't.

Do we still want this FReq, or are we satisfied that it's fixed for now since the haveskill enqueueing in BatBrain? The problem I can see is that if someone has an unintelligent macro consult, it could request the same impossible macro forever and KoL wouldn't abort it since it hands control back to the dumb-macro. That being said, they can currently do the same with a dumb non-macro-ed consult, so it's not really an added problem, just one we're porting to the new (macro) system.
 

Gdunge

Member
I have a loop condition happening when I'm poisoned by Killer Bees in the Dungeons of Doom.

After end of combat, a loop starts, printing "You're dangerously poisoned! Will try to remove if possible." When I hit the Abort button, an anti-antidote is automatically purchased and used.

I can't find this piece of text anywhere in my scripts directory, or in the KoLmafia source code. Or anywhere on my hard drive, with the exception of my KoLmafia log files.

Does anyone know where this message comes from, and how I can make it stop?

(Hmmm. Maybe I should post this in Universal_recovery? Oh well, too late now. I just hit the Post button.)

Thanks,

Gdunge

Log follows:


Code:
[22517] Dungeons of Doom
Encounter: swarm of killer bees
Strategy: /Users/dougw/Library/Application Support/KoLmafia/ccs/default.ccs [default]
Round 0: gdunge wins initiative!
Profit per round: ActionProfitDamageOtherbase; Rock Lobster (0μ)65.34μ0 (8.17) Actual: 8.17 (0 μ/dmg)MP: 8.17
Monster: Swarm of Killer Bees, ATT: 69, DEF: 58, HP: 85, Value: 231.92
You will die in 8410 rounds.
Your attack will kill the monster in 1 rounds.
Round 1: gdunge executes a macro!
Round 1: gdunge uses the spectre scepter!
You lose 5 hit points
You acquire an effect: Somewhat Poisoned (duration: 10 Adventures)
Round 2: gdunge executes a macro!
Round 2: gdunge uses the spectre scepter!
You gain 5 hit points
Round 3: gdunge uses the spectre scepter!
You gain 4 hit points
You gain 18 Muscularity Points
Round 4: gdunge uses the spectre scepter!
You gain 4 hit points
Round 5: gdunge uses the spectre scepter!
Round 6: gdunge uses the spectre scepter!
Round 7: gdunge uses the spectre scepter!
Round 8: gdunge uses the spectre scepter!
You gain 4 hit points
You gain 16 Muscularity Points
Round 9: gdunge uses the spectre scepter!
You gain 26 Muscularity Points
Round 10: gdunge uses the spectre scepter!
Round 11: gdunge uses the spectre scepter!
Round 12: gdunge uses the spectre scepter!
You gain 5 hit points
Round 13: gdunge uses the spectre scepter!
You gain 28 Muscularity Points
Round 14: gdunge wins the fight!
You acquire an item: baby killer bee
You gain 10 Strongness
You gain 4 Enchantedness
You gain 4 Smarm
Look! You found 1 baby killer bee (76μ)!
You're dangerously poisoned! Will try to remove if possible.
You're dangerously poisoned! Will try to remove if possible.
You're dangerously poisoned! Will try to remove if possible.

.
.
.

You're dangerously poisoned! Will try to remove if possible.
You're dangerously poisoned! Will try to remove if possible.
You're dangerously poisoned! Will try to remove if possible.
You're dangerously poisoned! Will try to remove if possible.
You're dangerously poisoned! Will try to remove if possible.
You're dangerously poisoned! Will try to remove if possible.
You're dangerously poisoned! Will try to remove if possible.
You're dangerously poisoned! Will try to remove if possible.
KoLmafia declares world peace.
You're on your own, partner.

Using 1 anti-anti-antidote...
Finished using 1 anti-anti-antidote.
Searching for "anti-anti-antidote"...
Search complete.
Purchasing anti-anti-antidote (1 @ 30)...
You acquire an item: anti-anti-antidote
You spent 30 Meat
Purchases complete.
 
Last edited:

Theraze

Active member
Does look like it's a BatBrain bug, since that's the BatBrain poison message... shouldn't have come up after the fight though, since after the fight's over, the consult should be done...
 

Woodhams

New member
This is my first attempt at using a CCS with a consult script and I'm a little confused by what's happening. I've followed the instructions on the first post to set everything up but when I adventure in the Icy Peak with my Hobo Monkey it will stasis for the Snow Queen but not for the Yetis or Rams. I was expecting it to stasis for all monsters as it's under [ default ] in my CCS. Any advice or pointers to where I might have gone wrong would be much appreciated.
 

Woodhams

New member
Actually just tried the CCS in the Castle and really think I've done something wrong.

Code:
[2247] Giant's Castle
Encounter: Raver Giant
Strategy: /home/paulw/.kolmafia/ccs/default.ccs [default]
Round 0: woodhams wins initiative!
Round 1: woodhams executes a macro!
Round 1: woodhams uses the Gnomitronic Hyperspatial Demodulizer!
Round 2: woodhams uses the Gnomitronic Hyperspatial Demodulizer!
Round 3: woodhams executes a macro!
Round 3: woodhams uses the Gnomitronic Hyperspatial Demodulizer!
KoLmafia thinks it is round 4 but KoL thinks it is round 2
Round 4: woodhams executes a macro!
Round 4: woodhams uses the Gnomitronic Hyperspatial Demodulizer!
KoLmafia thinks it is round 5 but KoL thinks it is round 2
Round 5: woodhams executes a macro!
Round 5: woodhams uses the Gnomitronic Hyperspatial Demodulizer!
KoLmafia thinks it is round 6 but KoL thinks it is round 2
Round 6: woodhams executes a macro!
........

And on and on until I aborted it. Again any advice would be greatly appreciated. Thanks.
 

Winterbay

Active member
Set your verbosity to 8 or 9 (type "zlib verbosity = 9") and try again so that we may see better what is happening. You appear to have a very low verbosity since there are no messages whatsoever about what is happening.
 

Woodhams

New member
Thanks for the tip, that's really given a lot more info. Could it be because I have a cup of infinite pencils equipped which would kill the monster?

Code:
[2255] Icy Peak
Encounter: upgraded ram
Strategy: /home/paulw/.kolmafia/ccs/default.ccs [default]
Round 0: woodhams wins initiative!
1 MP costs 8.0μ.
1 HP costs 10.0μ.
ram horns (5.0 @ +42.0): 55μ * 7.1% = 3.905
ram stick (5.0 @ +42.0): 120μ * 7.1% = 8.52
Ram's Face Lager (30.0 @ +42.0): 55μ * 42.6% = 23.43
Value of stat gain: 286.88μ
Factoring in cup of infinite pencils: 27.5 damage,
Profit per round: ActionProfitDamageOtherbase; cup of infinite pencils; Hobo Monkey (75μ)75μ27.5 (-2.73 μ/dmg)
Parsed round number: 1
Building options...
Options built! (91 actions)
ram horns (5.0 @ +42.0): 55μ * 7.1% = 3.905
ram stick (5.0 @ +42.0): 120μ * 7.1% = 8.52
Ram's Face Lager (30.0 @ +42.0): 55μ * 42.6% = 23.43
Value of stat gain: 286.88μ
Monster: Upgraded Ram, ATT: 108, DEF: 97, HP: 97, Value: 700.76
You will die in 1155 rounds.
Your attack will kill the monster in 1 rounds.
Building custom actions...
Custom actions built! (0 actions)
Stasis action chosen: attack
Top of the stasis loop.
Executing macro: scrollwhendone; sub batround; endsub; sub batsub1; attack; call batround; endsub; call batsub1; repeat && (!hpbelow 229.0 && hpbelow 297 && !mpbelow 106.0 && !pastround 28 && !match "hands you some Meat"); if hpbelow 30; abort "BatBrain abort: Danger, Will Robinson"; endif; 
Round 1: woodhams executes a macro!
Round 1: woodhams attacks!
Round 2: woodhams wins the fight!
You gain 309 Meat
You acquire an item: ram stick
You gain 13 Strengthliness
You gain 8 Mysteriousness
You gain 8 Chutzpah
Parsed round number: 2
Look! You found 1 ram stick (120μ)!
Building options...
Options built! (87 actions)
Stasis action chosen: attack
Top of the stasis loop.
Executing macro: scrollwhendone; sub batround; endsub; sub batsub1; attack; call batround; endsub; call batsub1; repeat && (!hpbelow 229.0 && hpbelow 297 && !mpbelow 106.0 && !pastround 28 && !match "hands you some Meat"); if hpbelow 30; abort "BatBrain abort: Danger, Will Robinson"; endif; 
Parsed round number: 0
Building options...
Options built! (87 actions)
Stasis action chosen: use 2
Stasis loop complete.
SmartStasis complete.
 

Winterbay

Active member
You appear to have no good stasis options. Try to get hold of a seal tooth or similar which will make a lot less damage, as yes I think your problem is that since you don't have anything other to stasis with than your attack you will not stasis for long since your attack kills the monster in one blow.
 

Woodhams

New member
I'm not sure that's it. For the Snow Queen it successfully used the facsimile dictionary. I also already have a seal tooth which should do the job. When I unequipped the cup of infinite pencils it seems to stasis correctly.

Code:
[2274] Icy Peak
Encounter: Knott Yeti
Strategy: /home/paulw/.kolmafia/ccs/default.ccs [default]
Round 0: woodhams wins initiative!
1 MP costs 8.0μ.
1 HP costs 10.0μ.
yeti fur (30.0 @ +40.0): 92μ * 42.0% = 38.64
Value of stat gain: 278.91μ
Profit per round: ActionProfitDamageOtherbase; Hobo Monkey (75μ)75μ--
Parsed round number: 1
Building options...
Options built! (91 actions)
yeti fur (30.0 @ +40.0): 92μ * 42.0% = 38.64
Value of stat gain: 278.91μ
Monster: Knott Yeti, ATT: 105, DEF: 93, HP: 90, Value: 890.88
You will die in 654 rounds.
Your attack will kill the monster in 1 rounds.
Building custom actions...
Custom actions built! (0 actions)
Stasis action chosen: use 1316
Top of the stasis loop.
Executing macro: scrollwhendone; sub batround; if haseffect 264 || haseffect 283 || haseffect 284; abort "BatBrain abort: poisoned"; endif; endsub; sub batsub1; use 1316; call batround; endsub; call batsub1; repeat hascombatitem 1316 && (!hpbelow 361.0 && hpbelow 375 && !mpbelow 143.0 && !pastround 28 && !match "hands you some Meat"); if hpbelow 38; abort "BatBrain abort: Danger, Will Robinson"; endif; 
Round 1: woodhams executes a macro!
Round 1: woodhams uses the facsimile dictionary!
Round 2: woodhams uses the facsimile dictionary!
You gain 53 Meat.
Parsed round number: 2
Building options...
Options built! (91 actions)
Stasis action chosen: use 1316
This monster is not your huckleberry.
Stasis loop complete.
Executing macro: scrollwhendone; sub batround; endsub; skill 3004; call batround; 
Round 3: woodhams executes a macro!
Round 3: woodhams casts ENTANGLING NOODLES!
Parsed round number: 4
Building options...
Options built! (90 actions)
SmartStasis complete.
Round 4: woodhams attacks!
Round 5: woodhams wins the fight!
You gain 499 Meat
You gain 12 Muscleboundness
You gain 9 Wizardliness
You gain 8 Sarcasm

Requests complete.

Is there a reason noodles are being cast after stasis has finished? I'm well over the safe moxie and should kill in one hit so is it just being extra cautious?

Thanks for your help with this.
 

Theraze

Active member
It will only use noodles if it thinks it will help you avoid damage. Since it expects you to survive for 654 rounds, it appears that it doesn't think you're ever going to get hit, so it doesn't ever make sense to run noodles during 'normal' stasis. Once it gets down to you though, it's still possible that you're going to do something that goes for long enough for a critical hit to happen, so...

The reason why your stasis stopped is because your hobo monkey stole its meat in round 2. As such, there was no reason to continue stasis longer than that... unlike the stocking mimic, cocoabo, NZPR, the monkey's meat-gathering happens only once per fight...
 

Woodhams

New member
I know the stasis was right for the second example, for the first though I think it must have been the cup of infinite pencils stopping me starting to stasis.

I'm not sure I follow why the noodles are happening though. The noodles aren't selected in the special actions section in Mafia and my CCS is just:

Code:
[ default ]
consult SmartStasis.ash
attack with weapon

Thanks for all the help with this.
 
Top