Results 1 to 11 of 11

Thread: Guide to tpas, and how to use them!

  1. #1
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default Guide to tpas, and how to use them!

    This guide will(hopefully) teach you what a tpa is, how it works, and so on and so forth

    Under standing a TPoint

    A TPA is a TPointArray, before you can fully understand WHAT it is, you must know 2 other "vocabularies", which is a "TPoint", and an "Array". I wont go into what an array is, since you should already know, but if not there are plenty of tutorials out there that explain it very well

    So, that leaves the TPoint. A tpoint, is pretty much a type, that can hold the x and y value of a point.

    it looks something like this:

    SCAR Code:
    type
      TPoint = record
        x : integer;
        y : integer;
    end;

    I'm not sure if i can explain why its like that, but i can explain hows its used.

    SCAR Code:
    program New;
    {.Include SRL/SRL.scar}

    var TP : TPoint; //you call TP as a TPoint
    begin
      TP := point(100, 200); //the function point returns a TPoint, 100 being the x value and 200 being the y value.
      mousespeed := 10;
      mmouse(TP.x, TP.y, 0, 0); //you can use these values to substitute
    end.

    this is a basic example of a tpoint. of course, this isn't very useful, nor efficient, but it shows some-what how its used.

    lets use a function in srl, called:

    SCAR Code:
    function ItemCoords(i: Integer): TPoint;

    as you can see, its a function that returns a TPoint, and this is how you would use it in a script:

    SCAR Code:
    program New;
    {.Include SRL/SRL.scar}

    var TP : TPoint; i : integer;

    begin
      for i:= 1 to 28 do
      begin
        TP:= ItemCoords(i); //Item Coords returns the x and y value of item 1
                            //in a TPoint
        mmouse(tp.x, tp.y, 5, 5); //And you use tp's x and y values
                                 //To move your mouse over the item
        if isuptext('opper') then
          dropitem(i);
      end;
    end.

    once again, this wouldn't be to good in runescape, but its also a good example. It uses a for-to-do loop to get the item coords of the item, moves the mouse to each one, and if the uptext of "opper" is found, it will drop that item, you see?

    Now that you know what a TPoint is, we shall go onto the TPointArray

    TPointArrays!!
    Finally the meat of the tutorial. a TPA is literally, an array of a TPoint

    SCAR Code:
    type
      TPointArray = array of TPoint;


    and a basic example:

    SCAR Code:
    program New;
    {.Include SRL/SRL.scar}

    var TPA : TPointArray; i : integer;

    begin
      TPA := [point(100, 100), point(200, 200)];  //points return a TPoint
                                                  //And its in an array,
                                                  //thus creating a TPointArray
      mousespeed := 10;
      for i:= 0 to 1 do mmouse(TPA[i].x, TPA[i].y, 0, 0);
    end.

    honestly, this is the same thing as simply doing

    SCAR Code:
    begin
      mmouse(100, 100, 0, 0);
      mmouse(200, 200, 0, 0);
    end.

    but thats not the point because when your using this in runescape, there will most likly be A LOT of points, probably 100 +.

    this is a basic tree finding function using tpas:
    SCAR Code:
    function findtree : boolean;
    var tpa : tpointarray; I : integer;
    begin
      if findcolorstolerance(TPA, {color}, msx1, msy2, msx2, msy2, 10) then
        for i:= 0 to high(tpa) do
        begin
          mmouse(tpa[i].x, tpa[i].y, 0, 0);
          if isuptext('ree') then
          begin  
            result := true;
            exit;
          end;
        end;
    end;

    You are probably all "z0mg lots of stuff", but really, its quite easy, especially if you are 100% familiar with the TPoint, and arrays. but lets break it down shall we?

    SCAR Code:
    var tpa : tpointarray; I : integer;
    is our variable declaration, we need a TPA variable and an integer variable

    SCAR Code:
    if findcolorstolerance(TPA, {color}, msx1, msy2, msx2, msy2, 10) then

    this is a basic function used to find tpas. TPA is the name of our TPointArray, you can replace {color} with any thing really, and msx1, ect ect are the mainscreen variables. 10 is our tolerance. its really simple isnt it?

    SCAR Code:
    for i:= 0 to high(tpa) do
        begin

    this starts our loop, high(tpa) incase you didnt know, returns the highest value in the array "tpa".

    SCAR Code:
    mmouse(tpa[i].x, tpa[i].y, 0, 0);

    i honestly think this is the hardest part of the entire tutorial. its hard for me to explain, so sorry if its not that good.

    what this will do is it moves the mouse to the TPoint in the array, and if you know what a tpoint is i shouldn't really have to explain it to much, the same goes if you know how to use arrays and for-to-do loops

    SCAR Code:
    if isuptext('ree') then
            begin
              result := true;
              exit;
            end;

    this should be simple, if it finds the uptext then the function returns true and exits.

    Conclusion
    TPAs are what most scripts use for object finding. it is the most powerful object finder using color imo, and im sure the rest agree.

    its late at night, so im getting tired, and i have school in the morning so i have to get to bed i know i should have gone into more detail about certain things, so dont hold it against me although do post parts that i need to improve on, grammar, spelling, detail, and script wise so i can fix it up in the morning/ tomorrow night

    thanks for reading ~awkwardsaw
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

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

    Default

    moved.

    ~RM

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

  3. #3
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    tpas should be in advanced? sorry . i guess i should have paid more attention to that sticky i'll go through this tonight hopefully to fix things up and such
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  4. #4
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    On your tree finding function you have
    Code:
    msx1, msy2, msx2, msy2.
    same explaining it.
    Other then that awesome 1 more thing i learned.

  5. #5
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    thanks, i guess haha
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

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

    Default

    Dude, this is like intermediate, very simple stuff man!

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

    Default

    Probably wouldn't hurt to go a bit more in detail with it. Explain how to manipulate them a bit maybe? Actually show what they are capable of.

  8. #8
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    Smarter Child, it was in intermediet, it was moved

    and i havnt had time to work on it, and im not planning on it for a while but it is on my to-do list
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  9. #9
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Awkwardsaw View Post
    thanks, i guess haha
    If you didn't know what i meant, change
    Code:
    msx1,msy2,msx2,msy2
    to
    Code:
    msx1,msy1,msx2,msy2
    And it has the same problem when your explaining it. I see i made no sense in my post when i tried telling you the problem.

  10. #10
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    If you was finding a tree, you would use FindColorsSpiralTolerance. Also, perhaps add about TPAToATPA and SplitTPA, and the Ex versions of them.

    Richard.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  11. #11
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    Quote Originally Posted by R1ch View Post
    If you was finding a tree, you would use FindColorsSpiralTolerance. Also, perhaps add about TPAToATPA and SplitTPA, and the Ex versions of them.

    Richard.
    yes, spiral is best to use, and atpas are more advanced for this, dont you think?

    any who, i might update this guide tonight if i feel like it
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

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
  •