Results 1 to 5 of 5

Thread: TPA's...

  1. #1
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default TPA's...

    I've read like all possible tutorials on TPA's on the forums.. and so far I can understand most of it, but there remains one thing I can't get... How do I get the correct point? If there's like 300 points in the TPA, how to get the exact point that e.x the object is on.
    Ce ne sont que des gueux


  2. #2
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    Well, I'm no expert at TPAs but I know the foundation stuff.

    If you set the size of the TPA using this function:
    SCAR Code:
    TPAtoATPAEx({TPA: TPointArray}, {width: LongInt}, {height: LongInt});

    After you've found your colour, then it will only find objects that are atleast the size you specify.

    Then when you want to check whether its the object you are looking for just use something simple like IsUpText or IsUpTextMulti.

    Sometimes I find having an example helps, so this is the one for the fountain in my clay softner, its not great but oh well:

    SCAR Code:
    Function LocateFountain:Boolean;
    Var
      TPA: TPointArray;
      Temp: T2DPointArray;
      h, x, y, z, t, i: Integer;
    begin
      If not LoggedIn then
      Exit;
      If Players[CurrentPlayer].Loc = 'bank' then Exit;
      DTMs;
      If FindDTM(EmptyBucket, x, y, MIX1, MIY1, MIX2, MIY2) then
      Begin
        Mouse(x, y, 5, 5, true);//Important stuff starts here
        t := GetSystemTime;
        ColorToleranceSpeed(2);
        FindColorsSpiralTolerance(x, y, TPA, 14066055, MSX1, MSY1, MSX2, MSY2, 19);
        Temp := TPAtoATPAEx(TPA, 40, 40);
        SortATPASize(Temp, True);
        h := High(Temp);
        For z := 0 to h do
        Begin
          MiddleTPAex(Temp[z], x, y);
          MMouse(x, y, 5, 5);
          i := 0;
          AntiRandoms;
          Repeat
            Wait(50+random(20));
            i := i + 1;
            AntiRandoms;
          Until IsUpText('ountain') or (i = 25);
          Result := IsUpText('ountain');
          If Result then
            break;
          Wait(100);
        end;
        If Result then
        Begin
          GetMousePos(x, y);
          Mouse(x, y, 0, 0, True);
          WriteLN('Found the fountain in '+IntToStr(((GetSystemTime) - t)- 100)+' msecs');
        end;                             //Important stuff ends here
        If (i = 25) then
        Begin
          AntiRandoms;
          WriteLN('Couldn'#39't find the fountain');
          Logout;
        end;
        AntiBan;
        MarkTime(t)
        Repeat
          Wait(1000+random(2000));
          AntiRandoms;
        Until(Not(FindDTM(EmptyBucket, x , y, MIX1, MIY1, MIX2, MIY2))) or (TimeFromMark(t) >= 25000);
        FreeDTMs;
      end;
    end;

    Ignore all the irelavent stuff like the DTMs and the waiting and its quite easy to pick apart.

  3. #3
    Join Date
    Feb 2007
    Location
    Access Violation at 0x00000000
    Posts
    2,865
    Mentioned
    3 Post(s)
    Quoted
    18 Post(s)

    Default

    For TPAtoATPAEx, how do you know the width/height? Is it in pixels or something?
    Ce ne sont que des gueux


  4. #4
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    Yeah its measured the same way that it is for everything else, like to know the size of the screen

  5. #5
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    Quote Originally Posted by Floor66 View Post
    I've read like all possible tutorials on TPA's on the forums.. and so far I can understand most of it, but there remains one thing I can't get... How do I get the correct point? If there's like 300 points in the TPA, how to get the exact point that e.x the object is on.
    If you have 300 points that are all of the object, you can take the average point.
    Using MiddleTPA(). If ``most'' points belong to the object, but not all, first SplitTPA is, and then SortATPASize(True). Then then ATPA[0] will be the one with the most points, thus the points of your Object. MiddleTPA(ATPA[0]);



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Grouping TPA's
    By nielsie95 in forum OSR Advanced Scripting Tutorials
    Replies: 9
    Last Post: 12-10-2008, 05:56 AM
  2. Tpa's
    By lVlaverick in forum OSR Help
    Replies: 3
    Last Post: 09-13-2008, 06:14 PM
  3. TPA's explained.
    By mastaraymond in forum OSR Advanced Scripting Tutorials
    Replies: 18
    Last Post: 08-28-2008, 04:16 PM
  4. Function help with TPA's
    By FuruChan in forum OSR Help
    Replies: 5
    Last Post: 06-28-2008, 11:44 AM

Posting Permissions

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