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

Bale

Minion
I suppose that could be considered an UR bug, though I think anyone who uses adventures to rest to be in a place I have trouble seeing. Anyway, if I was to modify UR to check for that do you know a way to trigger mafia's counter behavior? A counter script takes two parameters so I couldn't trigger it with a cli_excute'd call command.
 

zarqon

Well-known member
Is UR visiting sofa/campground using visit_url()? I'm pretty sure if you used a CLI command or called adventure(), mafia would intercept it and run the counterScript, whereas simply calling visit_url() would probably circumvent the counterScript. Just guessing, could be wrong.
 

Bale

Minion
That's a nice theory. However, tgetgel said he was not using UR. If mafia won't check for counters while resting from its default recovery I doubt it would work if UR called the sofa CLI command.

Perhaps this should be reported as a mafia bug.
 

zarqon

Well-known member
So UR handles this situation fine then? I made the post after searching UR for the string "counter" and getting no matches. It could be a non-issue depending on how UR calls those recovery methods; I just wanted to bring it to your attention in case UR might also have this problem. I like scripts that consider all possibilities.
 

Bale

Minion
I doubt that UR will handle the situation any better than mafia's default recovery. I was pointing out that since mafia's default recovery caused him to skip a counter I doubt that the sofa command will be any different.

I'm not sure how to make UR handle this better than that.
 

zarqon

Well-known member
Depends how mafia handles it. If calling "sofa" or "rest" ignores counters (which would be a bug, but this is not necessarily the same as mafia's auto-restore), UR should consider those options unavailable for restoring if there are expiring counters within the number of times you'd be sleeping/resting.
 

Bale

Minion
Anyway, as a result of this I switched UR's usage of sofa from visit_url() to the cli command sofa. I just doubt it will make a difference. Maybe that will be better than mafia's auto-restore.

Actually, his problem is worse than that since the counter expired and the counterScript was called. Then it spent adventures to rest on the sofa before getting the semi-rare. This means there is no longer a counter at turn 0 to check for. That really sucks.
 
Last edited:

slyz

Developer
Well, counterchecker at least knows he shouldn't be spending turns anywhere, so maybe it could uncheck the sofa and the campground as restoration options before trying to adventure ? Or at least check if they are in the hpAutoRecoveryItems preference, and abort if if needed ?
 

Bale

Minion
Ugh. To "uncheck" those options it would have to search hpAutoRecoveryItems, remove them from the string of options, then append them back after getting the semi-rare. (Actually I'm not sure if their order in the string is significant.) That's assuming that he has eaten more than 1 cookie so it won't be a false alarm and he actually needs the healing to survive there.

So far I feel that people who are willing to spend adventures resting should just understand that the sudden loss of adventures can screw up anything time sensitive. Don't do it if you want to automate semi-rares, absinthe, dance cards, etc...
 

zarqon

Well-known member
Bale, just wanted to say -- I made the switch a while back to using this script. I use something else for wormwooding, so I commented out the wormwood stuff, but the other comprehensive counter coverage is excellent and useful. Thanks!
 

Bale

Minion
Sometime I'd like to see what you prefer to use for wormwooding. If yours is better than mine I might be able to include it.
 

zarqon

Well-known member
I prefer it because it's keyed to my playstyle, so I don't know that it would be inclusible for broader uses. But the nice thing about it is that if the goal (!pipes) gets compromised (say, by a holiday monster), it will adapt and get stats. I could send it to you if you'd like a look -- it looks like the algorithm is basically the same. I also did a switch on the number of Absinthe-Minded remaining!

EDIT: Here are the contents of my getpipes.ash. Doesn't look like there's much that you could use, since this is hardcoded specifically for pipes and moxie and is built for turn-burning. You may be able to do something to make your script adapt to interrupts for all goals that require effects though.

getpipes.ash

PHP:
// getpipes -- specifically gets not-a-pipes, more robustly than previously
// gets moxie in the event that something interferes with your pipe-getting
// by default, gets enough to fill your spleen; otherwise, gets specified num

import <zlib.ash>

boolean single_pipe(location where) {
   boolean intact = true;
   if (my_adventures() < 10) return vprint("You need a minimum of 10 adventures.",-2);
   cli_execute("conditions clear");
   switch(have_effect($effect[absinthe-minded])) {
      case 0: if (have_effect($effect[Absinthe-Minded]) == 0) {
                 if (item_amount($item[tiny bottle of absinthe]) == 0) buy(1,$item[tiny bottle of absinthe]);
                 use(1,$item[tiny bottle of absinthe]);
              }
              if (have_effect($effect[Absinthe-Minded]) == 0) return vprint("Unable to use absinthe.",-2);
      case 10: adventure(1,where);
      case 9:
      case 8:
      case 7: while (have_effect($effect[Absinthe-Minded]) > 6 && have_effect($effect[Spirit of Alph]) == 0)
         adventure(1,$location[Stately Pleasure Dome]);
         if (have_effect($effect[Spirit of Alph]) == 0)
            intact = vprint("Something prevented your being imbued with the essence of Alph.  Getting moxie instead...",-3);
      case 6: adventure(have_effect($effect[Absinthe-Minded])-5,where);
      case 5:
      case 4:
      case 3: set_property("choiceAdventure168",to_string(1+to_int(intact)));
        if (intact) {
           while (have_effect($effect[Absinthe-Minded]) > 2 && have_effect($effect[Feelin Philosophical]) == 0)
              adventure(1,$location[Mouldering Mansion]);
           if (have_effect($effect[Feelin Philosophical]) == 0)
              intact = vprint("Something hindered your approaching of the Cat.  Getting moxie instead...",-3);
         } else {
           cli_execute("conditions clear; conditions add 1 choiceadv");
           if (adventure(have_effect($effect[Absinthe-Minded])-1,$location[Mouldering Mansion]))
              vprint("Something hindered your getting the proper choice.  Phooey.  At least you can get a bit of moxie.",-3);
         }
      case 2: adventure(have_effect($effect[Absinthe-Minded])-1,where);
      case 1: if (intact) adventure(1,$location[Rogue Windmill]);
         else {
            set_property("choiceAdventure166","2");
            adventure(1,$location[Stately Pleasure Dome]);
         }
   }
   if (intact && item_amount($item[not-a-pipe]) > 0 && my_spleen_use() < spleen_limit() - 3) use(1,$item[not-a-pipe]);
   return intact;
}

void main(int howmany,location where) {
   if (howmany < 1) {
      while (floor((spleen_limit()-my_spleen_use()) / 4) > 0) single_pipe(where);
   } else for i from 1 to howmany
      single_pipe(where);
}
 
Last edited:

Bale

Minion
True that there isn't anything I can use directly, but there is still some interesting code there. It's surprisingly flexible despite being single-minded. It's interesting to think about adapting that concept.
 

smeaty todd

New member
I'm a pretty casual mafia user, so I wasn't really able to figure this out from the code itself/don't want to test it empirically -

I know it's set up to allow the user to determine if they want to get the most expensive SR while in HC,
but if they don't, what happens? Does it halt auto-adventuring? or simply keep on auto-adventuring? [If the latter, how do I change it to abort instead?]

Also, having just done a cloverless run, is there any way to halt production of food/booze if the number of turns required would cause one to miss their SR? Or keep you from using the shore...

Anyway, I know it's hardly your domain, but some hard-coded counter on the left-hand panel of the Mafia window for SRs would be nice. For SRS.
 

adeyke

Member
It will abort when the counter hits 0 and it'll give you the location of the previous semi-rare as CLI output.
 

Bale

Minion
I know it's set up to allow the user to determine if they want to get the most expensive SR while in HC,
but if they don't, what happens? Does it halt auto-adventuring? or simply keep on auto-adventuring? [If the latter, how do I change it to abort instead?]

Also, having just done a cloverless run, is there any way to halt production of food/booze if the number of turns required would cause one to miss their SR? Or keep you from using the shore...
If you set it to not get semi-rares in HC, then it will stop adventuring when your semi-rare comes up and display the location of your last semi-rare in the CLI. Some people like this script just for that function since it saves them the trouble of typing "counters" when they need to decide what semi-rare to get.

If turns spent cooking/mixing/smithing will take you past a counter, mafia will trigger the counter and warn you instead of doing it. Then if you tell mafia to do it again, it will ignore the counter.
 

Atreyuu

New member
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

But when I go to my

I must be doing something wrong, I do steps 1-3 and get:

> 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

So then I go to my Data folder and find vars_Atreyuu.txt and open it up. There is no entry for "BaleCC_ImprovePoolSkills".

I'm using CounterChecker v1.27
I'm sure it's an error on my end but I don't really know what to look for.
 

Bale

Minion
I have no idea. Fortunately there is more than one way to skin a catfish. Just type in the CLI:

Code:
zlib BaleCC_ImprovePoolSkills = true

And that should set the variable.
 

Atreyuu

New member
> zlib BaleCC_ImprovePoolSkills = true

No setting named 'BaleCC_ImprovePoolSkills' exists.

Maybe I should delete my vars_Atreyuu file? Doesn't appear to be much in there that I can't easily fix in 10 minutes or so.

Edit: Ok, so rather than wait for a response I deleted my vars file. It rebuilt like I figured it would. It now accepts

Code:
zlib BaleCC_ImprovePoolSkills = true

in the CLI but still no entry in the vars file. My turns for the day are used up so I can't test it but it as the CLI didn't send me an error I'm assuming it's working? I don't know.
 
Last edited:

zarqon

Well-known member
I've also noticed that the CounterChecker settings are not in my vars file. This may be a mafia bug -- previously, map keys that pointed to empty strings were not being loaded properly by file_to_map(). Since the vars are not actually in the map, you may want to see what happens if you change the default value (in the script, where it calls setvar()) to true. This may allow you to get the setting properly in the map. Also, it may reveal whether or not this is a mafia bug.
 
Top