Results 1 to 14 of 14

Thread: Need help with walking

  1. #1
    Join Date
    Nov 2011
    Posts
    6
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Need help with walking

    How do i code so my character moves to a specific area ingame?

  2. #2
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    There's several different ways to do so. for how long of a distance do you want to walk?

  3. #3
    Join Date
    Nov 2011
    Posts
    6
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hmm, not worldwide, basically a few tiles should do the work, draynor - willow trees?

  4. #4
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by Trojan_ View Post
    Hmm, not worldwide, basically a few tiles should do the work, draynor - willow trees?
    With Simba and SRL, you're going to want to change your mindset. You dont want to walk to a certain tile. You want to walk into that area. Area being, a range. You will almost never be able to walk to an exact point.

    If you want to walk to the fishing area in draynor, there are a couple of things youll want to look for.

    o The Fishing symbol. Will you be able to see the fishing spot symbol from where you are?
    o Will looking for the colour of the trees and walking towards that colour be accurate enough?
    o What about the water? What if walk towards certain areas of the water on the minimap. We could do some math to help improve accuracy on this.
    o Make a bitmap or a dtm of the area and walk to it?

    Not necessarily in that order. Before attempting this, you may want to learn the basics if you havent already. TPA's, DTM's, and all that stuff will be important to the success of your script.

    Good luck
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

  5. #5
    Join Date
    Nov 2011
    Posts
    6
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by noidea View Post
    With Simba and SRL, you're going to want to change your mindset. You dont want to walk to a certain tile. You want to walk into that area. Area being, a range. You will almost never be able to walk to an exact point.

    If you want to walk to the fishing area in draynor, there are a couple of things youll want to look for.

    o The Fishing symbol. Will you be able to see the fishing spot symbol from where you are?
    o Will looking for the colour of the trees and walking towards that colour be accurate enough?
    o What about the water? What if walk towards certain areas of the water on the minimap. We could do some math to help improve accuracy on this.
    o Make a bitmap or a dtm of the area and walk to it?

    Not necessarily in that order. Before attempting this, you may want to learn the basics if you havent already. TPA's, DTM's, and all that stuff will be important to the success of your script.

    Good luck
    The willow tree colour should do the trick, also, i'm new to Colour coding So where should i start with TPA/DTM?
    I'm new here since of the crash of Reflection/Injection
    Last edited by Trojan_; 11-05-2011 at 09:51 PM.

  6. #6
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Check out a tutorial on DDTMs (Dynamic DTMs) they will work nicely.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  7. #7
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    The autocolors are still broken, so if you're planning on using the tree color, FindTreeColor still works.

    Simba Code:
    function FindTreeColor: Integer;
    var
      TPA, TestTPA: TPointArray;
      ATPA: T2DPointArray;
      H, S, L: Extended;
      i, TestColor, R, G, B, AL: Integer;
      BlackListCol: TIntegerArray;
    begin
      result := -1;
      if FindMMColorsSpiralTolerance(TPA, 1528609, 70) then
      begin
        AL := high(TPA);
        For i := 0 to AL do
        begin
          TestColor := GetColor(TPA[i].x, TPA[i].y);
          if not InIntArray(BlackListCol, TestColor) then
          begin
            ColorToRGB(TestColor, R, G, B);
            ColorToHSL(TestColor, H, S, L);
            if InRange(R - B, -10, 50) then
              if InRange(R - G, -75, -30) then
                if InRange(G - B, 50, 88) then
                  if L < 31.5 then
                    if GetColor(TPA[i].x - 1, TPA[i].y) = TestColor then
                      if GetColor(TPA[i].x, TPA[i].y + 1) = TestColor then
                        if GetColor(TPA[i].x, TPA[i].y - 1) = TestColor then
                        begin
                          FindColorsSpiralTolerance(mmcx, mmcy, TestTPA, TestColor, mmx1, mmy1, mmx2, mmy2, 0);
                          if Length(TestTPA) > 0 then
                          begin
                            ATPA := TPAtoATPAEx(TestTPA, 11, 10);
                            SortATPAFrom(ATPA, Point(mmcx, mmcy));
                            if not InRange(Length(ATPA[0]), 21, 28) then
                              if Length(ATPA[0]) < 30 then
                                if not InRange(Length(ATPA[0]), 8, 10) then
                              begin
                                writeln('Tree colour = '+ Inttostr(TestColor));
                                Result := TestColor;
                                exit;
                              end else
                              begin
                                ColorToHSL(TestColor, H, S, L);
                                if L > 24 then
                                begin
                                  SetArrayLength(BlackListCol, Length(BLackListCol) + 1);
                                  BlackListCol[High(BlackListCol)] := TestColor;
                                end;
                              end;
                          end;
                        end;
          end;
        end;
      end;
      writeln('Couldn''t find tree color!');
      Result := -1;
    end;    

    procedure tofish();
    var
      treetpa, watertpa: tpointarray;
      lowest, sym: tpoint;
      i, lowy, d, treecol: integer;
    begin
      if not loggedin then exit;
      treecol := findtreecolor;
      findcolorstolerance(treetpa, treecol, mmx1, mmy1, mmx2, mmy2, 0);
      if (treecol > 0) and (length(treetpa) > 0) then
      begin
        writeln('Walking to trees via treecolor');
        FilterPointsPie(treetpa, 85, 115, 50, 70, mmcx, mmcy);
        for i := 0 to high(treetpa) do
          if lowest.y < treetpa[i].y then lowest := treetpa[i];
        mfnf(lowest.x, lowest.y, 1, 1);
        flag;
        wait(300+random(300));
      end else
      begin
        writeln('Couldnt find treecolor, attempting to walk to the farthest water spot');
        //Hopefully this will do till the autocolors are fixed......
        findcolorstolerance(watertpa, 10327174, mmx1, mmy1, mmx2, mmy2, 10);
        if length(watertpa) > 0 then
        begin
          debugtpa(watertpa, 'a');
          lowy := 0;
          for i := 1 to high(watertpa) do
            if watertpa[i].y < watertpa[lowy].y then lowy := i;
          mfnf(watertpa[lowy].x-7, watertpa[lowy].y-3, 1, 1);
          flag;
          wait(300+random(300));
        end else
        begin
          if findsymbol(sym.x, sym.y, 'fish') then
          begin
            mfnf(sym.x, sym.y-5, 1, 1)
            flag;
            wait(300+random(300));
          end else
          begin
            writeln('Couldnt get to fishing spot!');
            killplayer();
          end
        end;
      end;
    end;

    That is my walking procedure, please dont copy it, but do learn from it

    Note: TPA = TPointArray = array of tpoint

    tpoint = a set of x and y in one var

    var t: tpoint;
    t := point(1, 2);
    writeln(t.x);
    writeln(t.y);
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

  8. #8
    Join Date
    Nov 2011
    Posts
    6
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by noidea View Post
    The autocolors are still broken, so if you're planning on using the tree color, FindTreeColor still works.

    Simba Code:
    function FindTreeColor: Integer;
    var
      TPA, TestTPA: TPointArray;
      ATPA: T2DPointArray;
      H, S, L: Extended;
      i, TestColor, R, G, B, AL: Integer;
      BlackListCol: TIntegerArray;
    begin
      result := -1;
      if FindMMColorsSpiralTolerance(TPA, 1528609, 70) then
      begin
        AL := high(TPA);
        For i := 0 to AL do
        begin
          TestColor := GetColor(TPA[i].x, TPA[i].y);
          if not InIntArray(BlackListCol, TestColor) then
          begin
            ColorToRGB(TestColor, R, G, B);
            ColorToHSL(TestColor, H, S, L);
            if InRange(R - B, -10, 50) then
              if InRange(R - G, -75, -30) then
                if InRange(G - B, 50, 88) then
                  if L < 31.5 then
                    if GetColor(TPA[i].x - 1, TPA[i].y) = TestColor then
                      if GetColor(TPA[i].x, TPA[i].y + 1) = TestColor then
                        if GetColor(TPA[i].x, TPA[i].y - 1) = TestColor then
                        begin
                          FindColorsSpiralTolerance(mmcx, mmcy, TestTPA, TestColor, mmx1, mmy1, mmx2, mmy2, 0);
                          if Length(TestTPA) > 0 then
                          begin
                            ATPA := TPAtoATPAEx(TestTPA, 11, 10);
                            SortATPAFrom(ATPA, Point(mmcx, mmcy));
                            if not InRange(Length(ATPA[0]), 21, 28) then
                              if Length(ATPA[0]) < 30 then
                                if not InRange(Length(ATPA[0]), 8, 10) then
                              begin
                                writeln('Tree colour = '+ Inttostr(TestColor));
                                Result := TestColor;
                                exit;
                              end else
                              begin
                                ColorToHSL(TestColor, H, S, L);
                                if L > 24 then
                                begin
                                  SetArrayLength(BlackListCol, Length(BLackListCol) + 1);
                                  BlackListCol[High(BlackListCol)] := TestColor;
                                end;
                              end;
                          end;
                        end;
          end;
        end;
      end;
      writeln('Couldn''t find tree color!');
      Result := -1;
    end;    

    procedure tofish();
    var
      treetpa, watertpa: tpointarray;
      lowest, sym: tpoint;
      i, lowy, d, treecol: integer;
    begin
      if not loggedin then exit;
      treecol := findtreecolor;
      findcolorstolerance(treetpa, treecol, mmx1, mmy1, mmx2, mmy2, 0);
      if (treecol > 0) and (length(treetpa) > 0) then
      begin
        writeln('Walking to trees via treecolor');
        FilterPointsPie(treetpa, 85, 115, 50, 70, mmcx, mmcy);
        for i := 0 to high(treetpa) do
          if lowest.y < treetpa[i].y then lowest := treetpa[i];
        mfnf(lowest.x, lowest.y, 1, 1);
        flag;
        wait(300+random(300));
      end else
      begin
        writeln('Couldnt find treecolor, attempting to walk to the farthest water spot');
        //Hopefully this will do till the autocolors are fixed......
        findcolorstolerance(watertpa, 10327174, mmx1, mmy1, mmx2, mmy2, 10);
        if length(watertpa) > 0 then
        begin
          debugtpa(watertpa, 'a');
          lowy := 0;
          for i := 1 to high(watertpa) do
            if watertpa[i].y < watertpa[lowy].y then lowy := i;
          mfnf(watertpa[lowy].x-7, watertpa[lowy].y-3, 1, 1);
          flag;
          wait(300+random(300));
        end else
        begin
          if findsymbol(sym.x, sym.y, 'fish') then
          begin
            mfnf(sym.x, sym.y-5, 1, 1)
            flag;
            wait(300+random(300));
          end else
          begin
            writeln('Couldnt get to fishing spot!');
            killplayer();
          end
        end;
      end;
    end;

    That is my walking procedure, please dont copy it, but do learn from it

    Note: TPA = TPointArray = array of tpoint

    tpoint = a set of x and y in one var

    var t: tpoint;
    t := point(1, 2);
    writeln(t.x);
    writeln(t.y);
    Nice, what i don't get is how i'm gonna get the co-ordinates? Not 300 which is millisecounds, but x = something etc..., can i make it click an area by x= and y= etc, What does RGB Mean...? I don't get those points

  9. #9
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by Trojan_ View Post
    Nice, what i don't get is how i'm gonna get the co-ordinates? Not 300 which is millisecounds, but x = something etc..., can i make it click an area by x= and y= etc, What does RGB Mean...? I don't get those points
    Oh, you can copy paste FindTreeColor into your script. Its an old srl function that still works that was scrapped and the new one doesnt. What I was talking about was the function that walks to the trees/fishing spot
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

  10. #10
    Join Date
    Nov 2011
    Posts
    6
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by noidea View Post
    Oh, you can copy paste FindTreeColor into your script. Its an old srl function that still works that was scrapped and the new one doesnt. What I was talking about was the function that walks to the trees/fishing spot
    I'm getting a error by the code, anyway what your trying to tell me is that i should printscreen a area i want to walk edit it, a example is the sea...this colour and make it click there as example?

  11. #11
    Join Date
    Nov 2011
    Posts
    6
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Had exams and haven't been online for a while anyway does autocolour work and some guides tell me to printscreen the item and then make it more viable and then attach the code into Simba, i'm not great but i'm learning :s

  12. #12
    Join Date
    Jan 2011
    Location
    Denver, CO
    Posts
    1,351
    Mentioned
    2 Post(s)
    Quoted
    72 Post(s)

    Default

    DDTMs are an effective way of finding areas on the minimap, there's a great tutorial on it here:

    http://villavu.com/forum/showthread.php?t=10008

  13. #13
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    I made a very efficient MM symbol-finder and I assume there at Draynor you have both a Bank map symbol for the bank and a tree symbol for the willow area. My function will find the correct symbol you're looking for, give you the X/Y coord of the middle of that symbol and tell you your distance to the symbol. That should cover walking to and from the willows/bank and tell you which one you're near.

    If you'd like it let me know.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  14. #14
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    http://villavu.com/forum/showthread.php?t=66266

    SPS will walk pretty much anywhere with ease.

    Here's an example:
    Simba Code:
    program new;
    {.include srl/srl.scar}
    {.include sps/sps.simba}

    // This function will walk you to Draynor willow trees,
    // assuming you're only 1 click away
    function WalkToWillows: boolean;
    begin
      Result := SPS_WalkToPos(4155, 3700);
    end;

    // This function will walk you to Draynor bank,
    // assuming you're only 1 click away
    function WalkToWillows: boolean;
    begin
      Result := SPS_WalkToPos(4185, 3670);
    end;

    {


        YOUR OWN PROCEDURES AND FUNCTIONS HERE


    }




    begin
      SetupSRL;
      SPS_Setup(RUNESCAPE_SURFACE, ['10_8', '10_9']);

      {
         YOUR SCRIPTS MAIN EXECUTION HERE
      }

    end.

    You should also learn the concept of DTMs, and make a function that will check if we have arrived at the correct position after walking. If you like, you can also just walk with DTMs, which is prefered over SPS if you're only walking from Draynor bank to Draynor willows, but when you want to write say, an all-locations-in-one-script-woodcutter, SPS makes walking whole lot easier.

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
  •