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

Since he has no plans to make mafia actually save the api-read flag (ignorezonewarnings: 0 from the charsheet read) as a property, I disagree that it's better to break the script for most current users.

Even if we did read it, I'd still disagree with making the script not work for current users who prefer to be warned.
 
Ok. Here's what I've done, which will hopefully quell the Negative Nancies.

  • Store the user's current zone warnings account setting as a daily property _ignoreZoneWarnings. Only populate the value from api.php if the setting hasn't been set for the day.
  • Scrape minimum recommended stats off the Wiki into a data file using this scriptlet:

    PHP:
    int[location] list;
    matcher m = create_matcher("Minimum stat - (\\d+)","");
    foreach l in $locations[] {
       string page = visit_url("http://kol.coldfront.net/thekolwiki/index.php/Special:Search?search=Data:"+l+"&go=Go");
       m.reset(page);
       print(l+": "+length(page));
       if (m.find()) list[l] = to_int(m.group(1));
    }
    map_to_file(list,"canadv.txt");
  • Remove 26 entries where the number was 0 or 1.
  • Upload the data file to the Map Manager.
  • Load this data file in CanAdv.
  • Add an optional boolean parameter softhard to primecheck() (false/hard by default). The parameter simply determines the message displayed if the stat requirement is not met; if soft, it will mention that it's a recommendation from KoL and can be disabled in the account menu.
  • If the user isn't ignoring warnings and the location exists in the data file, call primecheck(<number from data file>, soft) at the top before the inidividual location check.

Now, recommended stat warnings for some 80 locations are now included, and the ones that aren't can be, by anyone. It only makes the check for users who have not disabled the warnings. And it only never hits the server once a day to determine the status of the ignorezonewarnings setting.

Script attached below. (and above-posted script removed)

EDIT: Updated this post and this script to use ASH's new get_ignore_zone_warnings().

EDIT EDIT: Fixed IsleWar outfit names for the wartime camps.
 

Attachments

Last edited:
It should be easy, just parse another value when grabbing api.php and store it in KoLCharacter, then pick an interface for scripts to access it (probably an ASH function). If that's going to be added, I wonder if there are other things from api.php that would be useful.
 
KoLmafia wouldn't use it, but if it is beneficial for scripts, why not.

If the information about minimum recommended mainstat were also added to location data, mafia could use the knowledge of this account setting to save server hits.

Quite a lot of server hits, if these "endless loop" reports are to be believed. :)
 
CanAdv in my above post updated to include the new function.

Given lost's previously stated lack of plans to implement this, I couldn't help but think that this new function is much like my friend's little brother -- an unplanned blessing!
 
Just a heads up - When you have fishy, CanAdv returns false for The Wreck of the Edgar Fitzsimmons, even if it's unlocked. This is because the location image changes to "shipwrecka.gif" when you have fishy, and CanAdv is looking for "shipwreckb.gif".
 
All of the underwater zones were like that with the updated zarqon-ed version. Saved the page to a buffer so we only need a single server hit instead of two for the unique pictures for each zone.
 
Code:
Update log for [B]therazekolmafia-canadv[/B]:
------
Commit [B]r23:
[/B]Author:      maymne

We cannot use floor as a variable name. Go to the seafloor      instead.

Actually. You could do that just fine. It was just that you could not define floor as a variable at every line it showed up. I just removed declarations and added a single "buffer floor" above the sea-parts which worked just fine.
Not that it matters now, but just thought I'd point that out :)
 
It's true, it had the same error on seafloor that floor did. Which is interesting that it wasn't an error, since you can't make an int int but apparently you can make a buffer floor. Ah well.

Changed from the in-line bit which (originally) had a server hit on every location check, to a in-line bit (that didn't work) that had a server hit for the two location checks, to an offloaded function which will permanently unlock the location with a single server hit per ascension. So it's an improvement overall. :)

Edit: Regarding the first bit... Here's a reminder from when it changed about a year ago:
http://kolmafia.us/showthread.php?2...ng-Script-Suite!&p=80088&viewfull=1#post80088

Item and other reserved names became invalid options. It's possible that, unlike in primitive languages, int/floor and other basic math names are not reserved in ASH. Maybe they should be. It's not enough of a desire for consistency to spawn a FReq from me.
 
Last edited:
Hi, I didn't read all 30 pages of the thread to see if other people were having my problem, but when I ran the Make.Meat.fast script, I was getting this error saying that "The Typical Tavern Cellar" is not a valid location. I changed the line in canadv.ash that read "case $location[The Typical Tavern Cellar]..." to "case $location[Tavern Cellar]...", and the issue resolved.

I'm not sure if this was the code's fault or my fault, but I thought it couldn't hurt to post about it here.

Cheers!
 
Hi, I didn't read all 30 pages of the thread to see if other people were having my problem, but when I ran the Make.Meat.fast script, I was getting this error saying that "The Typical Tavern Cellar" is not a valid location. I changed the line in canadv.ash that read "case $location[The Typical Tavern Cellar]..." to "case $location[Tavern Cellar]...", and the issue resolved.

I'm not sure if this was the code's fault or my fault, but I thought it couldn't hurt to post about it here.

Cheers!

Mafia updated, so the script updated. You updated the script (or the first version you happened to get was already updated) but you still need to update mafia.
 
The script told me to report this.
Unknown location: The Old Landfill
Please report this missing location here: http://kolmafia.us/showthread.php?t=2027

The Old Landfill is available after talking to That Hippy at the Smoke Signals in the Distant Woods. Smoke Signals show up when main stat >= 25.

Edit: Also, the following.
Unknown location: WarBear Fortress (First Level)
Please report this missing location here: http://kolmafia.us/showthread.php?t=2027

I assume Second Level and Third Level would also need to be added and since Crimbo is over they all should return false.
 
Last edited:
Does mafia actually track the unlocking of the landfill? If not, then what is the specific information on which image shows up in the woods page? Those are what would be needed to actually track the landfill...
 
No, there is currently no mafia tracking of the landfill quest. We asked for people's tracking requirements and no one suggested any. As for most people it'll be a quest done 1-3 times it hasn't had a lot of attention.
 
Does mafia actually track the unlocking of the landfill? If not, then what is the specific information on which image shows up in the woods page? Those are what would be needed to actually track the landfill...

As far as I knew (and Darzil confirmed) no, there is no tracking yet. Smoke Signals, which is the first thing to show up is "/images/otherimages/woods/smokesignals.gif". After you talk to the hippy, Smoke Signals is replaced by That Hippy which is "/images/otherimages/woods/thathippy.gif" and The Old Landfill is added which is "/images/otherimages/woods/oldlandfill.gif". After you craft the Junk Junk and return to the hippy, That Hippy is removed. That might be more information you wanted but hopefully that helps.
 
Back
Top