Results 1 to 21 of 21

Thread: Uses of TPA walking

  1. #1
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Uses of TPA walking

    Now this tutorial is more about theory and thinking than it is about raw code, something to bring to your attention that is usually overlooked.

    Now first thing is, we can all all understand that RadialWalk() is a form of TPA walking, but there are many other ways of tpa walking, and many uses for this.

    Before reading this tutorial I would suggest having a basic knowledge of TPA's, how to make and manipulate them.

    I will break this tutorial up into 3 parts,

    I. Color finding
    II. Area manipulation
    III. Theory
    IV. Examples


    I. Color Finding

    Now, Color finding is simple and very similiar to mainscreen finding, infact, you can make it exactly the same as mainscreen finding with different co-ords (MMx1 instead of MSx1 ). Keeping in mind there might be some functions you may want to include and use in your tpa finding. these being:

    SortTPAFrom(tpa: TpointArray; From: Tpoint);
    SCAR Code:
    SortTPAFrom(tpa: Tpointarray; from: Tpoint);

    sorts a given tpointarray from a certain point. Some example points are:

    SCAR Code:
    Point(MMcx, MMcy); {middle of the mm}
            Point(MMx2, MMy2); {Bottom Right}

    looks like this:

    SCAR Code:
    SortTPAFrom(tpa, Point(MMcx, MMcy);

    simple right? This procedure is used simple to start your tpa from a given point. To express this point I'll give you an example situation:


    say you want to walk to this point on the minimap, now a simple findwatercolor would obtain all the water, and walking to a tpoint, you would have the possiblity to walk to any point on the lake. so before you split your tpa, or click it in general, a simple SortTPAFrom(tpa, Point(aPointInsidetheRedCircle) would make the first tpa the script moves to/clicks in that area, or the closest point to that area and make your character walk there.
    Rs_OnMiniMap(x, y: Integer);
    SCAR Code:
    Rs_OnMiniMap(x, y: Integer);

    Ok, so now you want to find a color that is a dark brown, a color that may be similiar to that of the outerlayer of the minimap. A simple fix for your mouse clicking this area is simple a RS_OnMiniMap check.

    Rs_OnMiniMap is simple an easy to use, helps to keep the script accurate and keep away from silly errors and mistakes. Lets take an example:

    SCAR Code:
    Function ClickMMTpointArray(tpa: TpointArray; xmod, ymod: Integer): Boolean;
    var i: integer;
    begin
      for i := 0 to High(tpa) do
      begin
        WriteLn('Current Point at: ('+IntToStr(Tpa[i].x)+', '+IntToStr(tpa[i].y)+');');
        if not rs_OnMiniMap(tpa[i].x, tpa[i].y) then Continue;
        Mouse(tpa[i].x+xmod, tpa[i].y+ymod, 5, 5, True);
        Wait(150+random(200));
        if FlagPresent then
        begin
          FFlag(5);
          Result := True;
          Exit;
        end else
        Continue;
      end;
    end;

    this is my favorite tpa clicking function. Simple it goes through the TPA from 0 to the highest point until one is on the minimap, then it clicks it. Keeping the script accurate.

    FilterPointsPie( var Points: TpointArray;
    SD, ED, MinR, MaxR: Extended; Mx, My: Integer);
    SCAR Code:
    FilterPointsPie( var Points: TpointArray; SD, ED, MinR, MaxR: Extended; Mx, My: Integer);
    This function can come off as incredibly confusing but dont worry I'll walk you through it slowly, and show some uses.

    lets start with

    SCAR Code:
    vars Points: TpointArray ;
    this is self explainitory you simply just put in your tpa there.
    SCAR Code:
    SD, ED: Extended;
    this, is the start and end radians where it will filter from. Confused, think back to RadialWalking when you inputed the start and end radials to where you wanted the function to search in. If your still confused I would suggest a refresher on radialwalk before continuing this tutorial.
    SCAR Code:
    MinR, MaxR: Extended;
    The Minimum and Maximum Radius (not to be confused with Radians) to which you want to filter from. Say you want to walk a long distance however the same color appears frequently, you can simple filter from 0 to 60 and then your script will only look at the tpoints between 61 to the outside of the minimap. Its also a good way to filter out the outside of the Minimap ( the ridge) that has similiar colors to some places on the map.
    SCAR Code:
    Mx, My: Integer
    this is simply the center of the circle to which you wants points filtered from. For use of the Minimap I would Suggest MMcx, MMcy which is the center of the minimap.
    RadialWalkEx(var TPA: TPointArray; cx, cy, TheColor, tol, StartRadial, EndRadial, Radius: Integer): Boolean;
    Alright, so one of my favorite functions to mess around with, simply this is a more extended version of radialwalk and one that you can easily edit aswell. So first of all, you will notice the tolerance parameter, which allows you to now use static colors and search with tolerance. This is even more handy now considering autocolor.scar isn't working (and won't be fixed probably).

    ex.
    SCAR Code:
    Function RadialWalkExEx(TheColor, StartRadial, EndRadial, Radius, Xmod, Ymod: Integer): Boolean;
    var TPA: TPointArray; I: Integer;
    begin
      if RadialWalkEx(tpa, MMCX, MMCY, TheColor, 0, StartRadial, EndRadial, Radius) then
        for i := 0 to High(tpa) do
          if MFNF(tpa[i].x+Xmod, tpa[i].y+Ymod, 5, 5) then
      begin
        FFlag(10);
        Result := True;
        Exit;
      end;
    end;

    this is my modified version for a more broader approach. You can also do something like...

    SCAR Code:
    RadialWalkEx(TPA, MMCX, MMCY, 1234567, 15, 0, 90, 60)
    if length(TPA) > 0 then
    begin
      // either you can manipulate the TPA like so...
     ATPA := TPAtoATPAex(TPA, 5, 5);
     for i := 0 to high(ATPA) do
      begin
        P := MiddleTPA(ATPA[i]);
        // etc
      end;
      // or something like this
      for i := 0 to High(TPA) do
      begin
         Mouse(TPA[i].x, TPA[i].y, 5, 5, True);
         // etc
      end;
    end;

    So keep this function handy the next time your walking and don't want to create your own autocolor, or there is a unique color on the MM. it's a good way to keep using the RadialWalk you know and love, but now expand on it and use it for a larger audience of problems. I can go into more detail if required, I don't know how much needs to be said that isn't already quite self-explainitory.
    FindColorSkipBox(var x, y, Color, x1, y1, x2, y2: Integer; Skip: Tbox)
    Now this is one of my new favorite functions to use. This is a much easier way of manipulating the search area. Best used with autocolors, this can help differentiate where you are by searching only a certain area and negating other spaces. An example being, in one of my scripts I use this to check if I am at my final destination. There are 4 rocks on the screen, so I filter out the 2 in a box that I dont want my character to walk to, and if it finds the other two rocks in a different area then it preforms a task.

    example being:

    SCAR Code:
    Function WalkToAltar(): Boolean;
    var i: Integer; x, y: Integer; Skip: TBox;
    begin
      Skip.x1 := 589; // here is where I set up my Tbox. You could alternativly make this a global variable
      Skip.y1 := 135; // That would allow you only to have to declare it once at the start of the script
      Skip.x2 := 665;
      Skip.y2 := 167;
      WriteLn('Walk to Altar initiated');
      SetRunEx();
      RoadColor := FindNewVarrockRoadColor;
      repeat
        if Random(2) = 1 then RoadColor := FindNewVarrockRoadColor;
        PathWalk(0);
        Inc(i);
        if FindColorSkipBox(x, y, FindRockColor, MMx1, MMy1, MMx2, MMy2, Skip) then Break;
      until I > 3;
      Result := PathWalk(2);
    end;

    So pretty much my script repeats a walk until it finds the rock color in an area then breaks the loop if it finds it. Again I can expand on this if requested but in my opinion it seems pretty self explainitory again.

    got more functions that you would like explaining? Let me know and I can add them.


    II. Area Manipulation
    This is a small section of this tutorial, and is simply for those who find that mainscreen or minimap that the mouse just keeps mousing over things.

    First of all You will need to study this picture and understand the constants for area manipluation and furthermore I hope you start to gain an idea of how you can change the search area.



    With this picture I hope you can deturmine bottom left bottom right, ect areas of the screen.

    Now With Any findcolor procedure (findcolor, findcolors. findcolorspiral, findcolorsspiral, etc) you should not that each should give you an area for which you can search in the color. Most of the time you give the default MSx1, MSy1, MSx2, MSy2 (for mainscreen) or MM for minimap finding. However you should note that those numbers can be manipluated to look in only a certain section to find a particular color, even basic co-ords can be used to serach a section of a minimap.

    keep in mind each area is a box. This box requires two main points, each corner of the box, the top left and the bottom right. Quite simple and this will allow you to make your walking very accurate with TPA walking, as accuate as a ddtm if done correctly.

    III. Theory

    The theory part of it is more just examples and ideas that you can impliment in your script. Now, have you ever been pissed off about using findsymbol()? When someone stands on it and the script totally screws up? well simply enough you can just use a simple TPA to walk instead of FindSymbol. This allows tolerance, and only getting a section of the symbol instead of the whole thing, allowing for even more accurate finding.

    How about when there are two symbols on the screen? You can use area manipulation to only look at one, using findsymbolin() or a custom tpa.

    TPA's and area manipulation have endless opportunity, its all about looking outside the box and realizing the unique colors and areas on the minimap. Theory really cant be taught, but hopefully it can be inspired.

    IV. Examples

    Finally, what you've been waiting for, some examples of TPA walking. Now for me I prefer having a function that gathers the TPA and a function that Clicks it, however I have deduced two different TPA walking styles. Keep in mind each person has their own styles, likes and dislikes, and that what may work for me might not work for you.

    From my guildminer:

    SCAR Code:
    Function GetMMPoints(x, y, color, width, height, tolerance: Integer): TpointArray;
    var tpa: TpointArray; atpa: T2DpointArray; l, i, p: Integer;
    begin
      FindColorsSpiralTolerance(x, y, tpa, color, MMx1, MMy1, MMx2, MMy2, tolerance);
      Atpa := TPAtoATPAEx(Tpa, width, height);
      for i := 0 to High(atpa) do
      begin
        if Length(atpa) > 5 then
        begin
          l := getarraylength(Result);
          SetArrayLength(Result, l+1);
          Result[l] := MiddleTpa(atpa[i]);
        end;
      end;
      if Length(result) = 0 then Exit;
      for i := 0 to High(Result) do
        if rs_OnMiniMap(result[i].x, result[i].y) then Inc(p);
        if p = 0 then SetArrayLength(Result, 0);
      WriteLn('Found: '+IntToStr(l)+' Result(s)');
    end;

    this function literally gathers all the points on the mm of a similiar color, the syntax is simple and easy to understand. I do not wish to break it down for you, but if requested I eventually will. This is a very confusing way of doing it but its my way and i like it another, more simple way of tpa walking would be something like this:

    SCAR Code:
    Function Water_Walk(Wx, Wy: Integer): Boolean;
    var TPA: TPointArray; ATPA: T2DPointArray; P: TPoint; H: Integer;
    begin
      if not LoggedIn then Exit;
      FindColorsSpiralTolerance(Wx, Wy, TPA, FindWaterColor, MMX1, MMY1, MMX2, MMY2, 1);
      if Length(TPA) = 0 then
      begin
        Result := False;
        Exit;
      end;
      ATPA := SplitTPAEx(TPA, 3, 3);
      SortATPASize(ATPA, True);
      for H := 0 to High(ATPA) do
      begin
        P := MiddleTPA(ATPA[H]);
        MMouse(P.x + 25, P.y + 25, 5, 5);
        Wait(RandomRange(125, 550));
        GetmousePos(P.x, p.y);
        Mouse(P.x, p.y, 5, 5, True);
        Wait(200+random(100));
        if not FlagPresent then Continue;
        FFlag(15);
        Result := True;
        if Result then Break;
      end;
    end;

    a simple tpa that walking via a boolean and clicks/sorts by a certain x and y co-ordinate set by the user.

    V. Final Notes

    I updated this slightly, and I would like to continue doing so, so please if there is a function you think deserves to be added or should/could be explained then let me know.
    Last edited by Blumblebee; 11-18-2009 at 05:42 AM. Reason: updated

  2. #2
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Welcome Back?

  3. #3
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I leave in 2 days from now again, thought I'd do something in the couple days I was around again for a bit
    “Ignorance, the root and the stem of every evil.”

  4. #4
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Nice tutorial Though you could add RadialWalkEx since they return the TPA, but you explained FilterPointsPie.


  5. #5
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Looks good man

    Rep+

    I actually started scripting a bit like you after that hide tanner ..as far as the TPA walking goes anyways.

  6. #6
    Join Date
    Jan 2007
    Location
    Nomming bits in your RAM
    Posts
    385
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Rep+. I was thinking about how to do this about 2 or 3 days ago. Good tutorial. ^^
    Current Project: Catching up. XD. Potentially back for the summer, depending on how things go.

  7. #7
    Join Date
    Jan 2007
    Location
    the middle of know-where
    Posts
    1,308
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    rep + I also thought it was a great tutorial. Thanks always.
    On vacation in NeverLand,
    Code:
    typedef int bool;
    enum { false, true };

  8. #8
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    I was just being confused about this today. This is a great tut. I learned a thing or two.. or three.

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  9. #9
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by NCDS View Post
    Looks good man

    Rep+

    I actually started scripting a bit like you after that hide tanner ..as far as the TPA walking goes anyways.
    Quote Originally Posted by Macro_FTW View Post
    Rep+. I was thinking about how to do this about 2 or 3 days ago. Good tutorial. ^^
    Quote Originally Posted by anonymity View Post
    rep + I also thought it was a great tutorial. Thanks always.
    Quote Originally Posted by 3Garrett3 View Post
    I was just being confused about this today. This is a great tut. I learned a thing or two.. or three.
    thanks, I'm glad this has helped so many people
    “Ignorance, the root and the stem of every evil.”

  10. #10
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Thanks for writing the tut.

    [offtopic] ps, did you just get a new cup? I thought you only had two just a second ago [/offtopic]

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  11. #11
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Ya I love using TPA walking. I used it in my smelter.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  12. #12
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by 3Garrett3 View Post
    Thanks for writing the tut.

    [offtopic] ps, did you just get a new cup? I thought you only had two just a second ago [/offtopic]
    no ive had 3 for a while... haha
    Quote Originally Posted by Narcle View Post
    Ya I love using TPA walking. I used it in my smelter.
    I loves it too, its really underrated so I figured I'd draw some attention to it
    “Ignorance, the root and the stem of every evil.”

  13. #13
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I love it, REP++.
    ~Hermen

  14. #14
    Join Date
    Sep 2007
    Posts
    1
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It looks difficult but when you are used to it you will find it CRAZY
    Nice TUT

  15. #15
    Join Date
    Mar 2007
    Posts
    3,116
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    I was thinking about this a couple days ago. I was thinking of a different way though.

  16. #16
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by MylesMadness View Post
    I was thinking about this a couple days ago. I was thinking of a different way though.
    this was more or less just my style. Can I ask how you do yours?
    “Ignorance, the root and the stem of every evil.”

  17. #17
    Join Date
    Jul 2008
    Location
    Canada
    Posts
    1,612
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

  18. #18
    Join Date
    Mar 2007
    Posts
    3,116
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by Blumblebee View Post
    this was more or less just my style. Can I ask how you do yours?
    I was thinking about getting the thickness of the road, and click the on the one that is x pixels wide. Not very accurate though because the roads can have same width, so I decided to pick the road that starts x pixels over to the left. Again, could not be accurate. I just have brain storming sessions at 2 in morning.

  19. #19
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    Moved to advanced. Rep+

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  20. #20
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    out of absolute boredom I updated this slightly, added a couple more functions, and will try to add more in the next few days.

  21. #21
    Join Date
    Jan 2009
    Location
    Belgium
    Posts
    175
    Mentioned
    0 Post(s)
    Quoted
    14 Post(s)

    Default

    hmm gotta check the tutorial out tomorow it's like 2:00 over here, gona sleep after some mins, anyway, THANKS and GOODNIGHT ;D

    +rep

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
  •