Bug - Waiting for Info Can't automate goals after Hidden City cleared

Theraze

Active member
I found myself needing a pygmy pygment in the Hidden City for ascension, and when I tried to automate going to the city with a pygment as my goal, it gave me an error telling me that that square had already been completed. Sorry, can't post the specific error right now, all out of turns and it happened during last night's bleary automations.

Would it be possible to have it, when done, instead use a known ruin instead of only checking unknown zones? This would allow for setting goals here, and skipping the joys of running one-hit adventures manually using the relay browser.
 

Veracity

Developer
Staff member
Or, you know, you could tell KoLmafia which square to go into by manually going there in the relay browser, at which point it should happily automate in that square for you. There is no code to "only check unknown squares".
 

Theraze

Active member
Ah, so after I tell it which square to go, it will continue to check that square? From Zarqon's macguffin script, it looked like there was a property, hiddenCityLayout, that knows which squares are known and which aren't... I thought, based on looking at his script, that Kolmafia could decide on the an available square, but I suppose it makes sense that it just keeps doing the last one, and that, in that case, it failed due to my last one being the ancient protector/temple...

Any chance of, after I get the specific error message, having the message clarified somewhat, so that it suggests manually adventuring in another square instead of telling me that I can't do the city? I'm going to know what it means now, but I'm PROBABLY not the only one to have ever been bemused by that. Though it's possible. :)
 

Veracity

Developer
Staff member
This reminds me of automated adventuring in the Tavern Cellar, which I recently changed to first finish up unexplored squares and then go to the rat faucet ad infinitum. I don't see why the user needs to specify a square to explore in the Hidden City. We should choose an unexplored square first, but then go to a normal non-altar non-pretecotr spirit square, once we have seen the whole map.

If you finish the Hidden City inside of KoLmafia, we will know where all the Protector Spirits are. If we have to deduce the layout from the map, cleared Protector Spirit squares (and the archaeologist square) will look like regular explored squares. But, if we visit such a cleared square, we should be able to update the layout to indicate that a Protector Spirit (or archaeologist) had been there - and thus avoid it for automated adventuring.

The Hidden City code is old(ish). It could stand to be revisited and made to conform to current practice. :)
 

Veracity

Developer
Staff member
Revision 10286 will allow auto-adventuring in the Hidden City. It will look at the layout and select the first square tagged as "0" - unexplored. If there are no unexplored squares, it will adventure in the first square tagged as "E" - a normal Encounter.

Since there are 4 altars, 1 temple, 1 archaeologist, 4 Protector Spirits, and 15 normal encounters, if you start with a completely unexplored Hidden City and tell it to consume 20 adventures, it should start with square #1 and proceed in order up to square #25, visiting and passing the altars and temples, (which don't take a turn). You had better have your CCS set up to handle the spirits - and you had better have selected auto-identification of stone spheres.

Thereafter, you should be able to autoadventure with goals, to get the tower item. For that matter, you should be able to autoadventure to get the semirare.

Tell me how it works for you.
 

Theraze

Active member
Adventure 5 hidden city went through 5 new rooms, so... that does look successful. Thanks Veracity! That should let the hc_adventure function in zarqon's HiddenCity.ash simplify a bit. :)

Edit: One possible issue... it appears to be redirecting from known protector fights when automating. I managed to lose my fight fight, then tried to run the script to continue, but mafia is automatically moving it from the protector spirit back to a "regular" square. Is that intended behaviour? If so, then it's only possible to script one attempt at a protector spirit without using visit_url.
 
Last edited:

Veracity

Developer
Staff member
Interesting. Is it "intended"? Insofar as that is how it is intentionally coded, yes - but it's apparently not what you want. :)

- Look for an unexplored square - a "0" in the layout.
- If none, look for a normal "encounter - a "E" in the layout.

Undefeated protector spirits are "P". So, perhaps we should insert another check between the above two

- Look for an undefeated protector spirit - a "P" in the layout.

Another issue I just realized: if you decide to go for a semirare, you have to visit an "E" square, I believe. But, if you have not yet explored the entire Hidden City, you will have "0" squares, and automated adventuring will preferentially go there. That has issues:

- If it encounters a new altar or temple, it will not consume a turn, but will your counterScript recognize that and try again?
- If it encounters a new protector spirit or the archaeologist, it WILL consume a turn.

So, in case of semirares, we want adventuring in the Hidden City to NOT explore a new square. We want it to go to an "E" square.

It has to be done that way unless mafia also starts tracking whether you've killed the spirit.
We do that. An undefeated protector spirit is a "P". A defeated spirit is a "D".
 

Veracity

Developer
Staff member
I think the solution for both of those issues is to do something like the Haunted Wine Cellar, which has an "automatic" adventuring location, in which it cycles through the corners, and also an adventure location for each corner.

Define two "adventure locations"

Hidden City

This is used to automate exploration: pick an "0", a "P", or an "E" square to adventure in.

Hidden City (encounter)

This is used to ignore undefeated protected spirits and unexplored squares if you simply want to farm in an encounter square or get a semi rare: pick an "E" square to adventure in.

We move the default conditions - "1 pygmy blowgun|+1 shrinking powder" - to the "encounter" location. (We could leave "1 pygmy blowgun" on the default location; it will just finish exploring the Hidden City before zeroing in on an encounter square to adventure in.)
 

Theraze

Active member
That would be wonderful. :) I just happened to fail my spirit and end up realizing that this might cause problems for others who don't just immediately pop into the relay browser and manually defeat the spirits, but keep trying to use the script with different maximizations...
 

Veracity

Developer
Staff member
Revision 10288 does what I proposed:

Hidden City (automatic) - adventure in first unexplored, undefeated protector spirit, encounter square, in that order
Hidden City (Encounter) - adventure in first encounter square

Scripts that go after semirares - like counterScripts - should use $location[ Hidden City (Encounter) ] if they want to fetch shrinking powder.
 

Theraze

Active member
Hopefully I still have a character who hasn't finished off the city this ascension. I'll find out in another hour or two. Thanks for all your awesome work, Veracity! This should keep existing scripts working as well as they were (or better), and allow counter scripts and tower-farming to be done much more easily.
 

Theraze

Active member
Possibly a different bug, but mafia believes that the entire map is viewed now:
hiddenCityLayout (user, now 'EDEEENEEDEEEELTDEDDEFEEEA', default 0000000000000000000000000)
However, squares 16 and 18 aren't finished. I believe that when I told it to continue an adventure after I hit escape to cancel out in the middle of the combat, it marked the next square as viewed automatically instead of realizing that it was in the same square as last time.

Does this change possibly mean that the HiddenCityManager needs to only update hiddenCityLayout if the combat round is 0 or 1? Or is there a more elegant way to validate that we aren't in a new square, we're just continuing onwards in our same square.
 

Veracity

Developer
Staff member
Does this change possibly mean that the HiddenCityManager needs to only update hiddenCityLayout if the combat round is 0 or 1? Or is there a more elegant way to validate that we aren't in a new square, we're just continuing onwards in our same square.
Ooh. Now I get it. You tried to adventure in a new square and were redirected to a fight - which is normally an indication that the new square is an "E" or a "P" - but it was actually just an unfinished fight. Considering that you could have gotten initiative and aborted out immediately, even if we used KoL's idea of which round it is, I'm not sure how we can tell a new fight from a continuation of an old fight.
 

Theraze

Active member
Exactly. Sorry for my poor explaining earlier. Yes, on the continuation of a fight, it decided to mark the next square as visited, even though it was actually still the same encounter. One thought I had was having mafia parse hiddencity.php every time we see the full layout, since it does show us the square type including whether or not it's a special type, but...

Oh, which was apparently 10299. Awesome. :)
 
Top