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
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

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.
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

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.
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

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.
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

What are you trying to do?
Although that atpa name speaks to me, fire ... hmm ...
What I would do finding a fire:
I would write it more detailed but you must understand MiddleTPA from that.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;
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.
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

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

hmn no, its just 10 to 20 :'D...
There are currently 1 users browsing this thread. (0 members and 1 guests)