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

You mangled the preference, but other than that you are exactly right. (Don't worry, I'm sure that Theraze will know what you meant.) I forgot that was added to mafia's quest tracking.
 
Done, though in many cases we were able to use zone checks rather than looking at each individual location. But the current version should handle all known locations. :) Or at least, my ashq import <canadv.ash> foreach it in $locations[] canadv(it); no longer returns any errors.
 
Theraze, I found a bug in canadv. It believes that I can adventure in all locations of the zone, Le Marais Dègueulasse, such as The Edge of the Swamp.

Fortunately, this is an easy fix. Search for case "Le Marais Dègueulasse": and replace it with case "Le Marais Dègueulasse":
 
I've been developing this somewhat independently, as I've lost editing rights. I've also been working on a script that checks canadv on quite a large number of zones and have thus discovered quite a few fixes.

I went through today and diff'd yours and mine. So here's the ultimate version with all the good stuff from both.

A few important fixes that I'd really like to make it into the published CanAdv:
  1. Some of the initial checks (i.e. drunkenness) are contingent upon prep.
  2. There's some code to provide a handle for relay scripts to AJAX canadv questions to this page.

EDIT: Also, correct me if I'm wrong, but rather than loading an external file with zone stat warning numbers, it looks like we can now use the location proxy record field recommended_stat. Yes?

EDIT EDIT: Removed script as updated one is further down.
 
Last edited:
There's a few typos in cango such as listing the mask as a useful part of the beach, and some other little bits, but I've integrated most of the prep changes and so on into CanAdv. Thanks.
Good catch on the protesters needing to be turned into an int to compare numbers. :)

Any reason why we check for the diary AND the quest property on the manor basement, but we don't check for the mortar dissolving recipe? Either we trust mafia's quest properties to be accurate, in which case we don't need the diary check because that quest property doesn't get set until after you've read the diary and adventured in the ballroom, or we don't trust it, in which case we should look at the item that we unlock by going down into the basement...

I've also left the failure messages on potentially unlocked zones at 6 where they had been rather than shoving them all the way down to 9, so that people who want the extra information on what's happening and why can find out without needing to be completely overwhelmed with every little thing.
 
Here are the differences between the stat numbers in canadv.txt (C) vs. mafia's recommended_stat proxy field (R):

  • Cobb's Knob Harem R: 25, C: 20
  • Engineering R: -1, C: 130
  • Galley R: -1, C: 210
  • Inside the Palindome R: 120, C: 65
  • The Black Forest R: 110, C: 104
  • The Broodling Grounds R: 140, C: 115
  • The Clumsiness Grove R: 40, C: 15
  • The Glacier of Jerks R: 40, C: 15
  • The Haunted Ballroom R: 40, C: 68
  • The Haunted Bathroom R: 40, C: 68
  • The Haunted Bedroom R: 40, C: 85
  • The Haunted Billiards Room R: 20, C: 10
  • The Haunted Conservatory R: 20, C: 6
  • The Haunted Gallery R: 40, C: 68
  • The Haunted Kitchen R: 20, C: 5
  • The Haunted Library R: 20, C: 40
  • The Maelstrom of Lovers R: 40, C: 15
  • The Middle Chamber R: 140, C: 165
  • The Upper Chamber R: 150, C: 160
  • Whitey's Grove R: 37, C: 34
Looks like we can -- and should -- drop the data file and use mafia's data instead. Very nice!

And... I just went through to see what changes you made and note that you already ditched the data file. Splendid.

As for checking quest properties vs. inventory: the properties are becoming more and more reliable. However, they can still be thrown off if people reinstall, ascend outside mafia, etc. I'm pretty sure quest properties are also not updated on login, whereas inventory and level are. So I feel like combining property checks and other, more reliable checks is the way to go. Also, the chances of someone's property being correctly set is higher if we limit the property check using level/inventory/etc. checks. In short, I agree with your recipe check. :)

Three further things:

  1. There's one important fix you didn't take. I wrote that new Airship code expressly because the old code wasn't working. The URL given there will plant the bean, or simply visit if you've already planted it.
  2. I have also realized that the relay hook won't work unless the script is located in the relay directory. Since that won't interfere with normal script operation, would you be averse to relocating this script to the relay folder? As it is not prefixed by "relay_" it won't clutter the relay menu -- in fact it will also stop cluttering the scripts menu.
  3. Having a mass of CanAdv output at verbosity 6 is simply not acceptable for several scripts I use and work on, for precisely the reason you gave -- I don't want to be overwhelmed with every little thing. I've added an optional verbosity parameter for can_adv(), posted below. You can set the default to 6 if you like, but this will give calling scripts the option to override that if they so desire.
I believe if you are amenable to those three things, I will be able to re-merge mine with yours. Woohoo!
 

Attachments

Last edited:
Mafia checks the quest log when logging in. If a quest property isn't being updated, then that should be reported.
It should also set most legacy preferences based on this.

Having said that, I'm sure there are still bugs and issues out there, so feel free to report any you come across.
 
Done. Currently shipped as a relay script. Left the default visibility level at 6 to not disrupt anyone's current expectations, but they can override it however they'd like to now.
And used the new airship code since that gives a 1 guaranteed hit whether or not planting was required, rather than 1 if not required, 2 if needed, failing if in a bee run.
 
Fabulous, thanks!

EDIT: Ummm, I'm not seeing the verbosity-as-variable code in r43.

EDIT EDIT: I also realized one more thing: the form POST hook needs to be able to accept a verbosity parameter as well:

PHP:
string[string] post;  // provide hook for relay scripts to Ajax zone availability
post = form_fields();
if (post contains "where") {
   location w = to_location(post["where"]);
   int postverb = (post contains "verb" && is_integer(post["verb"])) ? post["verb"].to_int() : 9;
   if (w == $location[none] || !can_adv(w, postverb)) write("unavailable");
    else write("available");
   exit;
}
 
Last edited:
Looks like it failed to upload the right version. Awesome. Anyways, right version should be up now, including the relay verbosity hooks.
 
Excellent, thank you. I've now got my factoid relay script doing something unprecedented in the world of ASH scripts: adding CanAdv functionality to your experience, but only if you have CanAdv installed!
 
Ran into an issue with this script:
Code:
Bad location value: "The Road to the White Citadel" (canadv.ash, line 549)
I tried commenting it out and then ran into:
Code:
Unknown location: The Road to White Citadel (zone: Woods)
So I uncommented my comment and changed the value, removing the word "the", and it works again.
Hope this helps somebody.
 
Yep. KoL changed the zone, so we changed our name. Anytime you see a script on SVN throw that error, it probably means that you need to update mafia. Looking forward to that next point release for better error messages...
 
So it looks like with the latest SVN version of Mafia that the Sorceress' Hedge Maze has been removed:

Code:
> call scripts/Harvest.ash

Bad location value: "Sorceress' Hedge Maze" (canadv.ash, line 553)

Removing line 553 from canadv.ash seems to do the trick to get it working again.
 
Back
Top