Results 1 to 13 of 13

Thread: TpaToAtpaEx - Remove Certain squares

  1. #1
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default TpaToAtpaEx - Remove Certain squares

    Hey .

    Is it possible to remove squares, that TpaToAtpaEx generated if they dont have a minimum size or are too big ?.

    Is there a function that does that ?

    ~caused

  2. #2
    Join Date
    Feb 2009
    Location
    Hungary (GMT + 1)
    Posts
    1,774
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I would just check with an if statement that does it got any color and not more then we want. Right when we are using it. So if you use it in a loop and we gott too much or too less color in the current ATPA just continue.
    Maybe SortATPA before it.

  3. #3
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    Sorting is a good idea. But I'd like to crop the squares that are not neccessary.

    Seems like i need to write my own function for that : O.

    ~caused

  4. #4
    Join Date
    Feb 2009
    Location
    Hungary (GMT + 1)
    Posts
    1,774
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    No!

    I have written something. Not finished but I can't let you to do it! lol

    SCAR Code:
    function namehere(var ATPA: T2DPointArray; MinSize, MaxSize: Integer): T2DPointArray;

    var
      H, L, O, I: Integer;
     
    begin
      H := High(ATPA);
      for I := 0 to H do
      begin
        L := Length(ATPA[I]);
        if (L <= minsize) or  (L >= maxsize) then Continue;
        SetLength(Result, O + 1);
        Result[O] := ATPA[I];
        Inc(O);
      end;
    end;

    It can maybe made quicker with sorting at the beginning. Maybe. Or it would just make it slower. But you get the idea, right? And it may even work :P
    Last edited by Sabzi; 08-31-2009 at 02:09 AM.

  5. #5
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    Awesome ! : D.

    Now how do i find the middle of one of those squares ?

    I guess i need to write my own function for that *rollseyes* .

    Hmn. This shall result the middle of an atpa square ?
    (filteredfires is my atpa)

    ((abs(filteredfires[0][1].x - filteredfires[0][0].x)/2)+filteredfires[0][0].x)


    ~caused

  6. #6
    Join Date
    Feb 2009
    Location
    Hungary (GMT + 1)
    Posts
    1,774
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    What, what?
    Use MiddleTPA or MiddleTPAEx for ATPA[0] and so on in a loop.
    Oh, man! I forgot something!
    Naumanaqlaletgsgiun, spelling is okay, right?
    Look in his Wizzy? plugin tutorial!

    EDIT:I really hope senrath won't show us a function like this from srl.
    Last edited by Sabzi; 08-31-2009 at 02:26 AM.

  7. #7
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    MiddleTpa Does work for ATPAS ?

    Sorry im kinda confused now : D. Can you show me how ?

    I thought in an ATPA it would be
    bla[squarenumber][coords]

    that would result in MiddleTPAEx to not work, cause it would somehow middle the amount of squares ?

    ~caused

  8. #8
    Join Date
    Feb 2009
    Location
    Hungary (GMT + 1)
    Posts
    1,774
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    What are you trying to do?
    Although that atpa name speaks to me, fire ... hmm ...
    What I would do finding a fire:
    SCAR Code:
    for I := 0 to H do  //(H = High(ATPA))
    begin
      MiddleTPAEx(ATPA[I], x, y);
      Mouse there;
      Super leet trick and etc, bla.
    end;
    I would write it more detailed but you must understand MiddleTPA from that.

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

    I can show you an example from my aircrafter.
    SCAR Code:
    function FindAltarIn(var x, y: Integer) : Boolean;

    var
      AltarColors: TPointArray;
      AltarColor: T2DPointArray;
      i, ArrayLength, fst: Integer;

    begin
      FindColorsSpiralTolerance(MSCX, MSCY, AltarColors, FindAltarColor, MSX1, MSY1, MSX2, MSY2, 5);
      AltarColor := TPAtoATPA(AltarColors, 200);
      if Length(AltarColor) = 0 then HandlePlayer2('Altarcolor was not found', 'Stucked inside the altar.');
      SortATPASize(AltarColor, True);
      ArrayLength := High(AltarColor);
      MarkTime(fst);
      for i := 0 to ArrayLength do
      begin
        AntiR;
        if TimeFromMark(fst) > 5000 then Break;
        MiddleTPAEx(AltarColor[i], x, y);
        MMouse(x, y, 5, 5);
        if WaitUptext('raft', 500) then
        begin
          Result := True;
          GetMousePos(x, y);
          Exit;
        end;
      end;
      Result := False;
    end;

    Although, I may completely misunderstand you XD
    Last edited by Sabzi; 08-31-2009 at 02:38 AM.

  9. #9
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    I'm not sure WHY you'd want to find the middle of an ATPA, but here is something I whipped up just now that should do just that:
    SCAR Code:
    function MiddleATPA(ATPA: T2DPointArray): TPoint;
    var
      TempArray: TPointArray;
      I, H: Integer;
    begin
      H := High(ATPA);
      SetLength(TempArray, H + 1);
      for I := 0 to H do
        TempArray[I] := MiddleTPA(ATPA[I]);
      Result := MiddleTPA(TempArray);
    end;

    And don't worry Sabzi, I couldn't find anything in SRL itself to do what your function does :P

  10. #10
    Join Date
    Feb 2009
    Location
    Hungary (GMT + 1)
    Posts
    1,774
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by senrath View Post
    I'm not sure WHY you'd want to find the middle of an ATPA, but here is something I whipped up just now that should do just that:
    SCAR Code:
    function MiddleATPA(ATPA: T2DPointArray): TPoint;
    var
      TempArray: TPointArray;
      I, H: Integer;
    begin
      H := High(ATPA);
      SetLength(TempArray, H + 1);
      for I := 0 to H do
        TempArray[I] := MiddleTPA(ATPA[I]);
      Result := MiddleTPA(TempArray);
    end;

    And don't worry Sabzi, I couldn't find anything in SRL itself to do what your function does :P
    Yay, now I understand from that code what caused wanted to do.
    And I hoped you won't find a function because I have searched for it too. Well, just in my head.

  11. #11
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    ah, stupid me, i got it now :O.

    Though i dont understand your function, sabzi. :O.

    I want a function that removes areas that are larger or smaller than a certain size.
    Also, i always get "out of range" @ "Inc(O);" when i try your function |D

  12. #12
    Join Date
    Feb 2009
    Location
    Hungary (GMT + 1)
    Posts
    1,774
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by caused View Post
    ah, stupid me, i got it now :O.

    Though i dont understand your function, sabzi. :O.

    I want a function that removes areas that are larger or smaller than a certain size.
    Also, i always get "out of range" @ "Inc(O);" when i try your function |D
    Lol that must mean you got loads of atpa, right?
    Either try a bigger area in TPAtoATPAEx or just make O an Int64 or whatever it is.
    OR my function is baaad. <- 99%
    We must consult on msn or something, this thread is really filling up. Feel free to add me in msn.

  13. #13
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    hmn no, its just 10 to 20 :'D...

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
  •