Results 1 to 8 of 8

Thread: Is this correct? [ATPA]

  1. #1
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Is this correct? [ATPA]

    Just made my first TPA/ATPA function thanks to NKN's tut! It works pretty well, getting to the correct spot after ~2-3 mouse movements, ill just have to adjust the color to fix that, but I was wondering If I had formatted everything correctly, and if I did it how its supposed to be done.
    Simba Code:
    program ATPATesting;
    {$i srl/srl.simba}

    var
      x, y:integer;
    Function FindBankCustom(var x, y:integer):boolean;
    var
      Sex, SeY, i, Counter:Integer;
      BankTPA:TPointArray;
      BankATPA : T2DPointArray;
    begin
      FindColorsSpiralTolerance(SeX, SeY, BankTPA, 4412773, MSX1, MSY1, MSX2 - 10, MSY2, 12);
      BankATPA := SplitTPA(BankTPA, 8);
      for i := 0 to high(BankATPA) do
        begin
          if MiddleTPAEX(BankATPA[i], SeX, SeY) then
            Mmouse(SeX, SeY, 3, 3);
            wait(randomrange(150, 400));
            if IsUptextMultiCustom(['Bank Bank', 'Bank ban', 'ank Ban']) then
              begin
                writeln('Bank found!');
                x := SeX;
                y := SeY
                Result := true;
                Exit;
              end;
        end;



    end;
    begin
      SetupSRL
      FindBankCustom(x, y);
      Clickmouse2(mouse_left);
    end.
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  2. #2
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    No. You need begins and ends before the MMouse and one to match respectively.

    Also you may want to avoid some overhead.. you shouldn't do: for i := 0 to high(BankATPA) do

    instead do: L := High(BankATPA) then do: for i := 0 to L do. That way the computer doesn't have to calculate what HighATPA is all the time.

    The only exception to this should be when you can guarantee that the ATPA will be modified in some way (not constant).
    I am Ggzz..
    Hackintosher

  3. #3
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    If I understood you correctly, this is what you mean?
    Simba Code:
    program ATPATesting;
    {$i srl/srl.simba}

    var
      x, y:integer;
    Function FindBankCustom(var x, y:integer):boolean;
    var
      Sex, SeY, i, Counter:Integer;
      BankTPA:TPointArray;
      BankATPA : T2DPointArray;
    begin
      FindColorsSpiralTolerance(SeX, SeY, BankTPA, 4412773, MSX1, MSY1, MSX2 - 10, MSY2, 12);
      BankATPA := SplitTPA(BankTPA, 8);
      L := High(BankATPA)
      for i := 0 to L do
        begin
          if MiddleTPAEX(BankATPA[i], SeX, SeY) then
            begin
              Mmouse(SeX, SeY, 3, 3);
              wait(randomrange(150, 400));
              if IsUptextMultiCustom(['Bank Bank', 'Bank ban', 'ank Ban']) then
                begin
                  writeln('Bank found!');
                  x := SeX;
                  y := SeY
                  Result := true;
                  Exit;
              end;
            end;
        end;



    end;
    begin
      SetupSRL
      FindBankCustom(x, y);
      Clickmouse2(mouse_left);
    end.
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  4. #4
    Join Date
    Mar 2012
    Location
    Canada
    Posts
    870
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by Footy View Post
    If I understood you correctly, this is what you mean?
    Yep that's it.


    You'll see, once you learn and understand TPA better, you'll want to use them for almost everything on the mainscreen.
    My scripts:
    Advanced Barb Agility Course(outdated), MonkeyThieverV0.11, MahoganyTableV0.4(outdated)
    Questions? I bet that for 98% of those, you'll find answer HERE

  5. #5
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Already kind of falling in love with it! It makes finding objects on the MS sooo much easier!
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  6. #6
    Join Date
    Dec 2011
    Location
    The Netherlands
    Posts
    1,631
    Mentioned
    47 Post(s)
    Quoted
    254 Post(s)

    Default

    Quote Originally Posted by Footy View Post
    Already kind of falling in love with it! It makes finding objects on the MS sooo much easier!
    Yup

    I would personally make some small changes:
    Simba Code:
    function FindBank: Boolean;

    var
      X, Y, i, Counter: Integer;
      BankTPA: TPointArray;
      BankATPA: T2DPointArray;

    begin
      FindColorsSpiralTolerance(X, Y, BankTPA, 4412773, MSX1, MSY1, MSX2 - 10, MSY2, 12);
      SplitTPAExWrap(BankTPA, width, height, BankATPA);
      for i := 0 to High(BankATPA) do
      begin
        if (MiddleTPAEX(BankATPA[i], X, Y)) then
        begin
          MMouse(X, Y, RandomRange(-3, 3), RandomRange(-3, 3));
          if (WaitUptextMulti(['ank', 'Bank']) then
          begin
            WriteLn('Bank found!');
            Result := True;
            Break;
          end;
        end;
      end;
    end;
    Should compile. Good job so far

    Script source code available here: Github

  7. #7
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by J J View Post
    Yup

    I would personally make some small changes:
    Simba Code:
    function FindBank: Boolean;

    var
      X, Y, i, Counter: Integer;
      BankTPA: TPointArray;
      BankATPA: T2DPointArray;

    begin
      FindColorsSpiralTolerance(X, Y, BankTPA, 4412773, MSX1, MSY1, MSX2 - 10, MSY2, 12);
      SplitTPAExWrap(BankTPA, width, height, BankATPA);
      for i := 0 to High(BankATPA) do
      begin
        if (MiddleTPAEX(BankATPA[i], X, Y)) then
        begin
          MMouse(X, Y, RandomRange(-3, 3), RandomRange(-3, 3));
          if (WaitUptextMulti(['ank', 'Bank']) then
          begin
            WriteLn('Bank found!');
            Result := True;
            Break;
          end;
        end;
      end;
    end;
    Should compile. Good job so far
    What exactly does SplitTPAExWrap do? whats the difference between it and what i used? Thanks for the feedback everyone!
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

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

    Default

    Quote Originally Posted by Footy View Post
    What exactly does SplitTPAExWrap do? whats the difference between it and what i used? Thanks for the feedback everyone!
    SplitTpa splits the point in a circular manner (with radius=Dist) while the Ex version does it in a box manner.

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
  •