Page 1 of 60 1 2 3 11 51 ... LastLast
Results 1 to 10 of 598

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

  1. #1
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,376

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

    The CanAdv Project

    What is it?
    CanAdv is designed as a tool for scripters, meant to be imported into their scripts. After importing, you simply call can_adv(location, prep), and the function will return true or false depending on whether or not you are able to adventure in a given location.

    "Wait, what's prep?"

    The second parameter is a boolean that decides whether or not to really prepare you for going into the zone. If you call can_adv(location, true) it will equip necessary items, etc. If you call can_adv(location, false) it will only check to see that you have the necessary items, and so forth. Generally, unless you plan on actually adventuring in the given location you should use false.

    NOTE: Special thanks to Theraze for helpfully assuming de facto responsibility for this script as I have been almost entirely focused on my combat scripts.

    How to use it:
    • Install it by pasting this into your CLI:
      Code:
      svn checkout https://svn.code.sf.net/p/therazekolmafia/canadv/code/
    • When writing a script, type "import <canadv.ash>" at the top of the script (without quotes). Authors wishing to include ZLib as well need not bother, since ZLib will be imported along with CanAdv.
    • Enjoy using boolean can_adv( location where, boolean prep ) as if it were an ASH function.


    Changelog
    6.4.09 - alpha 0.1 posted. Let the collaboration begin!
    6.7.09 - 0.2 changes: included resist() function, added "prep" parameter to canadv(), added four missing visit_url() calls, relocated El Vibrato, check for adventures and drunkenness.
    6.17.09 - 0.3 changes: move resist() out -- script requires ZLib. Fixes for bat zones. Added equipped item and outfit checking minifuncs and integrated them. Detect St. Sneaky Pete's Day.
    9.01.09 - 0.4 changes: a crapton!
    9.04.09 - 0.5 changes: added Post-War Sonofa Beach.
    11.17.09 - 0.6 changes: added ALL missing zones and step one of Sea zone detection. Fixed detection of completed Boss Bat's Lair.
    12.30.09 - 0.62 changes: added Crimbo '09 zones as unadventurable. Use ZLib's new vprint().
    10.25.10 - 0.7 changes: fixes to Boss Bat and Hippy/Frat camps (thanks psly4mne and FN Ninja!). Removed sewer, replaced old tavern with new. Added all currently missing zones -- mainly nemesis zones and Uncle P's maps.
    1.28.11 - 0.71: Friar's Gate is no longer a zone. Added new Friar zones and other tweaks by Theraze.
    2.16.11 - 0.72: New names for Knob zones. Limerick Dungeon checks mainstat.
    2.16.11 - 0.73: Ugh. Correct URL for new Knob. Bumped nearly all verbosity settings up from 4 to 6.


    Further changes are recorded by Theraze below -- and on the script's SourceForge changelog.
    Last edited by zarqon; 06-25-2013 at 03:07 PM.
    Sig by JakAtk
    My scripts: One-Click Wossname | Om******t (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mer********d (?!) | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | CanAdv | Script Registry | Map Manager | About Bats
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

  2. #2
    Senior Member Theraze's Avatar
    Join Date
    Mar 2010
    Posts
    8,659

    Default Currently Maintaining CanAdv

    The CanAdv Project 0.90

    Please download the latest CanAdv from this post.

    Changelog
    02.13.12 - 0.74: Added version checking. Also added checking for familiars and underwater adventuring.
    02.19.12 - 0.75: Added class checking for guild unlocking.
    02.27.12 - 0.76: Added quest tracking awareness for locked-guild characters. Added variable to keep the guild locked.
    02.29.12 - 0.77: Cleaned up locked-guild to never adventure if you've told it to stop. Moved two holiday zones to former event section.
    03.01.12 - 0.78: Changed default to not unlocking guild. Added location-only no-prep overloaded can_adv function.
    05.16.12 - 0.79: Added initial Bugbear Invasion zones, marked as not available if you aren't in a bugrun. Pete's Stupor takes 26 drunk.
    05.24.12 - 0.80: Added additional Bugbear Invasion zones, still marked as not available if you aren't in a bugrun.
    06.08.12 - 0.81: Now using biodata properties to know if a Bugbear Invasion zone is unlocked.
    07.16.12 - 0.82: Adds closed fire event locations, holiday detection for 4, always checking when prepping, and quest properties for Bat Hole.
    08.07.12 - 0.83: Trapper, not Tr4pz0r, for the Icy Peak.
    09.02.12 - 0.84: McLargeHuge gif names had changed in revamp.
    10.20.12 - 0.85: Random mining and underwater zones which I've had since 9/5 have finally been noticed as missing by other people.
    11.26.12 - 0.86: Added in the new Level 9 locations.
    12.02.12 - 0.87: Fixed the Orc Chasm check to work, since it was broken, and now without needing a server hit.
    12.03.12 - 0.88: Added the skeletal skiff as an alternative to the dingy dinghy.
    02.02.13 - 0.89: Hopefully added the new zones for the jars.
    02.21.13 - 0.90: Giant's Castle is now 3 zones. Basic/wrong check for if they're unlocked, but it makes the script run.
    Attached Files
    Last edited by Theraze; 02-21-2013 at 02:22 PM.

  3. #3
    Senior Member mredge73's Avatar
    Join Date
    Dec 2008
    Location
    Houston TX
    Posts
    519

    Default

    Awesome!

    Is the Summoning Chamber included?

  4. #4
    Senior Member
    Join Date
    Sep 2008
    Posts
    795

    Default

    Neat! What are your thoughts on adding a try_adv, which would go one step further and actually adventure once, then report the success or failure of that? That's the approach levelup.ash uses (just tries to adventure everywhere, checking to see if an adventure is used). That would allow a second level of verification before you commit to burning a bunch of turns.

  5. #5
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,376

    Default

    @mredge: Nope, that's a non-snarfblat area that needs to be added.

    @dj_d: you'll notice that currently the script only detects whether you are capable of entering an area -- for example, if you have a necessary outfit, it returns true but doesn't equip the outfit. For maximum flexibility, I would like this script to avoid using items as much as possible. Adventuring is fully outside the scope of the script -- the whole point is to figure out if you can adventure somewhere before you actually do.

    That said, there is room for a second function prep_adv() which would equip necessary gear or use necessary items, so that if (prep_adv(place)) adventure(place) would always work. As usual, I'll go with what the community decides.
    Sig by JakAtk
    My scripts: One-Click Wossname | Om******t (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mer********d (?!) | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | CanAdv | Script Registry | Map Manager | About Bats
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

  6. #6
    Senior Member mredge73's Avatar
    Join Date
    Dec 2008
    Location
    Houston TX
    Posts
    519

    Default

    damn
    I guess I can add it, it should be similar to "Haunted Wine Cellar" right?

  7. #7
    Senior Member
    Join Date
    Sep 2008
    Posts
    795

    Default

    @Zarqon: Depends on if you see this as a set of utilities for "enabling adventurement" (evaluate, prep, try) or just the first of those three stages. I personally see value in all 3 stages but appreciate that you've done anything at all.

  8. #8
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,376

    Default

    @edge: Not quite... the summoning chamber would have its own set of checks. The easiest way would probably be a level check, followed by a few item checks (i.e. the diary), followed by a visit_url() check which looks for the image.

    @dj_d: Correct me if I'm wrong, but try_adv() would be nothing more than this:

    Code:
    try_adv(location where) {
       return adventure(1,where);
    }
    Since adventure returns true if you spend the number of adventures specified, that ought to work. Doesn't seem like it's worth importing a separate script for that.
    Sig by JakAtk
    My scripts: One-Click Wossname | Om******t (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mer********d (?!) | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | CanAdv | Script Registry | Map Manager | About Bats
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

  9. #9
    Senior Member matt.chugg's Avatar
    Join Date
    Nov 2006
    Posts
    617

    Default

    Firstly, excellent idea, and I am as always in awe of your coding style!

    Any other improvements you can think of.
    Originally Posted by zarqon
    CanAdv is designed as a tool for scripters, meant to be imported into their scripts. After importing, you simply call can_adv(location), and the function will return true or false depending on whether or not you are able to adventure in a given location.
    Originally Posted by zarqon
    Perhaps i'm thinking about the usage of this all wrong, but if I am reading the above statement right, should it also check if you are drunk, have enough adventures to adventure somewhere and arn't currently beaten up ?

    also before I go attempting to help to much, an example of the kind of question I will be asking!

    Code:
       case $location[Guano Junction]: return (levelcheck(4));
    this also requires some kind of stench resistance, so what should the suggested fix be?

    check for stench resistance (as well as level):
    Code:
    case $location[Guano Junction]: return ((levelcheck(4)==true) && (elemental_resistance($element[stench])>0));
    which would assume you need to be wearing the correct outfit before checking you can get there,

    or should it check for the most likely item which would give you the required resistance?
    Code:
    case $location[Guano Junction]: return ((levelcheck(4)==true) && (item_check($item[Pine-Fresh air freshener]==true)));
    Last edited by matt.chugg; 06-06-2009 at 09:01 PM.

  10. #10
    Senior Member matt.chugg's Avatar
    Join Date
    Nov 2006
    Posts
    617

    Default

    on another point (possibly i'm not using it right) because not all cases return something I get some interesting answers!

    > call canadv el vibrato island

    Cannot yet detect Hobopolis zones. Assuming true...
    El Vibrato Island is available to your character.
    having looked a little closer the zones are groups so it will return something for that zone in the last case element of each zone, dare I suggest that you just perhaps missed the el vibrato island!

Similar Threads

  1. Replies: 0
    Last Post: 04-08-2015, 11:53 PM
  2. 14841: Check location isn't null before getting water level.
    By RSS Bot in forum Latest SVN Changes
    Replies: 0
    Last Post: 10-09-2014, 08:51 PM
  3. Replies: 0
    Last Post: 03-19-2012, 04:23 AM
  4. Ash function to check location exists?
    By Glazius in forum Community Support
    Replies: 1
    Last Post: 12-15-2010, 07:13 PM
  5. CanAdv can I adventure here?
    By Charles Haynes in forum Informational Scripts
    Replies: 7
    Last Post: 11-21-2009, 10:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •