Results 1 to 17 of 17

Thread: GetWildernessLevel

  1. #1
    Join Date
    Jul 2011
    Location
    /home/litoris
    Posts
    2,226
    Mentioned
    0 Post(s)
    Quoted
    159 Post(s)

    Default GetWildernessLevel

    Simba Code:
    (*
    GetWildernessLevel
    ~~~~~~~~~~~~

    .. code-block:: pascal

        function GetWildernessLevel: Integer;

    Returns the wilderness level. Defaults to -1 if the number can't be read (out of wilderness)

    .. note::

      by litoris

    Example:

    .. code-block:: pascal

    *)

    function GetWildernessLevel : Integer;
    var
      Lev : String;
    begin
      Lev := GetNumbers(GetTextAtExWrap(490, 85-50, 508, 102-50, 0, 10, 1, 1939681, 20, XPChars));
      if ((Lev <> '') or (Lev <> ' ') or (Lev <> '  ') or (Lev <> '   ')) then
        Result := StrToInt(Lev)
      else
        Result := -1;
    end;

    I came up with this manually while working on my current script, I was amazed that the include didn't have such a function yet.
    Anyway, this function basically read the wilderness level. I tested it at various levels, it works, but I would really like it if some others could also test it. I have to use getnumbers, or else the string will also include a few colons when you are at single-digit levels.
    It's uses are twofold: It can both tell you what level you are(useful for teleporting) and tell you whether you are in the wilderness, because it returns -1 if the string is empty. I'll send a pull request after some people test it, don't want a disaster like the last time :P
    Miner & Urn Crafter & 07 Chicken Killer
    SPS BlindWalk Tutorial

    Working on: Nothing

    teacher in every art, brought the fire that hath proved to mortals a means to mighty ends

  2. #2
    Join Date
    Dec 2011
    Location
    New York, USA
    Posts
    1,242
    Mentioned
    12 Post(s)
    Quoted
    193 Post(s)

    Default

    Seems like a handy function when working in the wilderness. Might I suggest using InRange just to make it look a bit cleaner?
    Simba Code:
    function GetWildernessLevel : Integer;
    begin
      result := StrToInt(GetNumbers(GetTextAtExWrap(490, 85-50, 508, 102-50, 0, 10, 1, 1939681, 20, XPChars)));
      if not InRange(result, 1, 60) then
        result := -1;
    end;
    E: Sorry- I originally just changed it to have InRange instead of that nasty "or" thing. But then I noticed one thing that could be changed and another and another so I guess I kind of ruined it for you.

    E2: I appologize for this but
    Simba Code:
    function GetWildernessLevel : Integer;
    begin
      result := StrToIntDef(GetNumbers(GetTextAtExWrap(490, 85-50, 508, 102-50, 0, 10, 1, 1939681, 20, XPChars)), -1);
    end;
    Last edited by Nebula; 10-23-2012 at 07:22 PM.

  3. #3
    Join Date
    Nov 2011
    Posts
    1,589
    Mentioned
    9 Post(s)
    Quoted
    17 Post(s)

    Default

    Nice Idea but can I ask what would the use be?
    Mat



    ^^

  4. #4
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    If not wildernesslevel = 52 then
    writeln('we are dead!');

    if wildernesslevel = 32 then
    walktohere

  5. #5
    Join Date
    Jul 2011
    Location
    /home/litoris
    Posts
    2,226
    Mentioned
    0 Post(s)
    Quoted
    159 Post(s)

    Default

    Quote Originally Posted by Nebula View Post
    E2: I appologize for this but
    Simba Code:
    function GetWildernessLevel : Integer;
    begin
      result := StrToIntDef(GetNumbers(GetTextAtExWrap(490, 85-50, 508, 102-50, 0, 10, 1, 1939681, 20, XPChars)), -1);
    end;
    Yeah this looks fine, I have never worked with def functions before, but I guess this does exactly what my function did. Can you test it?
    Quote Originally Posted by Ollybest View Post
    If not wildernesslevel = 52 then
    writeln('we are dead!');

    if wildernesslevel = 32 then
    walktohere
    Exactly. My script, for example, keeps running south until the level is below 20, and then teleports. Saves me from teh trouble of making tons of maps/ODTM paths.
    Miner & Urn Crafter & 07 Chicken Killer
    SPS BlindWalk Tutorial

    Working on: Nothing

    teacher in every art, brought the fire that hath proved to mortals a means to mighty ends

  6. #6
    Join Date
    Dec 2011
    Location
    New York, USA
    Posts
    1,242
    Mentioned
    12 Post(s)
    Quoted
    193 Post(s)

    Default

    Quote Originally Posted by litoris View Post
    Yeah this looks fine, I have never worked with def functions before, but I guess this does exactly what my function did. Can you test it?
    Yeah, Just tested it- works fine.

  7. #7
    Join Date
    Dec 2011
    Location
    Nj
    Posts
    2,341
    Mentioned
    1 Post(s)
    Quoted
    18 Post(s)

    Default

    I say this is very useful! Great job! ++ for you!

    For the basics of the basics of pascal, try my TuT. ||Photoshop Editing ||MapleResourceDung Script || Book a flight! BuySellTrip

  8. #8
    Join Date
    Jul 2011
    Location
    /home/litoris
    Posts
    2,226
    Mentioned
    0 Post(s)
    Quoted
    159 Post(s)

    Default

    Sent pull req with Nebula's version:https://github.com/SRL/SRL-5/pull/99
    Miner & Urn Crafter & 07 Chicken Killer
    SPS BlindWalk Tutorial

    Working on: Nothing

    teacher in every art, brought the fire that hath proved to mortals a means to mighty ends

  9. #9
    Join Date
    Apr 2012
    Location
    Australia
    Posts
    1,252
    Mentioned
    1 Post(s)
    Quoted
    22 Post(s)

    Default

    Looks good litoris! I have no plans for scripting in the wilderness as of yet, but I'm sure this will be handy for those who do I'm kind of suprised there wasn't already one too, to be honest.

  10. #10
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

  11. #11
    Join Date
    Jan 2012
    Posts
    369
    Mentioned
    6 Post(s)
    Quoted
    91 Post(s)

    Default

    Suggestion to improve reliability : You should take note that when the XP counter is enabled the wildy icon changes places, thus you should search in 2 places.

  12. #12
    Join Date
    Jul 2011
    Location
    /home/litoris
    Posts
    2,226
    Mentioned
    0 Post(s)
    Quoted
    159 Post(s)

    Default

    Quote Originally Posted by speedster View Post
    Suggestion to improve reliability : You should take note that when the XP counter is enabled the wildy icon changes places, thus you should search in 2 places.

    I'm definitely adding that.
    This is pretty much a snippet right now, I'm making a version that gives you both the Wilderness level and tells you whether you are in the wildy or not. I will add a check at the beginning to adjust the function so that it searches in the correct place, thanks for that.
    Miner & Urn Crafter & 07 Chicken Killer
    SPS BlindWalk Tutorial

    Working on: Nothing

    teacher in every art, brought the fire that hath proved to mortals a means to mighty ends

  13. #13
    Join Date
    Jan 2012
    Location
    127.0.0.1
    Posts
    702
    Mentioned
    11 Post(s)
    Quoted
    76 Post(s)

    Default

    Good job lit +rep

    Edit: sorry cant rep you. [Error MSG]You must pass some reputation around before you can give it to litoris[/Error MSG]

  14. #14
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    Unfortunately this is broken because of the EOC graphical update

  15. #15
    Join Date
    Dec 2011
    Location
    Behind you...
    Posts
    345
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    This is useful! Can you update it
    Scripting powerlevel = [||||||||]

  16. #16
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    Fixed it
    Simba Code:
    Function GetWildernessLevel : Integer;  
    begin
      result := StrToIntDef(GetNumbers(GetTextAtExWrap(490, 35, 508, 175, 0, 10, 1, 1939681, 20, XPChars)), -1);
    end;
    Tested and working with XP bars and no XP bars.

  17. #17
    Join Date
    Nov 2012
    Location
    USA
    Posts
    153
    Mentioned
    1 Post(s)
    Quoted
    33 Post(s)

    Default

    Awesome, I'll be writing a wildy script soon, and this should come in handy

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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