Page 2 of 60 FirstFirst 1 2 3 4 12 52 ... LastLast
Results 11 to 20 of 596

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

  1. #11
    Senior Member matt.chugg's Avatar
    Join Date
    Nov 2006
    Posts
    615

    Default

    ok i'm going to stop posting after this one!

    lines 123, 145, 146, 155 look like they are missing the visit_url function

    Code:
    123: case $location[Bugbear Pens]: return (in_muscle_sign() && primecheck(13) && contains_text("woods.php","pen.gif"));
    145: case $location[Dark Elbow of the Woods]: return (levelcheck(6) && !have_skill($skill[spleen of steel]) && !contains_text("quests.php?which=2","cleansed the taint"));
    146: case $location[Friar's Gate]: return (primecheck(29) && (have_skill($skill[spleen of steel]) || contains_text("quests.php?which=2","cleansed the taint")));
    155: case $location[Icy Peak]: return (levelcheck(8) && contains_text("quests.php?which=2","L337 Tr4pz0r"));

    suggestion!

    The Slime tube: check for the bucket? (unfortunatly requires server hit)
    Code:
    case $location[The Slime Tube]: return (visit_url("clan_slimetube.php").contains_text("thebucket.gif"));
    Last edited by matt.chugg; 06-06-2009 at 09:35 PM.

  2. #12
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,370

    Default

    @matt: Lots of excellent ideas!

    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 ?
    Duh! I was so caught up on zone availability that I missed some of the basics. So, I've added in a check for adventures. I also moved the checks for Drunken Stupor and St. Pete's Day up to the top, before doing a drunkenness check. I did not, however, add a check for Beaten Up, because there are many places you can still adventure even if Beaten Up. Although I did add in a check for 0 HP.

    dare I suggest that you just perhaps missed the el vibrato island!
    Yep, missed that. I've moved it up into the bloc with the other miscellaneous zones.

    this also requires some kind of stench resistance, so what should the suggested fix be?
    Okay -- two ideas incorporated at once here. I've added in the resist() function from the DDD, as well as added a boolean "prep" parameter to can_adv(). The prep parameter specifies whether or not can_adv() will actually prepare you to adventure in the zone. Leaving it false means that it will just check to see if you could possibly adventure somewhere (previous behavior). Since resist() has the same sort of parameter, you can simply check resist(prep) to either check for resistability or actually acquire resistance, depending on the parameter passed to can_adv().

    This means that additional functionality will have to be written into many of the zones that would require gear changing or item use.

    lines 123, 145, 146, 155 look like they are missing the visit_url function
    The Slime tube: check for the bucket?
    Those fixes have been added in. Thanks for all the great feedback!
    Sig by JakAtk
    My scripts: One-Click Wossname | Om******* (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mer******** (?!) | 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!

  3. #13
    Senior Member matt.chugg's Avatar
    Join Date
    Nov 2006
    Posts
    615

    Default

    nicely done Zarqon!

    Is it possible to overload functions in ash? If so then you could use

    Code:
    boolean equipped_amount(item i, bool equipit) {
    	if(equipit==true) {
    		// equip relevant item here!
    	}
    	return equipped_amount(i);
    }
    if not then I suppose just giving the function another name, and using as a wrapper would work fine.

    this can be used exactly the same as resist():

    Code:
    case $location[Palindome]: return (equipped_amount($item[talisman o'nam],prep) > 0);

  4. #14
    Senior Member matt.chugg's Avatar
    Join Date
    Nov 2006
    Posts
    615

    Default

    Hobopolis: (note to self really)

    Tunnels, check for "adventure.php?snarfblat=166" in clan_hobopolis.php and ! whatever the link is thats added when you finish tunnels to goto town square

    zones, check for each zone image and that the boss hasn't been already killed in dungeon logs (GAH 2 server hits!)

  5. #15
    Senior Member matt.chugg's Avatar
    Join Date
    Nov 2006
    Posts
    615

    Default

    Bats again!

    Entryway doesn't require stench resistance, so should return it's own value to prevent it using the value returned for the junction!

    The Boss Batt's Lair is only available if you havn't killed him!

    Also, (and this isn't added yet) each of the 3 require the usage of a sonar biscuit to open up, i've already completed the quest this run, but i'm hoping the quest log will show how many are used, and therefore exactly which ones are available, unfortunatly this means for the Boss Bat Lair it would have to use one server hit to check if its open using sonar, then another to check its not been defeated



    lines 119 to 123 (I think, I may have modified it so they arn't accurate!)
    Code:
       case $location[Bat Hole Entryway]: return (levelcheck(4));
       case $location[Guano Junction]: return (levelcheck(4) && resist($element[stench],prep));
       case $location[Batrat and Ratbat Burrow]: print("Not sure if you've got the sonar biscuity goodness yet. Just using level check","olive"); return(levelcheck(4));
       case $location[Beanbat Chamber]: print("Not sure if you've got the sonar biscuity goodness yet. Just using level check","olive"); return(levelcheck(4));
       case $location[Boss Bat's Lair]: print("Not sure if you've got the sonar biscuity goodness yet. Just using level check","olive"); return (levelcheck(4) && !visit_url("questlog.php?which=2").contains_text("slain the Boss Bat"));
    Last edited by matt.chugg; 06-07-2009 at 07:36 PM. Reason: My grammar is SHOCKING!

  6. #16
    Senior Member matt.chugg's Avatar
    Join Date
    Nov 2006
    Posts
    615

    Default

    another thought to potentionally reduce server hits, how about using more logic to only use server hits when really needed?

    such as:
    Code:
    case $location[Defiled Nook]: if(levelcheck(7)){(return visit_url("cyrpt.php").contains_text("cyrpt7d.gif");} else {return false;}
    which would only check for the crypt image if you were actually of a high enough level.... (which I didn't need to type since your perfectly capable of understanding even my code!)

    in fact I'm not sure, but I think that can be refactored a little

    Code:
    case $location[Defiled Nook]: if(levelcheck(7)){return visit_url("cyrpt.php").contains_text("cyrpt7d.gif");} return false;
    sorry for the several posts! must look like i'm talking to myself! i'll wait for your responses before I post any more!
    Last edited by matt.chugg; 06-07-2009 at 08:33 PM.

  7. #17
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,370

    Default

    Matt! More great thoughts.

    1) I love the equipcheck() idea. Added that in, along with outfitcheck(). These will only swap gear if prep is true.

    2) For boss zones, often the link to the boss area changes depending on whether the boss is defeated, so detecting whether the area is open and the boss remains undefeated should usually be doable in a single server hit.

    3) Bat zones definitely need special handling for the use of sonars. I think the script ought to attempt to use enough sonars to reveal the desired zone, regardless of prep. If done right, the detection for that could be done in a single server hit. The question now becomes how to script that efficiently. For now, I added this after all three sonar-only bat zones, which I think is fairly nice:

    Code:
    if (!levelcheck(4)) return false;
    string bathole = visit_url("bathole.php");
    int sonarsneeded = to_int(!contains_text(bathole,"batratroom.gif")) +
    to_int(!contains_text(bathole,"batbeanroom.gif")) + to_int(!contains_text(bathole,"batbossroom.gif"));
    if (sonarsneeded > 0) {
       use_upto(sonarsneeded,$item[sonar-in-a-biscuit],true);
       bathole = visit_url("bathole.php");
    }
    return (contains_text(bathole,substring(to_url(where),0,index_of(to_url(where),"&"))));
    Note that this will detect whether the Boss Bat has been defeated.

    Also note that this uses a function from ZLib. Since this script also needed to use resist(), I simply made it require ZLib. Scripts that want to use both ZLib and CanAdv can now just import CanAdv.

    4) That's a good thought, but the existing operators already work that way.

    Consider this:

    Code:
    if (false && true) do something;
    ASH, like many languages, handles these comparisons smartly. As soon as it sees the first false, it doesn't even evaluate the second condition, since the final result will be false no matter what the second condition evaluates to.

    Likewise,

    Code:
    if (true || false) do something;
    does not evaluate the second condition.

    So,

    Code:
    return (levelcheck(7) && visit_url("cyrpt.php").contains_text("cyrpt6d.gif"));
    will first perform the level check. If that returns false, then it will return false and not bother with the visit_url().

    I asked about this long ago and was happy to discover that ASH behaves this way. I take advantage of it all the time in my scripts.

    Now, if only use() had a useful return value...
    Last edited by zarqon; 06-16-2009 at 04:53 PM.
    Sig by JakAtk
    My scripts: One-Click Wossname | Om******* (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mer******** (?!) | 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!

  8. #18
    Senior Member
    Join Date
    Sep 2008
    Posts
    795

    Default

    I asked about this in the other thread, but I'm really worried about it, so I'll be lame and repeat myself:

    What about scripts that include other scripts? If you try to include two scripts that each include zlib, mafia will puke, as I understand it. This is a huge potential problem for ascend.ash in particular, since it includes so many other scripts which also need to be run independently (and hence will each need to include zlib).

  9. #19
    Minion Bale's Avatar
    Join Date
    Jun 2008
    Posts
    13,174

    Default

    If you try to include two scripts that each include zlib, mafia will puke, as I understand it.
    Originally Posted by dj_d View Post
    I'm very concerned with mafia's drinking problem. Putting that aside, I guess you could edit the included scripts to remove zlib and putting the include statement in the script that calls them. I understand that you'd rather not edit these other scripts since they were written by someone else and they are subject to someone else's version control, but it might be the only solution unless one of mafia's developers could change this.

    Try submitting it as a feature request. (Or a bug fix?)

    And I'd suggest locking the liquor cabinet to keep mafia from puking.
    If people like my scripts, please send me stuffed Hodgmen.
    Universal Recovery, OCD Inventory Control, CounterChecker, newLife, ChIT.


  10. #20
    Developer
    Join Date
    Apr 2006
    Posts
    882

    Default

    I asked about this in the other thread, but I'm really worried about it, so I'll be lame and repeat myself:

    What about scripts that include other scripts? If you try to include two scripts that each include zlib, mafia will puke, as I understand it. This is a huge potential problem for ascend.ash in particular, since it includes so many other scripts which also need to be run independently (and hence will each need to include zlib).
    Originally Posted by dj_d View Post
    Really? I have a bunch of scripts that include other scripts, and all the aforementioned scripts include a lib script I wrote and nothing breaks. Have you actually tried, and if so does mafia create an error log?

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
  •