Page 1 of 2 12 LastLast
Results 1 to 25 of 28

Thread: TPAs<!<!<!< [im sorry! i just dont get it ='( ]

  1. #1
    Join Date
    Jul 2009
    Posts
    51
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default TPAs<!<!<!< [im sorry! i just dont get it ='( ]

    so ive went thru about all the guides i could find and im begining to suspect im tpa inept. i just dont get it. can some1 please try to re explain tpas personally to me here?

    ill try to make it easier with this:

    i know:

    • tpa stands for tpoint array
    • a tpoint is actually a coordinate of x and y (2 points really?)
    • an array is set of somthing - in this case tpoints


    what i need to know:

    • first of all, what good is a set of coordinates to me? as in what can i do with tpas? in rs AND in personal scripts.
    • how to make tpas and use them in scirpts.


    but the most important part i dont understand is what use they are?!?!?
    edit: ive read somewhere you can use them for ms object finding and mm npc finding and stuff but how exactly?!?!?
    Last edited by Ouivile; 07-27-2009 at 01:49 PM.

  2. #2
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I am not going to pretend to be the TPA master or anything, because I do not know many of the functions associated with them as well. But I can explain the basics to you.

    TPA's can be used like this:

    SCAR Code:
    var
      T: TPointArray;

    if(FindColorTolerance(T[0].x,T[0].y,1925862,MSX1,MSY1,MSX2,MSY2,5))then
      Mouse(T[0].x,T[0].y,2,2,true);

    A TPoint is just like a normal integer variable, but instead of only being able to store 1 integer, it has 2 member variables (x and y) that can both store integer values. An array of TPoints (TPA's) is just multiple TPoint variables that can all contain different .X and .Y values (T[0].x, T[1].x, T[2].x...etc. can all be different).


    Now what I showed you above isn't very useful since you could have just done that with normal x and y variables. But a useful way to use them could be like so:

    FindColorsTolerance(var Points: TPointArray; Color, xs, ys, xe, ye, Tolerance: Integer): Boolean;

    SCAR Code:
    var
      T: TPointArray;
      i: Integer;
    FindColorsTolerance(T,Color,MSX1,MSY1,MSX2,MSY2,5);

    for i := 0 to High(T) do
      MMouse(T[i].x,T[i].y,0,0);


    What FindColorsTolerance does (notice the s after color in there. Makes it a completely different function) is looks for the color with the specified tolerance in the coords box you specify (here on the MS), and it stores all of the points it finds the color in the TPointArray (T). So then, we can move to every single point where we found the color like I did using a for loop below that. So for example, after calling the FindColorsTolerance, we could have done Mouse(T[3].x,T[3].y,0,0,true); to click the 4th place it found the color at.

    All that the for loop does is keeps incrementing i by 1 and does this until we are at the end of the TPA (High(T)). We keep stepping through to the next number in the array and moving to that point until at the end.

    Make sense? I am sure you can find more useful ways to use this then just moving the mouse to each point

    If you have any more questions just let me know.
    ~JAD
    Last edited by JAD; 07-27-2009 at 02:18 PM.

  3. #3
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Ouivile View Post
    i know:

    • tpa stands for tpoint array
    • a tpoint is actually a coordinate of x and y (2 points really?)
    • an array is set of somthing - in this case tpoints

    SCAR Code:
    tpa stands for tpoint array <-- correct
      a tpoint is actually a cooridnate of x and y < -- yes (2 points really?) <-- no
      an array is set of something - in this case tpoints <-- positive

    So what are they used for lets say that you have a tree that you want to find, but theres lot of other stuff around it of the same color, gonna be tuff to get that tree right. Well with TPA's you can get all the "points" of the colors and then move the mouse until you find the correct one. Example:
    SCAR Code:
    function FindSomething(var x, y: integer): boolean;
    var
      SomethingTPA: TpointArray;
      SomethingTpoint: Tpoint;
      x, y, i: integer;
    begin
      if(FindColorsTolerance(SomethingTpa, Color, x, y, MSx1, MSy1, MSx2, MSy2, 7))then
      begin
        for i := 0 to high(SomethingTpa) do
        begin
          SomethingTpoint := SomethingTPA[i];
          MMouse(SomethingTpoint.x, SomethingTpoint.y, 2, 2);
          if(IsUpText(Whatever your trying to do here))then
          begin
            GetMousePos(x, y);
            result := true;
          end;
        end;
      end;
    end;

    begin
      FindSomething(x, y);
      Mouse(x, y, 0, 0, true);
    end.

    Tried to explain that the best i could so post if you have any questions, hope I helped!

    EDIT: Kinda ninjaed while I was typing it haha
    Last edited by All that is man; 07-27-2009 at 02:19 PM.

  4. #4
    Join Date
    Jul 2009
    Posts
    51
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by JAD View Post

    Make sense? I am sure you can find more useful ways to use this then just moving the mouse to each point

    ~JAD
    yes the top part i did know but ty nyway. i did learn a little about the function and thats for this new findcolors function that sure will be usefull i guess.

    ps: no i really cant find more usful ways. give me a specific example rather than moving the mouse one by one? cuz that is pretty useless as far as i can tell.

    ================================================== =

    Quote Originally Posted by All that is man View Post
    [scar]


    Tried to explain that the best i could so post if you have any questions, hope I helped!

    EDIT: Kinda ninjaed while I was typing it haha
    i think that might be confusing for someone else but i understood it. yes that is a use, however, wouldnt that be a bit pointless say your trying to find a tree in a grass background or something, now if your color is all green which is basically the whole screen then you would just be going from 0,0 to 1,0-2,0 etc, which kinda is detectable and pointless?

    however i do see how it could* be beneficial but not enough....can you guys give me more examples? preferably ones that say "im tpa and i can do such-and-such and no other way to do it but tpas"????

    thanks!

  5. #5
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Example:

    You are looking for a tree color. There are a few pieces of grass around that have almost the same color as the tree color. This is what I would do:

    SCAR Code:
    var
      T, T2: TPointArray;
      i: Integer;

    FindColorsSpiralTolerance(T,2786153,MSX1,MSY1,MSX2,MSY2,4);
    for I := 0 to High(T) do
    begin
      FindColorsSpiralTolerance(T2,2786153,T[i].x-20,T[i].y-20,T[i].x+20,T[i].y+20);
      if(GetArrayLength(T2) > 25)then
      begin
        Writeln('More than 25 colors around the point, so it''s probably the tree');
        MMouse(T[i].x,T[i].y,4,4);
        if(IsUpText('Tree'))then
        begin
          GetMousePos(x,y);
          Mouse(x,y,0,0,true);
          Writeln('Found the tree');
          break;
        end;
      end;
    end;

    So first you store all the points on the screen with the color (and a tolerance of 4) in the T array. Then go through each point, check if within 20 pixels all the way around there are over 25 similar colors (makes it more likely it is the tree that way), and check if the tree is there. If not, then it will move onto the next point.

    You could not do that with FindColorTolerance. if you just did

    SCAR Code:
    if(FindColorTolerance(x,y,2786153,MSX1,MSY1,MSX2,MSY2,4))then
    begin
      MMouse(x,y,4,4);
      if(IsUpText('Chop'))then
      begin
        GetMousePos(x,y);
        Mouse(x,y,0,0,true);
      end;
    end;

    This would just check the screen for the color once. If it was found it would check if that is the tree by the uptext. If this was not the tree, it would not continue to check other spots on the screen for the color.



    Somebody will probably post here with more knowledge on TPA's than I and tell you to make custom ones or something, idk. To me this seems like a good method though for looking for lots of different objects on the screen (rocks, trees...etc. Even bank booths). This is how I used to do it in my old (really old) Varrock Lumberjack wood cutter which cut all trees in varrock. I had to tell the difference between oak and normal trees (pretty much exactly same colors). This did the trick because Oak trees would have a much higher array length of colors found around the point than normal trees because they are so much bigger.

    Hope this helps some. I am not sure that I have many more examples though since TPA's truly aren't necessary for great object finding (but very helpful in some cases). Good logic with FindColorSkipBoxArray's could work too to check different areas of the map.
    Last edited by JAD; 07-27-2009 at 03:23 PM.

  6. #6
    Join Date
    Jul 2009
    Posts
    51
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by JAD View Post
    Example:
    This did the trick because Oak trees would have a much higher array length of colors found around the point than normal trees because they are so much bigger.
    see this is a good use.... also just use findcolortolerance you can make a repeat until loop for that? instead of tpa?
    edit: more examplees please? perhaps something outside of rs?

  7. #7
    Join Date
    Mar 2009
    Posts
    128
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    There's soo much to learn...

  8. #8
    Join Date
    Oct 2008
    Location
    behind you!
    Posts
    1,688
    Mentioned
    2 Post(s)
    Quoted
    40 Post(s)

    Default

    Tpas might be too advanced for you, i recommend to skip TPAs for the moment, and learn them once when you're a bit smarter. .
    Hi

  9. #9
    Join Date
    Jul 2009
    Posts
    51
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Tickyy View Post
    Tpas might be too advanced for you, i recommend to skip TPAs for the moment, and learn them once when you're a bit smarter. .
    ewww? lol im smart enough. i just need examples of how and when to use them.

  10. #10
    Join Date
    Sep 2006
    Location
    include srl/srl.scar ( aussie)
    Posts
    2,875
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You dont have to smart for TPAS

    Short Answer.

    The color finding functions finds the colors and where they are located(x,y) (more than 1, an array) stores them in a TPA.

    The uses a loop to go through all theese cords until it finds the right uptext.

  11. #11
    Join Date
    Jul 2009
    Posts
    51
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by NiCbaZ View Post
    You dont have to smart for TPAS

    Short Answer.

    The color finding functions finds the colors and where they are located(x,y) (more than 1, an array) stores them in a TPA.

    The uses a loop to go through all theese cords until it finds the right uptext.
    is that reallllly the only example of use u guys can give me?! is that all tpas do?!?!?!?!?! how bout an example with no uptxt or no rs at all?

  12. #12
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Ouivile View Post
    is that reallllly the only example of use u guys can give me?! is that all tpas do?!?!?!?!?! how bout an example with no uptxt or no rs at all?
    I believe that my example was a good reason why they are necessary in some areas of Runescape. If you just repeated with a FindColorTolerance, it would keep looking from top left to bottom right and stopping at the same place. It wouldn't find a different color.

    Like
    SCAR Code:
    repeat
      if(FindColorTolerance(x,y,9872354,MSX1,MSY1,MSX2,MSY2,3))then
        MMouse(x,y,0,0);
    until(false);

    This would look for the color. Lets say that it found the color at 156,297. If you went to do the same check again, it would search from the same location again and stop at the exact same spot, 156,297. You would need a TPA if you want to find all the colors on the screen of it and store them in an array.

    In places not runescape related, they are hardly necessary since most websites do not have their colors changing while you are visiting them (like the Runescape client does).
    Last edited by JAD; 07-28-2009 at 01:16 AM.

  13. #13
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    Quote Originally Posted by Ouivile View Post
    is that reallllly the only example of use u guys can give me?! is that all tpas do?!?!?!?!?! how bout an example with no uptxt or no rs at all?
    You pretty well described what a Tpoint is in your first Post.

    And since you know what it is, you should be able to figure out ways to use it o_o ?.

    If' you got more specific questions we're glad to help you out though .

    ~caused

  14. #14
    Join Date
    Jul 2009
    Posts
    51
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    well to be an srl member i belive your script must use tpas, but i dont think i would ever use them so im tryin to figure out when where and how?

  15. #15
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    How they are usually used is like this:
    1. Use FindColorsTolerance to store all the points of the found color in an array (ex. the brown color of a door)
    2. Use a function like SplitTPA(Ex) or TPAToATPA(Ex) to sort them into an array of TPointArray. Each of the resulting TPointArrays in that array is a group of touching or almost touching (depending on the parameters you passed to the function) points. For example, it each TPointArray in the resulting array should be all the points in the door, and possibly some TPAs of tree trunks and other miscellaneous brown objects
    3. Once you have sorted your array into groups of points, you then determine which one you want to use. In this case, you are looking for which group of points is the door. This is sometimes done by looking at the amount of points in each group. If it is a very small amount of points, it's probably not a door (maybe a tree trunk or something). You can also check the width/height of the group of points
    4. Loop through all the possible groups (according to amount of points or width/height) to see which is, in this case, the door. This is usually done by using MiddleTPAEx. You input your group of points (or TPA) to it, and an x and y variable, and it stores the middle of it in those variables. You then move the mouse to the returned coordinate (x, y) and check via uptext if it is the door. If not, go on to the next group

    I am not the best at explaining things, so if you have any questions on what I said, please ask.

  16. #16
    Join Date
    Jul 2009
    Posts
    51
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ^^^yes someone said this before but that seems to be the only use for tpas? but thats ok, its actually kinda what i need right now, so how bout an example for all those functions cuz im not familiar with any of them.

  17. #17
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    TPAs are not as advanced as you think. Its very simple once you get the basic concept

    So this is my attempt to teach you:

    TPoint = 1 Point on the screen pinpointed by a horizontal variable (x) and a vertical variable (y). So the (x, y) is one point on the screen.

    TPointArray = Taking into count all these many TPoints and putting them together into a set of TPoints, so you won't have to declare a new variable for each TPoint, hence you will be wanting to search for objects on the screen and the objects can contain 1000+ points within it.

    Taking into count you hopefully understand exactly what those two are and how they differentiate, lets begin with some brainstorming on where you can use these.

    - Color Finding
    - Point Recordings
    - Text Finding
    - Estimated Size of Object
    & etc...

    Now time for some examples on how you can use them:

    SCAR Code:
    function FindUsingTPA(Color, Tol, X1, Y1, X2, Y2: Integer): Boolean;
    var I, x, y: Integer;
        TPA: TPointArray;
    begin
      FindColorsTolerance(TPA, Color, X1, Y1, X2, Y2, Tol); // Find and record colors into TPA
      if (Length(TPA) > 9) then // Check if the length is greater than 9
      begin
        TPA := ReArrangeandShortenArray(TPA, 19); // Shortens down the array based on pixel distance of 19
        SortTPAFrom(TPA, Point(MSCX, MSCY)); // Sorts the TPA starting from center of your player
        HTPA := High(TPA); // Record highest point in TPA

        for I := 0 to HTPA do // Loop through all points
        begin
          MMouse(TPA[I].x, TPA[I].y, 3, 3); // Move mouse to a specific point recorded
          if IsUpText('hop') then // If the uptext of where the mouse is contains 'hop', its true
          begin
            GetMousePos(x, y); // Get and record current mouse position
            Mouse(x, y, 0, 0, True); // Click
            Result := True; // Return True
            Break; // Break out of the loop
          end;
        end;
      end;
    end;

    begin
      if FindUsingTPA(16777215, 3, MSX1, MSY1, MSX2, MSY2) then
        Writeln('Clicked On The Tree');
    end.

    I was going to use ATPA (T2DPointArray), due to more accuracy and better findings but maybe just 1 step at a time



    ~NS

  18. #18
    Join Date
    Feb 2008
    Posts
    517
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    You can't find much uses for TPAs because there aren't many, and anything a normal integer can do a TPA can do, it's just that TPAs are better for some specific things, personally only thing I would use a TPA for is reflection pathing, everything else is kind of pointless, or there is simply an easier or a better way to do it other than using TPAs.

  19. #19
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Feroc1ty View Post
    You can't find much uses for TPAs because there aren't many, and anything a normal integer can do a TPA can do, it's just that TPAs are better for some specific things, personally only thing I would use a TPA for is reflection pathing, everything else is kind of pointless, or there is simply an easier or a better way to do it other than using TPAs.
    I disagree... TPAs are worth alot more than to just use anything to replace them :/ TPAs can be used for LOTS of things, you just gotta be creative and think efficient code.



    ~NS

  20. #20
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    NS says it.

    I often used them(TPoint) to return 2 values from a function... You dont need to be limited on screen coords with .x and .y

    And i used TPAs to Save a status of a gamefield .. It often comes quite handy, that you got both x and y to define...

    ~caused

  21. #21
    Join Date
    Feb 2009
    Posts
    2,155
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default

    well heres the thing i dont know if this was stated before but every TPA is the same in gerneal the only diffrence is the colors and uptext

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

    Default

    Quote Originally Posted by J_Pizzle View Post
    well heres the thing i dont know if this was stated before but every TPA is the same in gerneal the only diffrence is the colors and uptext
    and the lengths, and the color2speedmodifiers, and the ranges, and the etc, etc, etc.

  23. #23
    Join Date
    Feb 2008
    Posts
    517
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by Nadeem View Post
    I disagree... TPAs are worth alot more than to just use anything to replace them :/ TPAs can be used for LOTS of things, you just gotta be creative and think efficient code.



    ~NS
    You can do what you have described with integers themselves, you just have to be creative and think efficient code.

    Any other overgeneralized statement you wish to use?

  24. #24
    Join Date
    Feb 2009
    Posts
    2,155
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by mormonman View Post
    and the lengths, and the color2speedmodifiers, and the ranges, and the etc, etc, etc.
    well i never change my tpas except for the color and uptext and they always work

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

    Default

    Quote Originally Posted by J_Pizzle View Post
    well i never change my tpas except for the color and uptext and they always work
    thats because you don't use the advanced(lol... not really that advanced) part of tpas.

Page 1 of 2 12 LastLast

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
  •