Page 2 of 3 FirstFirst 123 LastLast
Results 26 to 50 of 55

Thread: The Almighty TPA Tutorial

  1. #26
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    I have requested for it to be in the beginner or intermediate...

    Btw, can the Jrs see only beginner section?

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

    Default

    I'm not sure i completly understood SplitTPA. if you use SplitTPA an array will be created from each TPoing the other array had?

    so...
    SCAR Code:
    ThisTPA[0].x := 20; ThisTPA[0].y := 50;
    ThisTPA[1].x := 30; ThisTPA[1].y := 40;
    ThisTPA[2].x := 40; ThisTPA[2].y := 30;
    ThisTPA[3].x := 50; ThisTPA[3].y := 20;

    test:= SplitTPA(thisTPA);

    test[0][0].x = 20; ?
    test[0][1].x = 0; ?
    test[1][0].x = 30; ?
    test[1][1].x = 0?
    test[1][2].x = 0?

    would the test ATPA have the values i showed there?

    and waht exactly will MiddleTPA do? it'll analyse all the TPA points and find out the exact middle? so...
    SCAR Code:
    ThisTPA[0].x := 0; ThisTPA[0].y := 0;
    ThisTPA[1].x := 0; ThisTPA[1].y := 100;
    ThisTPA[2].x := 100; ThisTPA[2].y := 0;
    ThisTPA[3].x := 100; ThisTPA[3].y := 100;
    {100*100 square}
    ThisTPoint := MidleTPA(ThisTPA);

    ThisTPoint.x = 50?
    ThisTPoint.y = 50?

    and what the hell does TPAA := TPAToATPA(TPA, Distance) do? I'll make an ATPA with the TPoints of distance x, but how does it know which color we want?

    great tut, maybe a few more explained examples?

    ~RM

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

  3. #28
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    and what the hell does TPAA := TPAToATPA(TPA, Distance) do? I'll make an ATPA with the TPoints of distance x, but how does it know which color we want?
    Don't mix TPAs and colors - you get the TPA with the colors you want with FindColorsSpiralTolerance.

    TPAToATPA splits a TPointArray to multiple TPointArrays by the areas they are in, like:

    Point1-pixel-pixel-pixel-Point2

    TPAToATPA(TPA, 3) wouldn't count the Point in because its a "two", only Point1, pixel, pixel would go there.

    I think you just overthink it...

    and I have no idea wtf were you talking about SplitTPA? SplitTPA(TPA), or nowadays SplitTPA(TPA, 1) puts the points that are connected to eachother to their separate tpas.

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

    Default

    Quote Originally Posted by n3ss3s View Post
    Don't mix TPAs and colors - you get the TPA with the colors you want with FindColorsSpiralTolerance.

    TPAToATPA splits a TPointArray to multiple TPointArrays by the areas they are in, like:

    Point1-pixel-pixel-pixel-Point2

    TPAToATPA(TPA, 3) wouldn't count the Point in because its a "two", only Point1, pixel, pixel would go there.

    I think you just overthink it...

    and I have no idea wtf were you talking about SplitTPA? SplitTPA(TPA), or nowadays SplitTPA(TPA, 1) puts the points that are connected to eachother to their separate tpas.
    so in TPAToATPA each point will become a TPA? thanks

    ~RM

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

  5. #30
    Join Date
    Dec 2006
    Location
    Program TEXAS home of AUTOERS
    Posts
    7,934
    Mentioned
    26 Post(s)
    Quoted
    237 Post(s)

    Default

    i dont know anythign at all i dont even know what it means

    so i would appreciate it if you would like 1st start out by telling what is it for/definition

    thanks

  6. #31
    Join Date
    Dec 2006
    Posts
    723
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by p1nky View Post
    i dont know anythign at all i dont even know what it means

    so i would appreciate it if you would like 1st start out by telling what is it for/definition

    thanks
    Is that not what the first line says? If you don't know what a TPoint is then maybe you should start with a beginner tutorial.

  7. #32
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    Evil -

    SCAR Code:
    Function OgreFound(Var Ox, Oy: Integer): Boolean;
    Var
      BmX, BmY, R, CTS, I: Integer;
      TPAA: Array of TPointArray;
      TPA, TPAb: TPointArray;
      B: TBox;
    Begin
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      Ox := MSCX;
      Oy := MSCY;
      FindColorsSpiralTolerance(MSCX, MSCY, TPAb, 8365756, 30, 30, 470, 293, 10);
      For I := 0 To High(TPAb) Do
      Begin
        Ox := TPAb[i].x;
        Oy := TPAb[i].y;
        B := IntToBox(Ox - 20, Oy - 20, Ox + 20, Oy + 20);
        BmX := B.x2 - B.x1 shr 1;
        BmY := B.y2 - B.y1 shr 1;
        FindColorsSpiralTolerance(BmX, BmY, TPA, 8365756, B.x1, B.y1, B.x2, B.y2, 10);
        If GetArrayLength(TPA) > 100 Then
        Begin
          TPAA := TPAToATPA(TPA, 17);
          R := Random(GetArrayLength(TPAA));
          SetArrayLength(TPA, GetArrayLength(TPAA[r]));
          TPA := TPAA[r];
          MiddleTPAEx(TPA, Ox, Oy);
          Result := Not(BusyAt(Ox, Oy));
          Break;
        End;
      End;
      ColorToleranceSpeed(CTS);
    End;

    Go to SRL Members Forum -> SRL New Functions and go through until you find
    "SCAR code of mine", there is few more.

  8. #33
    Join Date
    Mar 2007
    Location
    Ohio
    Posts
    138
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

  9. #34
    Join Date
    Apr 2007
    Location
    Texas
    Posts
    1,668
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Props on the tut, that was a great refresher.

    on one of your examples,
    "For I := 0 To High(PlayerDots) Do"
    did you mean
    "For i := 0 To High(PlayerDots) Do"?
    [IMG]http://farm3.static.flickr.com/2120/2052732965_348f3629d0_o.jpg[/IMG]

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

    Default

    Quote Originally Posted by LordGregGreg View Post
    Props on the tut, that was a great refresher.

    on one of your examples,
    "For I := 0 To High(PlayerDots) Do"
    did you mean
    "For i := 0 To High(PlayerDots) Do"?
    what is the diff if it is capital or not?

    Thanks N3ss3s i made my first lesser demon finder and it works pretty good
    ~Hermen

  11. #36
    Join Date
    Sep 2007
    Location
    Australia, NSW
    Posts
    934
    Mentioned
    6 Post(s)
    Quoted
    145 Post(s)

    Default

    wat was this --> "Omfgz0r m003vfmouse d00z not fawnd me objz0r"
    l0l p10X 0Mg!! =p

    very nice tut..short..but detailed..thanx
    im going to put it into my miner for V3.0

    INACTIVE
    How-to: Make S.M.A.R.T. less laggy

    Sell me your Maple Shieldbows (u)! Up to 95gp ea!

    My Scripts:
    Ivy Chopper Ultra [RS3] | Fantastic Fletcher [RS3]
    99 x78 | 99 x10 | 99 x2 | 99 x12


    Use the REPORT tags when posting progress reports to make life easier (:
    [REPORT]Put progress report in here![/REPORT]

    Super Savvy Smither V1.06Cool Classy Cooker V1.02 [EoC]

  12. #37
    Join Date
    Oct 2007
    Location
    Atlantis with u'r girlfriend
    Posts
    251
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    thanks is not enough, ive been going through these tutorials for a while. among all the tpa tutorials this has been the most helpful. before sitting down and reading the tutorial from top to bottom, i did not know how a tpa could be used to find anything.

    now to criticism:
    there are a lot of grammatical errors on the tut. its hard to for some including me, to try and deduce what your trying to say.

    the only thing i could think of that could be missing is using an array of T2DPA to find areas that have certain colors. im going to embrace this project tomorrow.

  13. #38
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    Hehe, I made this some time ago, I think it would be different if I would write one now, but I hope you get atleast a basic understanding...

    Only part people actually need to learn there is to learn use an array.

    Using a FindColors(Spiral)Tolerance doesn't differ from using any other function, the purpose of it does but like writing the params etc...

    If you know how to use an array, which shouldn't be very hard, you won't have much trouble using a 2D -Array either, and then you need only to find functions that fit your purpose...

  14. #39
    Join Date
    Dec 2006
    Location
    Banville
    Posts
    3,914
    Mentioned
    12 Post(s)
    Quoted
    98 Post(s)

    Default

    I'm afraid I don't get why people make tutorials on how to add '.x' or '.y' to something.


    What you should teach is how to use them....
    The jealous temper of mankind, ever more disposed to censure than
    to praise the work of others, has constantly made the pursuit of new
    methods and systems no less perilous than the search after unknown
    lands and seas.

  15. #40
    Join Date
    Mar 2008
    Posts
    1,492
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Wow im afraid this stuff is way over my head... Idk why i just dont seem to get it... i really wanna learn it too

  16. #41
    Join Date
    Dec 2006
    Posts
    908
    Mentioned
    1 Post(s)
    Quoted
    17 Post(s)

    Default

    I reccomend u read the TPA made easy guide on the Intermediates section. Otherwise try finding scripts that use these functions and study it. BUT DONT STEAL IT AND SAY ITS YOURS! Your cheating yourself, u lose respect, u know the deal...

  17. #42
    Join Date
    Mar 2008
    Location
    The Netherlands
    Posts
    1,395
    Mentioned
    1 Post(s)
    Quoted
    1 Post(s)

    Default

    Woo, I'm gonna use this in my Monk Killer + Healer *sets bar to 80%*


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

    Default

    nice tutorial man, helped me to understand some stuff of TPA/ATPA, Thanks!! =D

    +Rep

  19. #44
    Join Date
    Jun 2009
    Posts
    177
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    wow, powerful shit

    my own count-the-players-on-the-minimap function (made it for practice and because his seemed a little outdated--calling SplitTPA with only 1 arg?)

    Code:
    function CountPlayers : Integer;
    var
      WhiteDots : TPointArray;
      PlayerDots : T2DPointArray;
      SingleDot : TPoint;
      I, ArrayHigh : Integer;
    begin
      if FindColorsTolerance(WhiteDots, 16777215, MMX1, MMY1, MMX2, MMY2, 3) then
      begin
        PlayerDots := SplitTPA(WhiteDots, 9);
        ArrayHigh := High(PlayerDots);
        for I := 0 to ArrayHigh do
        begin
          SingleDot := MiddleTPA(PlayerDots[I]);
          MoveMouse(SingleDot.x, SingleDot.y);
          Wait(500);
        end;
        Result := High(PlayerDots) + 1;
      end
      else
      begin
          WriteLn('No players found');
          Result := 0;
      end;
    end;
    is the if-then necessary or will FindColorsTolerance just return an array with a high of 0?
    Last edited by LolL; 12-20-2010 at 10:39 PM. Reason: redid code

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

    Default

    Quote Originally Posted by LolL View Post
    wow, powerful shit

    my own count-the-players-on-the-minimap function (made it for practice and because his seemed a little outdated--calling SplitTPA with only 1 arg?)

    Code:
    function CountPlayers : Integer;
    var
      WhiteDots : TPointArray;
      PlayerDots : T2DPointArray;
      SingleDot : TPoint;
      I, ArrayHigh : Integer;
    begin
      if FindColorsTolerance(WhiteDots, 16777215, MMX1, MMY1, MMX2, MMY2, 3) then
      begin
        PlayerDots := SplitTPA(WhiteDots, 9);
        ArrayHigh := High(PlayerDots);
        for I := 0 to ArrayHigh do
        begin
          SingleDot := MiddleTPA(PlayerDots[I]);
          MoveMouse(SingleDot.x, SingleDot.y);
          Wait(500);
        end;
        Result := High(PlayerDots) + 1;
      end
      else
      begin
          WriteLn('No players found');
          Result := 0;
      end;
    end;
    is the if-then necessary or will FindColorsTolerance just return an array with a high of 0?
    Indeed it would return a length of '0'. Doesn't much matter either way though.

  21. #46
    Join Date
    Dec 2007
    Location
    Los Angeles, California
    Posts
    606
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Great tut, really helped me understand how everything really works instead of just using it and hoping it's right =p

  22. #47
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by n3ss3s View Post
    Number two - using TPAs in loops fast.

    Number one, don't do
    SCAR Code:
    For I := 0 To High(TPA) Do

    You can do that, but if you are fighting of milliseconds you need to do

    SCAR Code:
    Le := High(TPA);
      For I := 0 To Le Do

    That ways, it doesn't have to call High every time, and can save you tens of milliseconds.
    Does calling High really take any amount of time? I always thought functions like this would not even take 1 millisecond.

  23. #48
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by riwu View Post
    Does calling High really take any amount of time? I always thought functions like this would not even take 1 millisecond.
    I always thought that it did and then some members told me that it didn't, so I officially have no idea.

    Having said that, no harm in doing it I guess

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

    Default

    Quote Originally Posted by abu_jwka View Post
    I always thought that it did and then some members told me that it didn't, so I officially have no idea.

    Having said that, no harm in doing it I guess
    Decide for yourself.

    Simba Code:
    Procedure aaa;
    var
      i, t: Integer;
      hhh: Array [0..100] of TPoint;
    begin
      marktime(t);
      for i := 0 to high(hhh) do
      // for i := 0 to 100 do
      begin
        writeln(i);
      end;
      writeln(TimeFromMark(t));
    end;

  25. #50
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by Nebula View Post
    Decide for yourself.

    Simba Code:
    Procedure aaa;
    var
      i, t: Integer;
      hhh: Array [0..100] of TPoint;
    begin
      marktime(t);
      for i := 0 to high(hhh) do
      // for i := 0 to 100 do
      begin
        writeln(i);
      end;
      writeln(TimeFromMark(t));
    end;
    Yeah that was what i did ytd, there was no observable difference with anything below 100 (empty) loops (both took 0 milliseconds). Just tried again increasing the loop to 10k and there is actually a difference of ~15000 milliseconds in total, of which the increasing difficulty of High functions to count a larger number also attributes to its increasing significance.

    So basically dont bother with declaring another variable if your loop is under 100. Not common for a RS script to go over even 20 anyway. (and even if it's at 10k, it will only save u 1.5milliseconds/loop)

Page 2 of 3 FirstFirst 123 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Using Almighty TPA's for object finding
    By Timothegreat in forum OSR Advanced Scripting Tutorials
    Replies: 21
    Last Post: 11-04-2008, 06:02 PM
  2. RS Tutorial Bot
    By Jorogan in forum OSR Help
    Replies: 2
    Last Post: 11-25-2007, 01:47 AM
  3. need a tutorial
    By mark9510 in forum RS3 Outdated / Broken Scripts
    Replies: 12
    Last Post: 11-05-2007, 03:56 AM
  4. Replies: 8
    Last Post: 08-23-2007, 08:13 AM
  5. Array Tutorial - (Old Tutorial)
    By XxKanexX in forum Outdated Tutorials
    Replies: 1
    Last Post: 04-12-2006, 03:36 PM

Posting Permissions

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