SmartStasis -- a complex script for a simple CCS

Further testing, using 17496: on a character without pocket crumbs (not wearing Pantsgiving), using the CSS I posted above, a combat looks like this:
[1187171] Gingerbread Sewers
Encounter: gingerbread rat
Round 0: Parco Molo wins initiative!
Round 1: Parco Molo casts POCKET CRUMBS!
KoLmafia thinks it is round 2 but KoL thinks it is round 1
Round 1: Parco Molo casts SUMMON LOVE MOSQUITO!
Round 2: gingerbread rat takes 75 damage.
Round 2: You gain 75 hit points
Round 2: Blopblip shakes loose a considerable quantity of spice. You conjure up a canister and collect it.
You acquire an item: spices
Round 2: Parco Molo casts EXTRACT!
You acquire an item: Source essence (2)
Round 3: Parco Molo executes a macro!
Round 3: Parco Molo casts FIRE ORANGE BOTTLE-ROCKET!
Round 4: Dog pelts it with a snowball. Where it came from, we're not sure, but it takes 22 damage.
Round 4: gingerbread rat takes 22 damage.
Round 4: Parco Molo attacks!
Round 5: gingerbread rat takes 9669 damage.
Round 5: Parco Molo wins the fight!
I removed "consult SmartStasis.ash" from the default CSS, then combat looked like this:
[1187173] Gingerbread Sewers
Encounter: gingerbread alligator
Round 0: Parco Molo wins initiative!
Round 1: Parco Molo executes a macro!
Round 1: Parco Molo casts SUMMON LOVE MOSQUITO!
Round 2: gingerbread alligator takes 38 damage.
Round 2: You gain 38 hit points
Round 2: Blopblip shakes loose a considerable quantity of spice. You conjure up a canister and collect it.
You acquire an item: spices
Round 2: Dog drops a bunch of ice cubes down your opponent's shirt, dealing 14 damage.
Round 2: gingerbread alligator takes 14 damage.
Round 2: Parco Molo casts EXTRACT!
You acquire an item: Source essence
Round 3: You lose 139 hit points
Round 3: Parco Molo attacks!
Round 4: gingerbread alligator takes 4837 damage.
Round 4: Parco Molo wins the fight!
The same things happened if I removed the "if hasskill/endif" around "skill pocket crumbs": with consult SmartStasis.ash KoLmafia tries to use the skill, without that line it doesn't. I don't know if the fault here is with SmartStasis or with KoLmafia itself, as I can't understand how a command later in the CSS would affect how an earlier one is treated.
 
That sounds like this bug report which says that if you have a combat macros preceding a consult script, it screws up the combat macro.

That happens to be next on my list of bugs to look at.
 
Tardigrade, a simple fix for you in the meantime -- and one which would reduce the server hits in some of your combats -- would be to add lines to SS to perform those skills.

Change this bit at the bottom:

Code:
  // stasis loop
   stasis();

to this:

Code:
   enqueue($skill[pocket crumbs]);
   enqueue($skill[summon love mosquito]);
   enqueue($skill[extract]);
  // stasis loop
   stasis();

This will simply fail to cast the skills if you lack them. Plus, they will will be added to whatever custom actions SS performs and submitted in a single macro (reducing server hits).

I must admit to some confusion as to why you're explicitly specifying Extract. Is SS's handling of Extract not casting it for you?
 
I've added some code to make SS always try to Extract Jelly if you're fighting an elementally-attuned non-boss. Anyone have any insights to add before I commit this? It seems there's presently no way of SS knowing your odds of getting jelly from casting it, so we're left casting the skill even at the end of the day when you may have used up all your possible jelly drops.
 
Well that works just fine, then. I inferred from other KoL mechanics that the drop rate was likely to approach 0. Added in r33.
 
I've added some code to make SS always try to Extract Jelly if you're fighting an elementally-attuned non-boss. Anyone have any insights to add before I commit this? It seems there's presently no way of SS knowing your odds of getting jelly from casting it, so we're left casting the skill even at the end of the day when you may have used up all your possible jelly drops.

There are some valuable insights for me to add. Sorry I was a number of hours late to notice this thread.

The chance for success on your first absorption is always 100%. The next several jellies have a decreasing chance of success. This means that you want to target your initial elemental jellies to the ones you actually need like hot, spooky and stench while avoiding cold and sleaze which are pretty worthless during a run.

Starting with Jelly number 4 or 5, the chance of success levels off at 5%. Spading is still a bit unclear on which extraction is the last one to be above 5% because the chance of extraction 4 is pretty low.

This means that after jelly 4, you should definitely try to extract any elemental monster. The first three or four jelly extractions are more valuable and shouldn't be used without thought or else you'll load up on useless cold jellies and fail to get the jelly which you definitely need. (Though I could see reason to assume the player would always want it if it is one of the three valuable elements.)
 
Last edited:
Does mafia track daily jelly drops? It couldn't be tracked in $familiar[space jellyfish].drops_today because there would need to be five separate counters. The inability to predict drop likelihood (and indeed, as you now posit, the opportunity cost of choosing an undesirable element) was why I was hesitant to commit this. But if there are no complaints, I guess that means it's perfect! ...?

However, I was under the impression from the Wiki that each element was somewhat independent as far as drop chance goes, which would reduce or eliminate that opportunity cost. Has that assertion been found to be inaccurate?
 
Adding a drops_today field means adding a drops_limit field. That could be something silly like MAX_INT, I suppose. Or maybe the default value of 0 wouldn't mess with scripts that use it.
 
Does mafia track daily jelly drops?
_spaceJellyfishDrops

However, I was under the impression from the Wiki that each element was somewhat independent as far as drop chance goes, which would reduce or eliminate that opportunity cost. Has that assertion been found to be inaccurate?

Quite wrong. The element has no bearing on the chance of success. All that matters is how many total jellies have been successfully sucked today.
 
By the way, the last update to SS added throwing gourd items at minions once a day in villain lairs!

Also, as previously discussed in the Batman RE thread, we have moved casting Approiviseurement la Tortuguloisante to SS, so it's no longer an autoresponse in BatBrain. This solves a frustration Batman RE users were having, in addition to meaning that the Appreuviseunting will be preceded with stunners where helpful. Yay!

Enjoy!
 
r36 Update

Though I haven't yet added the planned selective attraction logic, a few necessary things have been added to the script (for LAR in particular) so it's time for an update! First, the important fixes:

  • ALWAYS EXTERMINATE SPANT
  • Banishing and attracting are not available in LAR, so skip those actions when on that path.

A somewhat significant change to the default behavior also crept in with this update: SS now assumes that certain monsters you may have in BatMan_yellow are in there for ascension-specific reasons. So far, if you've had "Knob goblin harem girl" in your BatMan_yellow setting, SS would always try to yellow ray a harem girl whenever possible. This caused me a bit of frustration during runs as sometimes if I was blasting through a zone SS would squander a yellow ray when I already had the monster's drops. I found myself removing most monsters from the setting to avoid squandered yellow rays -- which means the setting was mostly useless and therefore a design change was necessary. So, there is now some code there to protect you. The following fairly common yellow ray targets will now not be yellow rayed if the following conditions are met:

  • beanbat: You already have enough sonars.
  • Knob Goblin harem girl, 7-foot dwarf foreman, frat warrior drill sergeant, war pledge, war frat 151st infantryman, orcish frat boy spy, war hippy drill sergeant, war hippy (space) cadet, war hippy spy: You already have the relevant outfit.
  • cowskeleton: You already have a rusted-out shootin' iron.
  • banshee librarian: You already have or no longer need a killing jar.
  • burly sidekick, quiet healer: You already have or no longer need the wig or amulet for Castle stuff.
Of course, none of them will ever be yellow rayed if they are not specified in the setting to begin with. Hopefully this helpful logic makes the BatMan_yellow setting useful again. I'm considering getting hats made that say MBUA.

Enjoy!
 
r37: Olfaction Overhaul and new Duplicate control setting!

As previously discussed in both the New-You script thread the BatBrain thread, by this point in KoL's development there are now quite a few possible reasons for SS attracting a monster:

  • You specified it in mafia's autoOlfact property.
  • You specified it in BatBrain's BatMan_attract setting.
  • It's your New-You quest monster.
  • It's your bounty monster.
  • You specified "goals" in autoOlfact and the monster drops goals.
This means that for a given location it's possible to have up to four valid attraction targets, in which case it would actually make everything take longer to attract only one of the targets.

So, SmartStasis will now skip attraction when there are multiple targets of any of the last four types in your current zone. If you still want a monster to be attracted, you can override this by setting a specific monster in autoOlfact. Monsters specified there will be attracted regardless of the number of targets SS detects in that location.

To assist with correct target detection, just as with yellow raying above I've added filtering logic for common BatMan_attract targets. Some monsters are only targeted due to quest-related reasons, after which targeting them is unnecessary and even undesirable. So, now if any of the following monsters are specified in your BatMan_attract setting, they will only be considered valid targets if:

  • anesthesiologist bugbear: You haven't cleared the Medbay.
  • angry mushroom guy: You still need fizzing spore pods to unlock the Nemesis area.
  • blooper: You still need a digital key.
  • cabinet of Dr. Limpieza, possessed wine rack: You are in a path that can take the wine bomb shortcut and need the relevant unstable fulminate drop.
  • creepy eye-stalk tentacle monster: You still need the bugbear communicator badge.
  • dairy goat: You still need at least 2 more tasty quest cheese.
  • dirty old lihc: You still need more lihcs to clear the Evil.
  • pygmy shaman: You haven't defeated the Apartment's spectre.
  • unemployed knob goblin: You can still get 2 or more beer lenses.
  • violent fungus: You are working on the Primordial Fear quest.
  • writing desk: You need at least another desk after this one to get the key.
This logic is based on monsters I've used or considered as attraction targets. It could be expanded or reduced as desired for more qualifying monsters.

Duplicate!

I found myself having settled into a routine for my Duplicate uses, to the point where automation would be helpful. So viola! SS has a new setting for handling Duplicate: BatMan_duplicate. Monsters specified here (default: lobsterfrogman and gaudy pirate) will be Duplicated when encountered if you have Duplicate available. As with yellow rays and attraction, I've added filtering logic for both gaudy pirates and lobsterfrogmen, so that Duplication will only be attempted if you still need the Talisman or (more than one) gunpowder for the sidequest, respectively. Removing the monsters from BatMan_duplicate will, of course, always skip Duplication for them.

Enjoy this marked improvement in functionality! Also, sorry violists but C clef is terrible.
 
Last edited:
[*]dirty old lihc: You still need more lihcs to clear the Evil.

Is this the same as "current evilness is 30 or more"?
(because if its 29, then this lich will take it to 26, and the next monster to 25 even if it isn't a dirty lihc)
 
Looks like I used a number one lower:

PHP:
      case $monster[dirty old lihc]: if (qprop("questL07Cyrptic") || get_property("cyrptNicheEvilness").to_int() < 29 + to_int(have_equipped($item[gravy boat]))) return false;

I'll make that a <=, and double the gravy while I'm at it.
 
r39 restores handling for defeating the old tower monsters with the appropriate item, since they can still be faced and defeated that way.
 
Definitely use WHAM for combat and Universal Recovery for healing. If you don't have Advanced Cocktailcrafting permed, you should probably start as a Disco Bandit so you can get it and perm it for your next run.

Is there any way to make wham not stasis for 25 rounds for no reason? My internet connection isn't THAT fast.
 
Is there any way to make wham not stasis for 25 rounds for no reason? My internet connection isn't THAT fast.

Moved from bcca thread since this is basically a question about SmartStasis, IMO.

Your premise that stasis is being done for "no reason" is probably incorrect. There is a reason but the benefits might not be worth it to you.

Since you are using WHAM you could set WHAM_maxround to something lower than 25 to address the symptom, but if you gave a us an idea of your familiars, equipment and monsters where you are seeing this, there may be some other setting that can be tweaked. In general when I have seen 25 rounds of stasis, i have a familiar that might act in some beneficial way and stasis is being attempted until the familiar acts.
 
Back
Top