SmartStasis -- a complex script for a simple CCS

Magus_Prime

Well-known member
There seems to be something wrong with the latest versions of SmartStasis and/or BatBrain. I'm testing a CCS script that consists of the following:

consult SmartStasis.ash
attack

and when the script runs SmartStasis errors out. Here is the output with zlib verbosity set to 10.

This is with KoLmafia SVN version 9390.

Any thoughts?

Edit: this issue seems to have been found and fixed in the BatBrain thread.

Code:
[2256] Poop Deck
Encounter: whiny pirate
Strategy: I:\software\Kol\ccs\Test SmartStasis.ccs [default]
Round 0: Arbos wins initiative!
Round 1: Lefty latches onto your opponent's face with his wriggling tentacles.
Round 1: whiny pirate drops 12 attack power.
Round 1: whiny pirate drops 12 defense.
1 MP costs 4.0816326μ.
1 HP costs 0.78158927μ.
bilge wine (30.0 @ +45.0): 65μ * 43.5% = 28.275
Value of stat gain: 290μ
bilge wine (30.0 @ +45.0): 65μ * 43.5% = 28.275
Value of stat gain: 290μ
Monster value: 462.28
Evaluating 'max(2,(25.0/2))'...
You will die in 300 rounds.
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Your attack will kill the monster in 2 rounds.
Evaluating 'max(2,(25.0/2))'...
Unexpected error, debug log printed.
1 MP costs 4.0816326μ.
1 HP costs 0.78158927μ.
bilge wine (30.0 @ +45.0): 65μ * 43.5% = 28.275
Value of stat gain: 290μ
Building options...
Evaluating '45*loc(chasm)'...
Evaluating '1.0*(5.5+min(0.07*248.0,15)+min(10.0,25)+0.0)'...
Evaluating '1.0*(12+min(0.15*248.0,20)+min(10.0,40)+0.0)'...
Evaluating '1.0*(28+min(0.25*248.0,30)+min(10.0,60)+0.0)'...
Evaluating '1.0*(2.5+min(10.0,5)+0.0)'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Options built! (33 actions)
Unexpected error, debug log printed.
1 MP costs 4.0816326μ.
1 HP costs 0.78158927μ.
bilge wine (30.0 @ +45.0): 65μ * 43.5% = 28.275
Value of stat gain: 290μ
Building options...
Evaluating '45*loc(chasm)'...
Evaluating '1.0*(5.5+min(0.07*248.0,15)+min(10.0,25)+0.0)'...
Evaluating '1.0*(12+min(0.15*248.0,20)+min(10.0,40)+0.0)'...
Evaluating '1.0*(28+min(0.25*248.0,30)+min(10.0,60)+0.0)'...
Evaluating '1.0*(2.5+min(10.0,5)+0.0)'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Evaluating 'max(2,(25.0/2))'...
Options built! (33 actions)
Unexpected error, debug log printed.
You're on your own, partner.
 
Last edited:

xKiv

Active member
Strange, since I have a farming macro where the first line is "pickpocket" that I use even when I'm not a moxie class (and unable to pickpocket any other way), and it runs just fine.

Apparently, "you don't have pickpocket because you already used it up" is not the same as "you don't have pickpocket at all".
 

vert

New member
When I'm adventuring in the castle at level 10 with "2 choiceadv, castle map items, 1 heavy D" as my goal, I really don't want to olfact goth giants, but SmartStasis thinks I do. It would be very nice if that behavior were a little more context-sensitive.
 
Not sure what's going on here. I'm getting an error

Code:
Script parsing error (smartstasis.ash, line 14)
Consult script 'smartstasis.ash' not found.
You're on your own, partner.

Tried deleting and re-downloading smartstasis and still getting it.
 

EdFox

Member
I can confirm that. Latest SS, BB, zlib, ver 9391. Tried ver 9390 but same effect.

This makes no sense to me as line 14 in the version check. I commented out 14 and then got the error on line 16.
 

Theraze

Active member
Line 14 is
Code:
check_version("SmartStasis","SS","3.4",1715);
Any chance you forgot to get zlib?

Edit: Looks like it's actually an issue with importing BatBrain...
> validate batbrain.ash

Script parsing error (batbrain.ash, line 1)
 
Last edited:

EdFox

Member
Yeah, it's BB. I downloaded SS, BB, and zlib again and the error changes to:

Unknown variable 'a' (BatBrain.ash, line 583)
Consult script 'SmartStasis.ash' not found.
You're on your own, partner.

I had made the change in the BB thread so that explains the difference.
 

EdFox

Member
It works, yay!

That was confusing. The error pointed strongly to SS but it was BB generating them.

Thanks for the fix.
 

Winterbay

Active member
I had a similar error when I managed to convert my file format into something that Mafia couldn't read. That was... interesting to find out :)
 

Theraze

Active member
To actually get an accurate count of how many attacks it will take to finish off the monster, SmartStasis needs to have act() or build_options() above the kill_rounds and die_rounds at the top... What I'm currently doing is
Code:
act("");
vprint("Monster value: "+rnum(monstervalue()),"green",5);
print("You will die in "+die_rounds()+" rounds.");
print("Your attack will kill the monster in "+kill_rounds(get_action("attack"))+" rounds.");
Changes are the act(""); at the top and changing kill_rounds(regular(1)) to kill_rounds(get_action("attack")) which is the part that really needed the act() part.
 

zarqon

Well-known member
Or, rather than build the entire combat environment twice just for the sake of some print statements, you could just move the print statements into main, under the call to act(). I'll go ahead and do that, since get_action("attack") results in more useful info than regular(1).

Recent changes to BatBrain required some edits to SS, and so we have an update. Not very exciting, but necessary nevertheless.
 

Theraze

Active member
Tweaked SmartStasis to no longer try to noodle top tier bees.
Code:
   if (get_action($skill[entangling noodles]).id != "" && m_dpr(0,0)*2*meatperhp > mp_cost($skill[entangling noodles])*meatpermp && !($monsters[cyrus the virus, queen bee, beebee king, bee thoven] contains foe))
Used the check from BatBrain, so it also skips Cyrus. Checked, and Bee Thoven also needs to be skipped. I'll post that on BatBrain.
 

zarqon

Well-known member
An easier way would be to check the value of the Noodle event's stun property. For multistun-immune monsters, all stuns > 1 are set to 0 when building optionis. I'll put this (or something better) in the next update so that it can make use of BB's knowledge.

Something programmatic would be better, which considers all sources of stun. This line in SS is really just a placeholder.
 

Winterbay

Active member
Something like this maybe?
Code:
if (get_action($skill[entangling noodles]).id != "" && get_action($skill[entangling noodles]).stun > 1 && m_dpr(0,0)*2*meatperhp > mp_cost($skill[entangling noodles])*meatpermp)

Also, wouldn't be better to replace all m_dpr(0,0) with m_regular()? Or is there some specific reason for not doing that?
 

Theraze

Active member
Because if you out-moxie them, they aren't going to hit you and it doesn't make sense to noodle them... m_dpr handles hitchance, m_regular doesn't.
 

zarqon

Well-known member
Yep! However, the point of the id != "" check is to see if it's an empty event. If stun > 1 it's definitely not empty, so you can just replace one check with the other rather than include both.

m_regular() is the monster's damage when it hits you, which it very well may not. Thus m_dpr().
 

Winterbay

Active member
Yep! However, the point of the id != "" check is to see if it's an empty event. If stun > 1 it's definitely not empty, so you can just replace one check with the other rather than include both.

m_regular() is the monster's damage when it hits you, which it very well may not. Thus m_dpr().

True... That makes the line easier to read as well :)
 
Top