SmartStasis -- a complex script for a simple CCS

zarqon

Well-known member
All of those except Clobber are hardcoded in BatBrain. I'll add Clobber soon -- now that I see the formula, I remember why I skipped it at the time!

It may be that KoL disallows Richard skills in macros, since it could lead to a form of clannie abuse?
 
Last edited:

StDoodle

Minion
This would seem to impose a new version description format on scriptwriters. Unless I am completely misunderstanding the code, it currently would work if I called my version "Beta" and then chose to update it to "1.0". Perhaps rephrasing the message so it says that "You are running version Beta but version 1.0 is hosted at kolmafia.us"? That says nothing about which one is newer.

I did some extensive testing with as many wacky versioning schemes as I could think of, and it seemed ok. But, there's almost certainly a good chance I missed something. If you have any concerns, feel free to post them in the std_lib thread and I'll go into greater depth (time has not been on my side, lately).
 

Bale

Minion
Bug report:

Code:
You acquire an effect: Strangulated (duration: 1 Adventure)
Evaluator     syntax error: can't understand myhp)
Evaluator syntax error: expected     ), found

In Batfactors I found this:
Code:
effect	437	Strangulated	0	physical	hp -floor(0.25*myhp)

The problem is probably there, but I don't know what is wrong with that evaluator.
 

Winterbay

Active member
I think (and this is nothing more than an uneducated guess) that the problem is that the "myhp" variable (fvars["myhp"]) is defined in a function call while that effect is evaluated outside of one. If my assumption on how ash works is correct this would mean that the effect is evaluated everytime batbrain is imported into something while the definition of that specific parameter might not be.

The effects are evaluated in a foreach loop around line 458 and myhp is defined in the function build_options around line 746.

I may be completely wrong though :)
 

zarqon

Well-known member
Close -- It's just not defined early enough. I'll fix it shortly.

EDIT: BatBrain 0.8.5 fixes Clobber and the myhp variable not existing when parsing effects.
 
Last edited:

tragus

Member
As a follow-up to the "skill 7021" macro failure, I received the following from Gemelli (dev):
This is a known issue -- it's on our list of things to fix.
*
Thanks for the report!

Ah well....

Any workarounds for Mafia meanwhile will be gratefully accepted.

(As a side note, everything in Mafia is working today. It seems there's some type of hidden state that tips to this failure. OR, there was an undocumented fix overnight.)
 
Last edited:

zarqon

Well-known member
It's always somehow comforting when a bug isn't my fault. :)

Deleting the Richard skills from batfactors.txt would be simplest; then SS will ignore them. Unless you really wanted to use them... in which case, it'd be trickier.
 

slyz

Developer
Ugh, poor Zarqon. Now he has to find a way to macrofy the action queue up to a point, use a skill the old-fashionned way, and submit a macro for the rest.

Oh well, it's always something that can keep you busy during those hot spring nights :D
 

fianor

Member
Due to my farming setup I need to know how to make SS/BB (not sure where it's at) stop trying to use saucy salve to reload my HP. At least while I don't really need it. While farming my max hp is around 1900, but will be sitting at about 1300 when I start. I'm just farming the castle, I don't need the HP and my outfit/buffs regenerate it anyway. My problem is that stasis trying to heal me with salve burns up MP I use for a) killing the damn procrastination giants & b) summoning brickos for profit. Basically I crash out everyday upon the first encounter of a procrastination giant due to not having enough MP to blast it with some saucy goodness.

Is there a variable I'm not seeing that I can adjust to stop this, or do I need to comment out some code to fix this?
 

zarqon

Well-known member
Couldn't you just start farming at max HP? (Technically, you could start at max - HP Regen Min, since BatBrain doesn't include to-be-regenerated HP as profit.)

Or, delete salve from the data file to always ignore that skill. Or, add something to BatBrain's to_profit() that ignores all HP input above your autorecovery healing target (a global variable 'hpgoal' already exists for this).
 

slyz

Developer
If SmartStasis is healing you with Saucy Salve, it means that it is profitable for you to do so (you are wasting less meat by using MP to cast Saucy Salve than by healing in other ways). That is controlled by the "_meatperhp" Mafia property, usually set by Bale's Universal Recovery script.

The simplest way to stop SS from healing you though is to simply lower your HP recovery setting, since it will only heal you up to the setting in Mafia's HP/MP tab.
 

zarqon

Well-known member
Actually slyz, that's the pre-BatBrain behavior -- the new behavior calls profit profit, regardless of the recovery setting.

Fianor may not be using UR, in which case he probably has better out-of-combat restore options and this problem has been reported before. If he is using UR and Salve is a profitable recovery option, he can circumvent this by using a nuns or Hot Tob visit prior to starting his farming routine. Or editing the script, as I mentioned.
 

slyz

Developer
Oh ok, I was looking at build_custom() in SmartStasis.

If Saucy Salve is in the data file, I guess it will be added in opts and considered for stasising regardless of whether build_custom() rejected it or not.
 

fianor

Member
I'm a level 42 sauceror farming the castle. I don't need any healing at all. Not only can the monsters not really hit me, even if they do they couldn't possibly kill me. It's trying to recover up to around 3000 HP from about 1300, or after the buffs drop from 1300 to 1900. In my case it's absolutely more profitable to use my MP summoning brickos for profit than to heal HP I will never need, even though it isn't at max.

Zarqon is correct that I am not using UR, haven't found a need for it yet.

My last resort was going to simply be burning another hot tub use just before starting to farm the castle, but it seems like a waste should I do something silly halfway through farming and decide to actually adventure or something. Really an unlikely event but like I said just seemed like a waste. I don't want anyone to have to add a new variable into all this scripting that's already done, I was just hoping there was one I haven't found that I could set to work for me.

As for recovery setting, I'm assuming you mean in the "HP/MP Usage" settings, all of which I have turned off, I think. I'm not 100% sure which variables effect that. Also I've not been overly successful at finding what all variables even exist in mafia.

I guess maybe the question I'm asking is what variable can I set to just not recover any HP, or better yet not recover any if I already have more than X.
 

zarqon

Well-known member
That ought to work! However, be aware that if you decide to "actually adventure", it will also make the script assume that you taking damage doesn't cost anything. Losing the fight will still cost you, but losing HP won't.

You can reverse this clever lie (set things back the way they were before) by typing "set _meatperhp =" in the CLI.

EDIT: The best solution would be to use UR. For high-level characters, the out-of-combat restore rates calculated by UR (using e.g. Cocoon or scroll of drastic) will basically always make in-combat restore skills unprofitable.
 
Last edited:

Bale

Minion
fianor : We can make things work sanely for you without using UR. Put the following in your login script. You do use a login script, right? Well you do now. Save this to a file in your /script directory with the extension .ash and set it as your login script in preferences for breakfast.

Code:
set_property("_meatperhp", to_string(max(mall_price($item[scroll of drastic healing])/ (my_maxhp()* .75), 0.001)));

That should work just fine for negating Saucy Salve by setting meatperhp, without compromising SS's idea of what it means for you to get hurt. While Universal Recovery would make SS work more accurately, it seems like a bad idea to use the script just to set a variable that can be set this easily.

The reason BB&SS do not use that simple calculation is because it is an approximation based on things I deduce about your character. If you've got Cannelloni Cocoon for example, that would change the calculation, but this is still close enough for your purpose.
 
Last edited:

Theraze

Active member
Getting an infinite loop on Batwinged Gremlins with the following error in the window:
Macro Aborted ("abort match effect*Poisoned || match "Toad In The Hole" || match "a massive loogie" || hpbelow 36")

At the time, I have 36 hp exactly.
 

Rapped Scallion

New member
I get the following fatal error message every time at the beginning of a day when I use mafia to run a fight:

Code:
Bad item value: "double-ice box" (BatBrain.ash, line 387)
Consult script 'SmartStasis.ash' not found.

This has happened for about a week. Every time this happens I download the newest jar file, which seems to solve the problem for the day, but the problem recurs after rollover.
 
Top