SmartStasis -- a complex script for a simple CCS

2 things!

1) Thanks for the awesome script. It's saved me tons of time and meat, and in general works perfectly.

2) In regard to the latter, the script as it is now continues to stasis until the automatic cutoff at turn 27 if you can cast disco nirvana, regardless of whether or not it has been cast.

This is because the check to see if it has been cast is performed when disco nirvana is attempted, instead of as part of can_nirvana. Rather than move stuff around and make it more confusing, just change line 163 to

Code:
if ((my_mp() == my_maxmp()) && (!can_nirvana || (can_nirvana && have_effect($effect[disco nirvana]) > 0))) inmp = 0;

Hope this helps (and I'm not overlooking something crazy)!

edit: I also have a version of your script I've tweaked to include Disco Concentration, if you (or anyone else) is interested. I haven't attached it because it doesn't regard the additional MP drain, and as such combined with Disco Nirvana will drain your MP reserves (and therefore possibly your meat) rather quickly unless you are using an MP familiar. I'm also thinking of integrating it with libram costs, in order to avoid casting any combos (and therefore possibly regaining/regenerating MP) until the cost for the next libram is higher than your maximum MP. Oh, ambition.

2nd edit: I also forgot to mention one niggling problem, in that the Rock Lobster (can you tell I've been using it a lot?) has MP regain tied to its fire element damage, which means that it only gains 1MP per regain when facing any fire-elemented creature. This is (along with the issue of librams) kind of going outside the scope of the script, but it has been noticable. Just something to think about.
 
Last edited:
I also modified it for disco concentration (with simple logic to only cast concentration if a 20% improvement in drops * autosell value for drop is bigger than the meat cost of the mp used)

BTW it looks to me like you're assuming disco nirvana only improves meat drops by 20%, I think it actually increases them by 30%. I changed the constant in my version.

Also rearranged the stasis item logic to prefer dictionaries (in non-orc chasm areas) just because I like the fact that it does 0 damage. Could you also use a molybdenum magnet as a statis item if you're not in the junkyard?
 

Attachments

Also, I was getting essence discs from Seaside Megalopolis today and noticed that I fought and stasised about 10 dwarf replicants without getting the item.

I've been getting essence discs today; the script (v1.9.2) successfully gathered cold, fright, and stench, but somehow missed kink twice and heat once (even though I saw the purple and red elemental attack messages).

Possible factor (or red herring) - the script seemed to be casting saucy salve - perhaps that was overriding the ruby attack.

-Th3y
 
Last edited:
@Batrach: Awesome changes/fixes. The check for Concentration profit also needs to realize that item drop rates are capped at 100% -- if the drop is already at 100%, there will be no additional profit. It can also check for goals! I will add all these changes in the next update.

I've already written most of the above, but I'd like to add one more thing before releasing it. To be thorough, SS should also consider sources of bonus damage to DB skills. Otherwise, if you are wearing the Tawdry Tramp Togs (+20 to DB skills), you could easily kill the monster before finishing your combo. Does anyone know where to find a list of items/effects/etc that grant bonus damage to DB skills? My initial searches of the Wiki aren't showing me anything remotely comprehensive.

EDIT: This is what I have so far. Anyone know of anything I've missed?

Code:
int bonus_db = to_int(have_equipped($item[disco banjo]))*3 + to_int(have_equipped($item[shagadelic disco banjo]))*7 +
               to_int(have_equipped($item[makeshift castanets]))*10 + to_int(have_equipped($item[Chester's moustache]))*20 +
               to_int(string_modifier("Outfit") == "Tawdry Tramp Togs")*20;
 
Last edited:
I think this is a dmb question but I was fighting a gremlin using this and it only lasted 2 rounds. The gremlin I was fighting in mafia has the item to drop, but the adventure lasts just for 2 rounds. Help? Sorry, I'm still kind of a noob to scripting.
 
@hello: Show me what happens in the CLI when you auto-adventure (most helpful if you also have the logging options turned on for showing monster health and familiar actions).

Just about ready to go with the SS updates!
 
Really? Because I tried with SmartStasis just today and it didn't work. (I tested it twice actually, since I was farming instead of ascending today.) And with your scripts it is impossible for me to not have the latest version or they get all whiney at me, so I know that is not an issue. ;)

If I'm using SmartStasis, I don't need FTF in my CCS, right?
 
Last edited:
SS calls FTF first so you don't need it in your CCS.

Did you have enough MP to Olfact? That's a difference between my scripts and mafia -- if you had insufficient MP then casting Olfaction would have been skipped.
 
Yes, I had plenty of MP. As soon as I put the "special action" line in, it cast olfaction like I wanted, without needing to restore. If it matters, I was choosing to olfact by the name of the monster, not an item.
 
Last edited:
Going over your code, I think I found the bug. Here's the relevant line:

Code:
   if (get_property("autoOlfact").contains_text("monster "+to_string(nowfightingonstageone))) should_olfact = true;
What you weren't considering is that my auto-olfaction was all in lower case, while the monster had capital letters in its name. Also, sometimes I only use part of a monster's name. For instance, olfact monster dairy, should olfact a dairy goat since auto-olfaction normally works that way so it is habit to use it like that.

Code:
if(substring(get_property("autoOlfact"), 0, 7) == monster && to_string(nowfightingonstageone).to_lower_case().contains_text(substring(get_property("autoOlfact"),8).to_lower_case())
  should_olfact = true;

Edit: Just realized it might be more interesting to substring(get_property("autoOlfact"),8).to_monster() and make use of mafia's built in fuzzy matching.

Code:
if(substring(get_property("autoOlfact"), 0, 7) == monster && nowfightingonstageone == to_monster(get_property("autoOlfact").substring(8))
  should_olfact = true;
 
Last edited:
Aha, good catch. I was under the impression that mafia normalized the input for that setting.

But even if that were so, it would be better for cases where a user might manually specify something for the setting using other means than the GUI. I'll fix that in the next update (the same time as SS, since some things ended up moving from FTF to SS).
 
I note one potential problem with my second code. What happens if the user enters a faulty partial monster name and kolMafia can't match it to an actual monster? Would that cause an error?
 
What happens if the user enters a faulty partial monster name and kolMafia can't match it to an actual monster? Would that cause an error?
Incidentally I did some testing of this and I'm surprised to say that it does not cause an error. I've modded FTF and am quite happy with the results. This is what that line looks like now:

Code:
   if(get_property("autoOlfact").length() >7 && substring(get_property("autoOlfact"), 0, 7) == "monster" 
      && nowfightingonstageone == to_monster(get_property("autoOlfact").substring(8))) should_olfact = true;
 
Thanks for saving me some time. I'll put this in the next update, which will be pretty cool in the way it handles Disco Combos, if I do say so myself.
 
2.0 Updates!

  • Fixed the issue th3y reported. If the special message happened while FTF was doing its thing, the magnet/Ruby Rod attack would not happen. Moved detection and response from SS to the action filter of FTF, since we want those actions to happen without fail.
  • Fixed the issue shinomory reported. The script should now stop stasising for MP if your MP is full and you have already cast possible disco combos.
  • Fixed the erroneous formula for Disco Nirvana. You'll probably see it cast more often now.
  • SS now prefers dictionaries as stasis items since they actually do 0 damage.

And the big one:

Support for Disco Concentration!

It will perform this combo if it's possible without killing the monster and either of the following are true:
  • it will help you acquire a goal.
  • the difference in value between casting vs. not casting is greater than the value of your MP cost to cast it. (In other words, if it's profitable.) Note that if you use an MP-restoring familiar you will be much more likely to cast it, since possible future restoration is taken into consideration when determining the cost of the combo.

Since some code was moved from SS to FTF, you will need to update both.

Enjoy!
 
Hmmm,

I seem to be getting Disco Concentration cast permanently, possibly this is because I have free disco rests which mean that my cost to restore MP is 0, but it would be nice to be able to turn this off, as I don't always want to be casting Disco concentration, but rather want to use less turns restoring MP for instance, or want to save those disco rests for another time... Also, it seems to run Disco concentration preferentially to Disco Nirvana? In the castle I've only ever got concentration, and I would have thought Nirvana would be more profitable...
 
Back
Top