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

codster62

Member
>.< I am confused as how to set this up. I downloaded the script and put it in my scripts directory, started kolmafia and logged in with my character, then set my counter script to your script using the cli. I then went to the vars_coolbufferbot.txt and there were none of your scripts options there... What am I doing wrong.. If you don't mind, can you give me step-by-step instructions on how to set this up? Sorry, I am an idiot, lol.
 

Bale

Minion
Until the first time it runs, variables won't be put into your vars file. If you want to add those variables so that you can edit them easily (before your counter comes up), you can run the program from the menu. It will ask you for a string and an int. The answers aren't very important as long as you input nonsense that it doesn't know how to deal with.

Step-by-step:
  1. In the program menu: Scripts -> CounterChecker.ash
  2. Please input a value for string name: HI
  3. Please input a value for int remain: 33
  4. Edit vars_coolbufferbot.txt
 

codster62

Member
Weird... I tried this again, and it still won't place them there. I did exactly as you said...

> call scripts/CounterChecker.ash

Checking counters now.
In 33 turns it will be time to do something when your HI counter is up.
You'll need to kill some time until then since the current action requires more than 1 turn.

Then I went to edit my vars and nothing... Can I manually add the things to my vars?

EDIT: Also, I noticed in my data folder for some reason there are two different sets to my character vars. One with all lowercase, coolbufferbot_vars.txt, and one with capitalization, Coolbufferbot_vars.txt. I checked both of them and neither have the variables from the script...

EDIT2: After looking at the scripts contents, I see that is has three lines with those boolean variables, and tells them to be editable in the vars for my character. Instead of

boolean srInHC = vars["BaleCC_SrInHC"].to_boolean();

boolean useDanceCards = vars["BaleCC_useDanceCards"].to_boolean();

boolean ImprovePoolSkills = vars["BaleCC_ImprovePoolSkills"].to_boolean();


Instead of what is above in the script, can I edit it to make it say what is below? I really have no clue, sorry...

boolean srInHC = True
boolean useDanceCards = False
boolean ImprovePoolSkills = False
 
Last edited:

Grotfang

Developer
EDIT2: After looking at the scripts contents, I see that is has three lines with those boolean variables, and tells them to be editable in the vars for my character.

You could hard code the values, if you so wished - however, I would not recommend that. Alternatives:

Find where it says:

Code:
setvar("BaleCC_SrInHC", FALSE);
setvar("BaleCC_useDanceCards", TRUE);
setvar("BaleCC_ImprovePoolSkills", FALSE);

These are the default values. Since they haven't come up yet, they won't exist in your data vars file. To change them, simply edit them according to needs.

Alternatively, add the lines yourself to your data file. The script will (I believe) only use the default settings if alternatives are NOT present in your variables file. If you pre-empt the script, that will also set them appropriately.
 

Bale

Minion
Yes, you can edit the values into vars_coolbufferbot.txt manually. Just remember to put a tab between the variables and their values.

The only reason I can imagine for them not being added to vars when you ran the script is because your text editor was still open with the vars file when you ran it.

Editing the script the way you suggest would do what you want, but it would force all your characters to use the same settings. (Don't forget the semi-colons at the end of each line.)
 
Last edited:

slyz

Developer
I got a Pixie recently and started using this script for the wormwood part after testing it out manually a few times.

Just... wow =)

Thanks a lot!
 

Dingamagoo

New member
Been using this script and your recovery script: revolutionized the way I play.

A doubt lingers though: does the cost calculation take into account SRs that give you more than 1 item?

I'm not sure, but I have the feeling it sometimes went for SRs which items were below the price of 3 times "massage oils".

Might be that I checked the mall when the prices had already changed.

If you clear it up, I may even get my head into trying to change the script and become a writer myself.
 

Bale

Minion
I admit that I'm only checking the price for the "usual suspects."

If you clear it up, I may even get my head into trying to change the script and become a writer myself.

Well, then, the part where I point out the semi-rares I check for price is here:

Code:
	item [location] semi_rare;
	semi_rare[$location[The Purple Light District]] = $item[lewd playing card];
	semi_rare[$location[Haunted Billiards Room]] = $item[cube of billiard chalk];
	semi_rare[$location[Menagerie 2]] = $item[irradiated pet snacks];
	semi_rare[$location[Outskirts of The Knob]] = $item[Knob Goblin lunchbox];
	semi_rare[$location[Limerick Dungeon]] = $item[cyclops eyedrops];
I then remove from consideration any item that was the most recent semi-rare:

Code:
	remove semi_rare[last.to_location()];

Here's the code to find the best buy, you'd need a special exception to multiply the price of massage oil, tarts or distilled wine by three. Bonus points for comparing the price of a lunchbox vs the price of the contents of that lunch box.
Code:
	int [item] prices;
	int expensive = 0;
	location best = $location[none];
	foreach locale, rare in semi_rare {
		if(historical_age(rare) > 1 || historical_price(rare) == 0)
			mall_price(rare);
		if(historical_price(rare) > expensive) {
			best = locale;
			expensive = historical_price(rare);
		}
	}

It wouldn't take much work to add in every semi-rare. It just never seemed interesting since I only ever noticed those 5 vying for position as most expensive.
 

Dingamagoo

New member
Ah, thx.

Let's see if I'm reading the code correctly.

I'll use the massage oils as the example.

I have to add something like this to the list of items:

semi_rare[$location[Knob Goblin Harem]] = $item[scented massage oil];

And change this:

if(historical_price(rare) > expensive) {

To something like this (ignore the syntax, 'cause I think '*' actually means "all", not "multiply" and I'm using '&&' because of the '||' analogy from C, and the extra parentheses may be useless if this scripting language is like java in evaluating Boolean expressions... *inhale*):

if(historical_price(rare) > expensive || (rare == $item[scented massage oil] && historical_price(rare) * 3 > expensive)) {

Is anything fundamentally wrong in my approach to the problem?

I suspect that PriceAdvisor already takes care of the Lunchbox vs Contents calculation issue or at least has the necessary code to do it that I can strip from there.
 
PriceAdvisor is a rather big stick to swing at just one item.

I can tell you from experience that the expected value of the contents (1.5 * pasty price + 1.5 * thermos price) is nearly always greater than the price of the lunchbox. Of course, it's usually safer to have the code do the calculation and decide from there, so to value the lunchbox you probably want something like this:
Code:
max(historical_price($item[lunchbox]), 
    1.5 * (historical_price($item[knob pasty]) + historical_price($item[knob coffee])))
 

Bale

Minion
Script Updated!

Update KolMafia here. r8068 or later is now required.

r8048 added a new feature giving pop-ups when you eat without milk. That means after getting a semi-rare you'll be interrupted by a pop-up asking for permission to eat a fortune cookie without milk of magnesium. Since it is troublesome to have your automation interrupted, a new command was added in r8068 to eat without that pop-up.

The script now uses the new eatsilent command to eat fortune cookies without interrupting your automation.
 

tgetgel

Member
When adventures are used to recover HP, counterchecker.ash and resting on the clan sofa do not play well together.

Code:
Executing request...
Checking for updates (running CounterChecker ver. 1.27)...
_version_BaleCC => 1.27
You have a current version of CounterChecker.
Checking counters now.
Searching for "cube of billiard chalk"...
Searching for "cyclops eyedrops"...
Searching for "irradiated pet snacks"...
Executing request...

[28847] Rest in Clan Sofa (3 turns)
You gain 434 hit points
Resting completed.

[28850] Menagerie 2
Encounter: Carnivorous Moxie Weed
Strategy: C:\Program Files\KoLMafia\ccs\default.ccs [default]
Round 0: (insert name here) wins initiative!
Round 1: (insert name here) tries to steal an item! (auto-attack)
You lose 1,716 hit points
You acquire an item: moxie weed

Oops, that wasn't the right number!

[28851] Rest in Clan Sofa (3 turns)
You gain 434 hit points
Resting completed.

> counters

Last semirare found 176 turns ago (on turn 28677) in Outskirts of The Knob

No active counters.

The healing from resting on the clan sofa would not be needed if the number were right (meaning that you don't take damage when finding a semi-rare). The number is wrong because of the resting on the sofa in the middle of the counter checker. Is there a way to mask the interrupt from Mafia for recovering via the clan sofa in the middle of the counter checking script?

I know that I might miss the counter if the rest command happens a turn or two before the counter expires and it rests 3 times. Is there a way to get Mafia to rest only one adv at a time instead of 3 at a time?

I know that using Bale's Universal Recovery Script would take care of this, but I am running this for someone that does not want to spend money on healing. Maybe that just means that they do not get the benefits of getting the semi-rares either.
 

slyz

Developer
I think that's a problem with Mafia and counters in general more than with this script. Mafia knows when something is going to take more than one turn, and if that risks using up a counter. But since this is happening after the counter has launched the script, Mafia doesn't consider it anymore. There's no way for CounterChecker to override this.

My opinion would be not to use precious adventures to heal though =) (check out another script from Bale, Unversal Recovey).
 

Bale

Minion
How interesting...

I suppose I could disable your healing options temporarily, check for the semi-rare and then re-enable your auto healing, but I don't think that is really a good idea.

My advice is to never automatically use adventures for healing. I cannot think of an instance in aftercore when that could possibly be better to lose 3 adventures rather than purchase restoratives from the mall. That's just insane. If you're in hardcore or ronin, you never want adventures to disappear without notice so it should be done manually if you need it.

IN other news, WTF? You lose 1,716 hit points from a carniverous moxie weed? Was that slime damage?
 
Last edited:

tgetgel

Member
How interesting...
IN other news, WTF? You lose 1,716 hit points from a carniverous moxie weed? Was that slime damage?

Yes, it was slime damage. I had done 4 adv in the slimetube prior to the counter checker and the automatic mafia recovery running. Here is the log beginning with the 4th adv:
Code:
> Expected Damage: 260

[28846] The Slime Tube
Encounter: squirming Slime polyp
Round 0: [name here] wins initiative!
Round 1: [name here] tries to steal an item! (auto-attack)
You lose 260 hit points
You acquire an item: slimy fermented bile bladder
You lose 18 hit points
 > Checking for updates (running CounterChecker ver. 1.27)...
 > You have a current version of CounterChecker.
 > Checking counters now.

clan_hobopolis.php?place=8&pwd

[28847] Rest in Clan Sofa (3 turns)
You gain 434 hit points

[28850] Menagerie 2
Encounter: Carnivorous Moxie Weed
Round 0: [name here] wins initiative!
Round 1: [name here] tries to steal an item! (auto-attack)
You lose 1,716 hit points
You acquire an item: moxie weed
 > Oops, that wasn't the right number!

What is also bizarre about this character is that it completed the leaflet quest without learning CLEESH! I have not figured out how to go back and learn it. So this one can only go so far before ascension is needed to progress in the slimetube.
 

zarqon

Well-known member
tgetgel brings up a good point -- UR should consider whether any counters are expiring before using recovery options that consume adventures. Mafia may handle that and fire this script appropriately, but as the above example shows, it may not.
 
Top