CounterChecker: Wormwood, Semi-rares, Dance Cards and more

Bale

Minion
[size=+1]CounterChecker 1.6[/size]
This version requires and is required for the latest version of KolMafia here.

This script will automatically handle all your counters automatically. It contains all the features of previously shared counter scripts, plus more! Supported Counters:
  • Fortune Cookie: If you're not in hardcore it will get the available semi-rare with highest mall price.
  • Wormwood: Will automatically get the wormwood goal of your choice. You can set the goal in CLI with: set wormwood = goal
  • Dance Card: Will adventure in Ballroom, if you're not already there and use another dance card.
  • CLI: You can delay execution of a CLI command. To defer it for <num> turns, type this in the CLI:
    counters add <num> cli <command>
  • Dude Ranch Vacation, Tropical Island Vacation, Ski Resort Vacation: Will abort automatic adventuring and alert you that the vacation is ready to produce a tower item, but it will not adventure there automatically so you can purposefully schedule those 3 turns.

To use:
  1. Distribution has migrated over to SVN. To install this script, with a current daily build, please copy/paste the following line into KoLmafia's CLI and press enter:
    Code:
    [PLAIN]svn checkout https://svn.code.sf.net/p/bale/counterchecker/code/[/PLAIN]
    * This will also install zlib which is used for a lot of other scripts, so you might already have it. ;)
  2. In the CLI use the command:
    set counterScript = CounterChecker.ash
  3. If you're using absinthe, you'll probably want to set your wormwood goal.
    Use the command set wormwood = goal

More detailed instructions in the following post.
 
Last edited:
Automatic Wormwood adventuring:
If using absinthe, you can set your goal to be any wormwood prize or stat. You can add 51 or 1 to a stat to limit the turns you spend on your stat adventures. This script is very good at figuring out what you mean, so you can just type "cancan", "skirt" or "pants" to get a can-can skirt. Lots of abbreviations will work. You'd be surprised how you can improvise and still get the prize you desire. If you do not set your wormwood goal, then the script will assume you want a not-a-pipe.
  • set wormwood = !pipe
  • set wormwood = mask
  • set wormwood = hat
  • set wormwood = moxie 5-1
  • set wormwood = myst1
  • set wormwood = Mysticality
  • set wormwood = pants
  • set wormwood = s.t.l.t
  • set wormwood = stlt
  • set wormwood = food


Options:
All options will be saved to a file specific to the character so that each character can have different variables. This file is in your /data directory and is named vars_<character>, where <character> is the character's name.
  • BaleCC_SrInHC: Automate Semi-rares in Hardcore and Ronin. If this is false, then you won't have to worry about CounterChecker determining your semi-rares for you while ascending.
  • BaleCC_useDanceCards: Use another dance card after going to the Ballroom for Dancing Matilda.
  • BaleCC_ImprovePoolSkills: If you are automating semi-rares, then instead of choosing an expensive semi-rare item, your character will improve his chance of winning at the VIP Pool Table.


Changelog:
v1.1 Sept 9, 2009
- Now, if you have the script set to ignore semi-rares in hardcore, it will also ignore them in ronin. The script is now completely ascension safe.

v1.2 Sept 14, 2009
- Fix for not having basement access in your clan
- Now it can handle negative counters. (For compatibility with future kolMafia feature.)

v1.3 April 20, 2010
- Fixes for various bugs.
- Adds consideration for distilled fortified wine, tasty tarts and scented massage oil.
- Reports current sale price of semi-rare that it automates.

v1.4 October 18.2010
- Update for compatibility with zarqon's BBB.

v1.41 January 26, 2011
- Maintenance update for change to Friar's Quest

v1.49 February 1, 2011
- Added checks for every single semi-rare
- Proper checks to see if each semi-rare is currently accessible

v1.491 February 1, 2011
- Fixes for continuum transfunctioner and stench resistance where needed

v1.492 February 1, 2011
- Final fix to stench resistance for myst classes. Thanks, Theraze.

v1.493 February 11, 2011
- Fix unlocked locations bug.

v1.494 February 12, 2011
- Fix CanAdv check for Limerick Dungeon.

v1.495 February 13, 2011
- Small code improvement. Not even a bug.

v1.496 February 16, 2011
- Fix adventuring check for KoL's Cobb's Knob revamp.
 
Last edited:
Okay, I'm not really certain that we really need another counter checker, but this one wraps up all generally used counters in a single script, so the user won't have to download 3 different scripts and possibly get confused. It does require Zarqon's zlib, but most scripts require that nowadays, so it isn't an unusual requirement. (Thanks for zlib, Zarqon.)

Also, this script plays nice with the counters that my recovery script will invoke, so that little bit of interactivity between my scripts is nice.

I'm also proud of the fact that when setting my wormwood goal I don't have to remember the correct name for the objective. It is hard to type something so wrong that this script won't recognize it. If someone does manage to mess it up, without truly egregious typos, then please let me know so that I can add that as an option.
 
Two questions:

1) Will I have to rewrite my farming script to eat a cookie every day (note: I have never eaten a cookie) or will Mafia somehow automatically invoke this script as needed?

2) Will this interrupt normal adventuring to go get a semirare?
 
Tried this out the other day while farming the stately pleasure dome and it never switched to the other locations to get the not a pipe. i'm not entirely sure if i set it up correctly by using counterscript = counterkeeper.ash in the CLI though.
 
Will I have to rewrite my farming script to eat a cookie every day (note: I have never eaten a cookie) or will Mafia somehow automatically invoke this script as needed?
It will automatically eat a cookie after every time it gets a semi-rare, so you'll have to leave some empty space in your tummy if you want it to eat fortune cookies for you. However, you'll have to eat that first one yourself if you want it to get started.

Will this interrupt normal adventuring to go get a semirare?
Yes, it will. However if you are in hardcore or ronin it won't do that unless you change the default setting.

Tried this out the other day while farming the stately pleasure dome and it never switched to the other locations to get the not a pipe. i'm not entirely sure if i set it up correctly by using counterscript = counterkeeper.ash in the CLI though.
Ah. Actually that's because mafia won't initiate a counterscript if you're already in a zone that the counter is attuned to. This is also an issue for not triggering dance card counters in the ballroom, so it won't know to use a new dance card. Perhaps I should report this as an issue to the mafia devs, though I think they probably consider it a feature... Sorry, there's no way for me to cause the script to activate for absinthe usage if you're in an absinthe zone. I'll report this and ask for a change to mafia.

Edit: Asked for a change to mafia's counter behavior here.
 
Last edited:
Okay, one last question:

I know that if you try to eat a cookie immediately after getting a semirare it will give you totally random numbers until you re-seed the counter by accessing adventure.php. As I was poking around in your code, it did not seem like you were doing this but were just immediately eating a cookie after getting the semirare. Am I wrong or should I try to tweak the code a little to add an adventure before eating the next cookie?
 
You are mistaken. If you eat a cookie immediately after getting a semi-rare it works just fine.

The situation in which your numbers are meaningless are if you eat the cookie without accessing adventure.php since rollover, login or ascension. (Getting a semi-rare is a visit to adventure.php and takes care of things perfectly.) Trust me that my script works since I've had a character generating semi-rares only by eating the cookie that is automatically eaten by the script.
 
Last edited:
Just a heads up, this script breaks if your clan has a clan basement and you are not allowed in. I added a check to make sure you are allowed.

Code:
	// This finds out if the PLD can be accessed for semi-rare usage.
	if(last != "The Purple Light District") {
		if(visit_url("town_clan.php").contains_text("clanbasement.gif") && !visit_url("clan_basement.php?fromabove=1").contains_text("not allowed")) {

This seems to fix it, but I'm not sure if there are other circumstances that break it.
 
Thanks for this - I've been using a slightly modified cookie.ash (from http://kolmafia.us/project.php?issueid=184) for a while, and have been very happy with it (although, amusingly, it almost never /does/ anything for me, since I'm only rarely in aftercore). Looking forward to increased functionality!
 
Will this resume adventuring in the original zone after the counter hits? For example lets say that I am used adv * gallery with 40 adventures, the cookie counter expires after 10 adventures, will it automaticly continue adventuring in the gallery for the next 29 adventures? Or would I have to manually restart the gallery adventuring?
 
Yes, it will do that.

Actually, now that jason changed counter handling in r7639, several other problems, like halfvoid's issue have disappeared. The script should now be able to get absinth if you're adventuring wormwood and use dance cards if you're in the ballroom.

I've uploaded my latest version which is better at handling informational counters that go negative. (That can happen thanks to jason's update in r7639.)
 
Last edited:
adv * gallery with 40 adventures, the cookie counter expires after 10 adventures, will it automaticly continue adventuring in the gallery for the next 29 adventures?
It will continue for the next 30 adventures - turns spent by a counterScript don't count towards your original request.
 
Bale I have a request:
When more than one counter expires on the same adventure can the cookie counter take priority? I have missed more than one semi-rare this way while trying to level my disco bandit with dance cards or tiny bottles. The dance cards and bottles are a much cheaper sacrifice than a semi-rare.

Code:
Request 6 of 50 (Hobopolis: Hobopolis Town Square) in progress...
Checking counters now.

Visit to Knob: Outskirts of The Knob in progress...
Checking counters now.

Visit to Manor2: Haunted Ballroom in progress...

[5583] Haunted Ballroom
Encounter: Rotting Matilda
You gain 293 Sarcasm

Using 1 dance card...
Finished using 1 dance card.

[5584] Outskirts of The Knob
Encounter: sleeping Knob Goblin Guard
Strategy: d:\Data\My Stuff\kol\Kol Mafia\ccs\sewer.ccs [default]
Round 0: alotavagina wins initiative!
Round 1: alotavagina tries to steal an item!
You acquire an item: Knob Goblin scimitar
Round 2: alotavagina attacks!
Round 2: sleeping knob goblin guard takes 211 damage.
You gain 5 Meat
You acquire an item: viking helmet
You acquire an item: Knob Goblin pants
You gain 4 Beefiness
You gain 5 Enchantedness
You gain 9 Sarcasm

Oops, that wasn't the right number!
 
Bale I have a request:
When more than one counter expires on the same adventure can the cookie counter take priority? I have missed more than one semi-rare this way while trying to level my disco bandit with dance cards or tiny bottles. The dance cards and bottles are a much cheaper sacrifice than a semi-rare.

More than reasonable. Now semi-rares take priority. I didn't bother updating the version number in the thread for this little change so it won't trigger an update warning, but internally it is v1.21 now.
 
CounterChecker is the official name now. It was keeper briefly before I made this thread. (I went through a lot of names... this one won... barely.) Glad you like it.
 
Back
Top