CanAdv -- check whether you can adventure at a given location

I thought I was being helpful - I'll keep my bug reports to myself.

Z, you're a great scripter and I appreciate what you do. May I suggest that if you're looking for community participation, post the script to a source control server. There are a few free hosted options that anyone could use. That would solve all three of the reasons I'm not contributing code:
1) Many of the changes I suggested are wide ranging throughout the code and can't be fixed with a few line patch
2) You're not able to update the thread with changes constantly - they'd just conflict with the master, each other, whatever you're working on, and others' changes
3) In the past, you've rejected some of my suggestions to other scripts because they differ with how you like to do things.

#2 & #3 are fine and good and normal, and they're not intended as criticisms, btw. I'm the same way. And I was mildly annoyed when people repored bugs to eatdrink.ash instead of submitting fixes (yes, I made the same request :) ). So I understand completely, and I only mention it here to try and explain, and throw out the inklings of a solution. KOLSVN, anyone?
 
So I guess Zarqon is giving up on this one, but I still think it would be a useful script. I've corrected the logic for a couple locations: Drunken Stupor, St. Sneaky Pete's Day Stupor, Fernswarthy's Ruins, F'c'le, Poop Deck, Belowdecks. And they all work properly now (at least for my account.)

I've also found the following problems which I haven't gotten around to fixing yet:

The following locations are not handled at all: Mine Foremens' Office, Anemone Mine, The Dive Bar, The Mer-Kin Outpost, The Primordial Soup, The Jungles of Ancient Loathing, Seaside Megalopolis, Nemesis Cave

And this one gives an error on my account (Probably because I don't have a clan basement): The Slime Tube - Server www5.kingdomofloathing.com returned a blank page from clan_basement.php. Complain to Jick, not us.

Here's my version with the corrections I mentioned.
 

Attachments

And this one gives an error on my account (Probably because I don't have a clan basement): The Slime Tube - Server www5.kingdomofloathing.com returned a blank page from clan_basement.php. Complain to Jick, not us.

Yeah, I learned about that error once. You can't check the contents of the basement for slime tube or sewer (or look to see if the PLD is open) unless you have basement access. It would be nice to get an error message for trying, but since you cannot...

Code:
if(visit_url("town_clan.php").contains_text("clanbasement.gif")) {
     // And -THEN- you can check to see if hobopolis or slimetube is available.
}
 
I did not give up on this script. I do think, however, that I am giving up on this script being super-collaborative and useful for learning ASH, since the majority of contributions have been problem reports rather than instructional code. These problem reports are helpful, by the way, just not what I had requested; hence my disappointment.

So, in accord with user treatment of this script, I have decided to treat this script the same as the rest (i.e. it's mine more than ours, and I will support it rather than wait for contributions). I guess this is what most seem to expect.

So, a slew of updates, mostly untested but all definitely improvements:

  • Changed all erroneous references to "quests.php" to "questlog.php" (cakyrespa)
  • Use ASH function my_ascensions() rather than get_property("knownAscensions")
  • Streamline using the new error() function in ZLib.
  • Fix erroneous use of my_location() in detecting drunken zones. (the_great_cow_guru)
  • Move HP check above drunk zones detection.
  • Check warProgress property for Frat House / Hippy Camp.
  • New function perm_urlcheck() which checks a URL for text, and if the text is found, stores the location to a property (which also contains the ascension number). Any locations in this property are permanently unlocked for this ascension (the script checks there before doing any other checks), so no further server hits will happen for those zones. Thanks to cakyrespa for the idea.
  • Change all permanently-unlockable locations which need server hits to use this new function.
  • Don't call CLI "guild" function once the guild store is available.
  • Fix bat zones to be a) permanently unlocked using the above function, and b) not use sonars if !prep. Instead, it will return true if you have enough sonars to unlock that particular zone.
  • Fix sideDefeated property values: should be "fratboys" and "hippies", not "frat" and "hippy". Seems a little inconsistent, that, but it's all good now.
  • Ensure the correct image for Dungeons of Doom vs. Greater-Than Sign. (cakyrespa)
  • Fixed detection of Road to White Citadel.
  • Added missing Sea zones, but still don't detect them properly.
  • Check hydration effect for Desert (Ultrahydrated).
  • Check for Fernswarthy's letter rather than key. (the_great_cow_guru)
  • Add vacation zones. (Sputnik1)
  • Check for basement existence before checking Slime Tube URL due to stupid KoL blank page issue which necessitates extra server hits. (Bale)
  • Check for all Steel skills in Friar zone detections. (cakyrespa)
  • Check for dinghy in pirate zones to save server hits.
  • Attempt a better solution for pirate zones. Will switch outfits regardless of prep, but only once -- then the zone is permanently unlocked for that ascension.
  • Don't require items to be equipped in equipcheck() if prep is false.
  • Use absinthe contingent on prep.
  • Add detection of Memories zones.
  • Preliminary support for Mine Foremens' Office and Nemesis Cave. Needs further tweaking -- I'm in a pre-BM run and unable to test the Nemesis stuff.

Still not working:

  • Guild checking is still sketchy at best. Needs to be improved to be more accurate in its use of server hits.
  • Mine Foremens' Office may need tweaking
  • All Sea zones
  • All Hobopolis zones
  • Nemesis Cave definitely needs tweaking
  • Some holiday zones: Yuletide Bonfire, Generic Summer Holiday Swimming!, Arrrboretum

Enjoy. Feel free to report any bugs.
 
Last edited:
Kind of. To avoid repeating code, I made a separate subfunction pirate_check() which does most of what yours did for each zone. But this one uses the perm_urlcheck() function I explained above, so it will only do it once. After that it remembers that the zone is available.

No need to delete your file, unless you want to conserve kolmafia.us server space. :)
 
Thanks for all your work on it, Z. I *would* be up for working on it collaboratively (and think it'd be fun to do so) but we have to come up with a better collaboration tool than this forum. As it is, it's just too hard to track conflicting changes, especially when they're widespread throughout the codebase.
 
hmm, ran into another location, though you probably already know about it...

Can't find demon 2 right now.
Unknown location: Post-War Sonofa Beach
 
hmm, ran into another location, though you probably already know about it...

Can't find demon 2 right now.
Unknown location: Post-War Sonofa Beach

Grab the latest build of Canadv, this was a recent patch. It is a little odd for me that it mafia bounces from Post-War Sonofa Beach to Wartime Sonofabeach, but still got the job done.

-Spiny
 
I'm sad to hear you are no longer doing this collaboratively. I was working on a script and can_adv is not aware of The Hidden City (or, just Hidden City and mafia prefers to call it). I'm more than happy to look into things and throw some code your way if you are still open to that sort of thing.

Well, no one has said anything so here's some code that -should- correctly detect the hidden city.

Code:
   if (contains_text(to_string(where),"Hidden City"))
      return ( levelcheck(11) && itemcheck($item[your father's macguffin diary]) && perm_urlcheck("hiddencity.php","ruins1.gif") );
 
Last edited:
So: Aftercore, and it thinks I can be adventuring in Boss Bat's lair. After a /really/ stupid false start, I fixed that behavior, and here's the patch to do it. It could probably be done more effectively with a reversed perm_urlcheck (that tests for forevermore-closed locations).
 

Attachments

Last edited:
0.6 Updates

  • Thanks to $locations[], I was able to add all currently known zones. I don't know exactly how many zones were added, but it was quite a few (including the Hidden City). So presently CanAdv knows about ALL locations!
  • Began writing detection for Sea zones. Currently it checks that you can go swimming (gear, swimmable familiar). If you acquire a different swimmy effect (i.e. from a pressurized potion or somesuch) it will not bother with the gear, but it won't consider those effects when trying to prepare by itself, even if you can.

    It'll be a little tricky to write the zone-specific part of Sea zone detection, particularly with some zones only being temporarily available, but this is a good start, methinks.
  • Fixed detection of the completed Boss Bat's Lair. The problem was actually in detecting the amount of needed sonars.
 
Callin canadv.ash on "pump up muscle" gives me the following error:
Begin index 0 greater than end index -1 (canadv.ash, line 48)
 
Update.

Didn't fix the issue mentioned directly above (haven't been able to test during Crimbo madness), but did add the Crimbo zones (as unadventurable), and allowed for a "more silent" mode using the recent change to ZLib. In converting CanAdv to use vprint(), I set most of the print commands to use a verbosity of 4, which means if your verbosity (new ZLib setting) is 3 or less, all of CanAdv's messages won't show up.
 
Considering Pump Up Muscle:
Begin index 0 greater than end index -1 (canadv.ash, line 48)

i get this sometimes and it totally stops the script im running and i lloked at it and have no idea what to even TRY and change to get it to work
 
Back
Top