Results 1 to 9 of 9

Thread: Learning atpa's

  1. #1
    Join Date
    Dec 2011
    Posts
    353
    Mentioned
    3 Post(s)
    Quoted
    8 Post(s)

    Default Learning atpa's

    Simba Code:
    function FindRange(var x, y: Integer): Boolean;
    var
      TPA: TPointArray;
      ATPA: T2DPointArray;
      i, x1, y1: Integer;

    begin
      x1 := MSCX;
      y1 := MSCY;
      FindColorsSpiralTolerance(x1, y1, TPA, 5795972, MSX1, MSY1, MSX2, MSY2, 15);
      if Length(TPA) = 0 then FindColorsSpiralTolerance(x1, y1, TPA, 2704732, MSX1, MSY1, MSX2, MSY2, 15);
      ATPA := TPAtoATPA(TPA, High(TPA));
      for i := 0 to High(ATPA) do
        MMouse(ATPA[i].x, ATPA[i].y, 5, 5);// Error at this line.
        if (IsUpText('ption')) then
        begin
          result := true;
        end;
      end;
    end;

    Does it looks good its my first time ustin ATPA so im worried a bit also I GET THIS ERROR: [Error] (143:20): Semicolon (';') expected at line 142
    Compiling failed.

  2. #2
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Oh heh yeah, there's a couple things you need to learn about ATPAs to begin with. First off, an ATPA is an array of TPAs, so it's like a double array of points, if that makes any sense... So when you do something like this: "MMouse(ATPA[i].x, ATPA[i].y, 5, 5);" you're trying to move the mouse to 1 of those TPAs that exist in the ATPA.

    I'm gonna give you a link to the most helpful tutorial there is on TPAs and especially ATPAs. This tutorial will tell you everything you need to know about them and exactly how to use them. Also wonderful examples of use in Runescape.

    http://villavu.com/forum/showthread.php?t=49067

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  3. #3
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    Looking good!

    To fix the issue, under your "for i := 0 to High(ATPA) do" but a "begin"
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  4. #4
    Join Date
    Feb 2007
    Location
    Het ademt zwaar en moedeloos vannacht.
    Posts
    7,211
    Mentioned
    26 Post(s)
    Quoted
    72 Post(s)

    Default

    And use MiddleTPA on one of the TPA's that's part of the ATPA.
    I made a new script, check it out!.

  5. #5
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    Oh, and if you need to sort the closest one to a point:

    Code:
    SortATPAFrom(ATPA, Point(MSCX, MSCY));
    ^ Will sort the points from closest to your character, also, may not be exact code, just going from memory.
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  6. #6
    Join Date
    Dec 2011
    Posts
    353
    Mentioned
    3 Post(s)
    Quoted
    8 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    Oh heh yeah, there's a couple things you need to learn about ATPAs to begin with. First off, an ATPA is an array of TPAs, so it's like a double array of points, if that makes any sense... So when you do something like this: "MMouse(ATPA[i].x, ATPA[i].y, 5, 5);" you're trying to move the mouse to 1 of those TPAs that exist in the ATPA.

    I'm gonna give you a link to the most helpful tutorial there is on TPAs and especially ATPAs. This tutorial will tell you everything you need to know about them and exactly how to use them. Also wonderful examples of use in Runescape.

    http://villavu.com/forum/showthread.php?t=49067
    Thanks for the link

    Quote Originally Posted by Kyle Undefined View Post
    Looking good!

    To fix the issue, under your "for i := 0 to High(ATPA) do" but a "begin"
    Thanks lol stupid from me not to see this -.-

    Quote Originally Posted by Markus View Post
    And use MiddleTPA on one of the TPA's that's part of the ATPA.
    Oh ok ty.

  7. #7
    Join Date
    Sep 2007
    Location
    British Columbia, Canada
    Posts
    4,047
    Mentioned
    1 Post(s)
    Quoted
    2 Post(s)

    Default

    Ye like markus said, you need to use middletpa, because atpa[i] returns a tpoint array (which is lots lots of point) rather than just a tpoint.

    Very very nice start thou:P
    Change This
    Simba Code:
    MMouse(ATPA[i].x, ATPA[i].y, 5, 5);// Error at this line.

    to

    Simba Code:
    MMouse( MiddleTPA( ATPA[i]).x, MiddleATPA( ATPA[i]).y, 5, 5);
    Oh Hai Dar

  8. #8
    Join Date
    Dec 2011
    Posts
    353
    Mentioned
    3 Post(s)
    Quoted
    8 Post(s)

    Default

    Quote Originally Posted by Main View Post
    Ye like markus said, you need to use middletpa, because atpa[i] returns a tpoint array (which is lots lots of point) rather than just a tpoint.

    Very very nice start thou:P
    Change This
    Simba Code:
    MMouse(ATPA[i].x, ATPA[i].y, 5, 5);// Error at this line.

    to

    Simba Code:
    MMouse( MiddleTPA( ATPA[i]).x, MiddleATPA( ATPA[i]).y, 5, 5);
    Simba Code:
    function FindRange(var x, y: Integer): Boolean;
    var
      TPA: TPointArray;
      ATPA: T2DPointArray;
      i: Integer;
      PT: TPoint;

    begin
      FindColorsTolerance(TPA, 5795972, MSX1, MSY1, MSX2, MSY2, 5);
      if Length(TPA) = 0 then FindColorsTolerance(TPA, 2704732, MSX1, MSY1, MSX2, MSY2, 5);
      ATPA := TPAtoATPA(TPA, High(TPA));
      for i := 0 to High(ATPA) do
      begin
      PT := MiddleTPA(ATPA[i]);
      MMouse(PT.x, PT.y, 5, 5);
        if (IsUpText('ption')) then
        begin
          writeln('Found range');
          result := true;
        end;
      end;
    end;

    I made it like that is that ok?

  9. #9
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    ^ That will work fine, although I'm a little confused why you did this:
    Simba Code:
    ATPA := TPAtoATPA(TPA, High(TPA));

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


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
  •