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

Yeah, but before that is doesn't in fact use canadv at all since it is already confident it can go whereever it needs to go :)

I have no definite idea of what you're saying here... if you're saying that 'standard' farm.ash doesn't use can_adv, then why did you say in post 196 that it uses can_adv(location, false)? If it uses can_adv(location, false) to decide if it can farm an area, then where's the problem with adding a single can_adv(best_location, true) right before it starts adventuring?
 
If I am reading it right there are about four places circa line 1115 where Theraze's suggested line should be added to get the desired effect of preping the area. It's not clear, however, what farm would do if the prep failed.

I'm not really interested in supporting farm, nor do I suggest that someone release the code into the wild. Perhaps Harvest might suffice as an alternative?
 
Yeah... sight unseen, I'd probably suggest that the adventuring itself should happen inside an
Code:
if (can_adv(best_location, true)) adventure(my_adventures(), best_location);
type block.

That being said, fronobulax is right... farm is officially dead. Use Harvest if you need something that actually gets updated. :)
 
I found a few locations that may or may not need to be added here:
PHP:
Unknown location: Fightin' Fire
Please report this missing location here: http://kolmafia.us/showthread.php?t=2027
Unknown location: Super-Intense Mega-Grassfire
Please report this missing location here: http://kolmafia.us/showthread.php?t=2027
Unknown location: Fierce Flying Flames
Please report this missing location here: http://kolmafia.us/showthread.php?t=2027
Unknown location: Lord Flameface's Castle Entryway
Please report this missing location here: http://kolmafia.us/showthread.php?t=2027
Unknown location: Lord Flameface's Castle Belfry
Please report this missing location here: http://kolmafia.us/showthread.php?t=2027
 
I found a few locations that may or may not need to be added here.

I'm not sure how much longer the event will be available for, but these should eventually go in the // never open section of CanAdv.

Edit: Aaaaand it's gone.
 
Last edited:
Yeah... I'm stuck in Montana for 2 weeks with very limited internet, so expect 0.82 to be spun when I get home.

Also, you missed the Flameface Throne Room. Just sayin. :)
 
I am using CanAdv for another script and found some problems with the Pirate Cove detection.

When calling can_adv( $location[Poop Deck], true ), I get a true return value but it has failed to equip either the outfit or fledges because it is only checking the "unlockedLocations" property. I assume this problem will happen with F'c'le and Belowdecks also.

A fix would probably be to check unlockedLocations only if prep==false.
 
Sure... we'll make it do contains && !prep. Does mean some extra server hits if you're prepping, but less than people repeatedly wasting turns hitting unavailable zones causes... That should get released next week when I get home to stable internet again, along with the locked former Flameface zones. Anything else that we know needs to be added before 0.82?
 
hello

trying to use kingdomexplorer.ash and I'm getting this error

Bad location value: "Knob Goblin Kitchens" (canadv.ash, line 149)

any input?
 
Download the latest version of canadv and try again? You're using a version from before Feb 16, 2011. Not sure how much before version 0.73, but... it's some version.
 
Post says any help appreciated, so I did just that.
This adds in the new zones from the flameface material, and I also wrapped up Holiday checking while I was in there.

May get around to making Hobo Zone detection more robust.
Just a question, is there anything you'd prefer the script to "avoid"? Like, should I attempt to use functions and user data to detect availability or is it okay for me to use visit_url() and read info from a page? This would make Hobopolis so much easier.
 

Attachments

Basically, avoid server hits whenever possible. As I said, version 0.82 (which I'm using this week and will release next week) already has the Flameface zones in it...

Didn't have holidays, so I'll update that. Also will try to make it detect the fixed days if possible... since Halloween is also on October 31st. Stable release when I get good internet.

More robust, good. More server hits, not good. Unless our current check causes people to have more server hits with failed adventuring attempts, in which case you're actually reducing server hits, which is fine. Bottom line though... we're trying to help save servers, not pummel them. People running checks for where to adventure shouldn't hit the server 15 times to validate that they really aren't able to hit the hobo zones...
 
Hobopolis should be (at most) 2 hits, right? Town square tells you which zones have been opened in this instance (or if you can't go there yet, or if Hodge is down already), logs tell you which bosses are dead (and therefore which zones you can't go into anymore).
 
I guess you could do it with one hit if you set up some elaborate log parsing, but that's probably not worth it...
 
The problem is that it is a hit for each zone. Sadly they can be opened or closed between calls to canadv (wihtout any input from the character calling CanAdv) so caching isn't as helpful as for other zones and there isn't any way to prevent hitting the server for each check.
 
We're currently using this for hobo and sewer availability. Each of the hobo zones uses the above check, the sewer uses the lower one.
Code:
   case $location[The Purple Light District]: if (!contains_text(visit_url("town_clan.php"), "clanbasement.gif") ||
                                                   contains_text(visit_url("clan_basement.php?fromabove=1"), "not allowed")) return false;
                                              return true;
   case $location[The Slime Tube]: return (visit_url("clan_slimetube.php").contains_text("thebucket.gif"));
Basically, you can see that it doesn't actually check if any of the specific hobo zones are currently available, and it takes two hits to validate that the hobos are good. It might eliminate them in a single hit, it might take two...
The slime is just a single hit... that should be fine.
 
Exactly, I was thinking of doing what xkiv said, using the hobo town square to determine which zones are open (or a big false if you can't get to them in any case) and then checking the logs to see which bosses are down (possibly starting with the logs, since a down Hodge is a flat false for all the zones)

Sewers, however, work fine as they currently are. Not sure what that returns if Hobopolis is currently flooded, though.


EDIT:
Also, just made this slight change for Bat Hole changes:
Code:
   case $location[Boss Bat Lair]: if (!levelcheck(4)) return false; string bathole = visit_url("bathole.php");
                                  matcher sonarsMatcher = create_matcher("bathole_(\\d)\\.gif",bathole);
                                  if (!sonarsMatcher.find()) return false;
                                  int sonarsneeded = 4-sonarsMatcher.group(1).to_int();
                                  if (sonarsneeded > 0) {
                                     if (prep) use_upto(sonarsneeded,$item[sonar-in-a-biscuit],true);
                                     else return (item_amount($item[sonar-in-a-biscuit]) >= sonarsneeded);
                                  }
                                  return (perm_urlcheck("bathole.php",where)));
 
Last edited:
I use a few functions to do things pretty similar to what you pointed out earlier in this thread.

PHP:
// arg = "stepNx" will return N * 10 + <letters a-i transmogrified into digits 1-9>
int numerify(string arg)
{
    int max_steps = 12;
    matcher m_step = create_matcher("^step(\\d+)([a-i]?)$", arg);
    switch {
    case arg == "unstarted": return -1;
    case arg == "started": return 0;
    case arg == "finished": return max_steps * 10 + 10;
    case arg == "step0": break;
    case find(m_step): //for i from 0 to 2 print("group " + i + " = \"" + group(m_step, i) + "\"");
        string d = group(m_step, 1);
        string s = group(m_step, 2);
        // if d <= max_steps && there's no extra "0"s return maths
        if (length(d) <= (d.to_int() > max_steps ? 0 : (d.to_int() > 9 ? 2 : 1))) return d.to_int() * 10 + (s == "" ? 0 : index_of("_abcdefghi", s));
    }
    nb_abort("\"" + arg + "\" doesn't make any sense at all.");
    return -11;
}

boolean is_at_least(string a_string, string b_string)
{
    if (numerify(a_string) >= numerify(b_string)) return true;
    else return false;
}

boolean is_past(string a_string, string b_string)
{
    if (numerify(a_string) > numerify(b_string)) return true;
    else return false;
}

boolean is_not_yet(string a_string, string b_string)
{
    if (numerify(a_string) < numerify(b_string)) return true;
    else return false;
}

The numerify() function is more elaborate than it really needs to be because my quest scripts also use pseudo steps like "step4d". But doing things like:
Code:
 if (get_property("questL04Bats").is_at_least("step3")) print("yay!")
is kind of handy.
 
Back
Top