SmartStasis -- a complex script for a simple CCS

janusfenix

New member
Bug report time! YAY! We all love bug report time!
As you might suspect, BREAK-POP-RUN is rave steal. Unfortunately SS does not detect a successful steal so it tries again and again and AGAIN! There are some items that aren't marked as no steal, so if rave steal fails to steal, please don't do it again.

Huh, and I thought I had gone through the item drops table and submitted all non-pickpocketable sea items as such. Which ones do you feel is wrong still?

This also seems to happen if you have the rave combo, but have not beaten your Nemesis yet. It just keeps attempting to steal. This happened to me in the Palindome and Black Forest.
 

Bale

Minion
I've found this script casting saucy salve when my HP is at max. That's not terribly economical. I think the problem is this:

Code:
   if (have_skill($skill[saucy salve]) && (my_hp() < m_dpr(0,0) || [COLOR="#ff0000"]min(hpgoal - my_hp(),12)[/COLOR]*meatperhp > mp_cost($skill[saucy salve])*meatpermp))

Note the red. Was that supposed to be max()?
 

Theraze

Active member
I'd imagine it should be min, because you want the lower of the two... if you take max, then it will never be lower than 12. If you take min, it should be either 12 or goal-current, whichever is lower... the problem is that it considers it to always be a good stasis option if 12*meatperhp is greater than the cost of salve*meatpermp.

Bottom line, I think the problem is saying that you will always gain 12 hp, even when you're maxed. Better would be changing the
Code:
12
to be:
Code:
min(my_maxhp()-my_hp(), 12)
(which would make the whole line look like this:
Code:
   if (have_skill($skill[saucy salve]) && (my_hp() < m_dpr(0,0) || min(hpgoal - my_hp(),min(my_maxhp()-my_hp(),12))*meatperhp > mp_cost($skill[saucy salve])*meatpermp))

This would make it not decide that saucy salve will restore 12 hp when you're only down 1 hp, or at max, or something similar...
 

StDoodle

Minion
Man, still too busy lately to try this bad boy out, but I did get a chance to test out macro-fighting vs. a boss today, and there were no problems. I'm pretty sure the aforementioned "doesn't work vs. bosses" thing is a holdover from the early bug-testing days.
 

zarqon

Well-known member
Theraze, that's exactly what it was already doing, just using hpgoal in place of maxhp. It's not capped on the low end, but it doesn't need to be since it's in a < check.

Bale, was it casting Salve in the custom actions section or in the stasis section?
 

Theraze

Active member
Ah, okay.

Did get an exciting new bug today:
[3387] Dungeons of Doom
Encounter: Ouch! You bump into a door!
Encounter: mimic
Strategy: C:\Program Files (x86)\KoLMafia\ccs\FinalAttack.ccs [default]
Round 0: Theraze wins initiative!
Checking for updates (running BatBrain ver. 0.8.7)...
_version_batbrain => 0.8.7
You have a current version of BatBrain.
map_pluralMonsters.txt => 2011-02-28T13:05:11-06:00, checked 20110428
You have the latest pluralMonsters.txt. Will not check again today.
map_batfactors.txt => 2011-04-25T02:18:35-05:00, checked 20110428
You have the latest batfactors.txt. Will not check again today.
Can't take square root of a negative value (BatBrain.ash, line 742)
You're on your own, partner.
Click here to continue in the relay browser.
 

Bale

Minion
Bale, was it casting Salve in the custom actions section or in the stasis section?

Stasis section. Though I have not replicated it yet today. I'll try later. First though I want to show you something else. I've been trying to capture this rare, but intermittent effect with verbosity on 9. I'd hoped there'd be a clue.

[316] Goatlet
Encounter: dairy goat
Round 0: bale wins initiative!
Round 1: Princess Vina is looking a little thin.
glass of goat's milk (20.0 @ +113.32646): 1200.0 meat * 42.665295% = 511.98355
goat cheese (40.0 @ +113.32646): 111.0 meat * 85.33059% = 94.71695
glass of goat's milk (20.0 @ +113.32646): 1200.0 meat * 42.665295% = 511.98355
goat cheese (40.0 @ +113.32646): 111.0 meat * 85.33059% = 94.71695
Monster value: 979.2
Profit per round:
ActionProfitDamageOther
base; Slimeling (0μ)63.35μ8.25 (0 MPD)MP: 8.25
1 MP costs 8.0 meat.
1/3 monsters drop goals here.
This monster is the best source of goals (0.85)!
Executing macro: abort match effect*Poisoned || match "Toad In The Hole" || match "a massive loogie" || hpbelow 1; scrollwhendone; sub batround; endsub; pickpocket; repeat match name=steal && !hpbelow 2;; call batround;
Round 1: bale executes a macro!
Round 1: bale tries to steal an item!
Round 2: Princess Vina paces around aimlessly, making wet squishy noises.
1 MP costs 8.0 meat.
Round 2: bale executes a macro!
Round 2: bale casts ENTANGLING NOODLES!
Round 3: Princess Vina paces around aimlessly, making wet squishy noises.
1 MP costs 8.0 meat.
Round 3: bale executes a macro!
This skill is useless with ranged weapons.
KoLmafia thinks it is round 4 but KoL thinks it is round 3
You're on your own, partner.
Click here to continue in the relay browser.

The relay browser says:

You can't perform that attack with a ranged weapon. Because, y'know, that's not how ranged weapons work.

(Macro aborted.)
In the relay browser (show old combat form) Kneebutt is selected as my previously used skill and it does give that error message. Why would SmartStasis kneebutt my goat? I know that this is not my attack script because I added a blue debugging statement telling me that it is doing its thing to be sure where the error lies. My FinalAttack main looks like this:

PHP:
void main(int initround, monster foe, string page) {
print("FinalAttack macro to kill a "+foe+" in the "+my_location()+". ( "+hitchance(1)+" )", "blue");
	page = act(page);
	page = take_action(foe, page);
}

The only thing I can think of is that it wants to use kneebutt to stun the goat. Am I going to have to fight at verbosity 10 to figure this out? ick.
 

Bale

Minion
Verbosity 10 only shows the eval-calls as well. I don't think that will help here.

You don't think it would help to see what calculations were being evaluated? It wouldn't be easy, but there should be a clue in there, shouldn't there be? Hence I said, "ick."
 

Winterbay

Active member
You don't think it would help to see what calculations were being evaluated? It wouldn't be easy, but there should be a clue in there, shouldn't there be? Hence I said, "ick."

Not really, since there is almost no way of knowing which one is which unless you have very few options (like when I only had 4 spells and tried to find why BatBrain gave more damage than my own calculations (and KoL's)).
Doing a map_to_file on the opts map sounds like it could be more useful in order to have some hard numbers to go on, but imbw.

Also, so changign line 742 to
Code:
case 1022: d[$element[none]] = max(0.5,0.15*get_power(equipped_item($slot[weapon])))+0.5+ceil(square_root(min(1,numeric_modifier("Weapon Damage"))));
would probably work. Or can the numeric modifier be anything between 0 and 1?
 

Bale

Minion
Bale, was it casting Salve in the custom actions section or in the stasis section?

I'd like to apologize for my previous report of difficulty with salving. It seems that I was missing some very important information. I was being hit by the monster every round so there was always damage to heal. However this does lead to another matter of some concern with SS.

When the starfish familiar is a starfish or rogue program each shot of MP is free and it is fine for 20% of that MP to be used healing HP. However, when the familiar is a slimeling, GGG or hobo each time it acts there is a cost associated with it. Now, I might be missing something so please point out if I am, but is the cost of my slimelings actions considered relative to the damage that I might take in the fight? I'm not entirely sure if I'm missing some code or if the formula in BatFactors takes that into consideration...

Also, so changign line 742

Why are you changing the code for clobber?
 
Last edited:

Winterbay

Active member
Feature comment:
The matching of poisoned is at odds with the auto-removal of poison. I would suggest the following change to line 916:
Code:
res.append("abort " + ((get_property("autoAntidote") != "0") ? "" : "match effect*Poisoned || ") + "match \"Toad In The Hole\" || match \"a massive loogie\" || hpbelow "+round(m_dpr(0,0))+"; scrollwhendone; sub batround");

I.e. if autoAntidote is on let the script do that if needed and abort otherwise.
 

zarqon

Well-known member
It should still abort when you get poisoned because your stats will change, and SS will need to recalculate the profitability of your actions. You don't want to keep stasising a monster which is now able to kill you.

Big update coming soon -- it's very exciting.
 

Theraze

Active member
When it aborts for me, it completely aborts automation, it doesn't recalculate. Is it supposed to just recalculate?
 

Winterbay

Active member
The problem is that the match is catching all previous rounds, so even if I use a anti-anti-antidote to make the poison go away the match will still abort even though it's a new run of the script.
 
Top