NiCbaZ
2008-09-12 05:00:51
Please done flame, ive never really been good at TPA's ive understand
them but never Really got the grip of them, i know this is probably nt very good for an SRL member but w/e.
Its great for Dubugging Because of Wizzups great Draw TPA Function!!
them but never Really got the grip of them, i know this is probably nt very good for an SRL member but w/e.
Its great for Dubugging Because of Wizzups great Draw TPA Function!!
program New;
{.include SRl/SRl.scar}
{*******************************************************************************
Function DebugATPA(aPoints: T2DPointArray; BmpName: String): Boolean;
By: Wizzup? Smally Edited by Nicbaz
Description: Draws a T2DPointArray on the debug canvas.
*******************************************************************************}
procedure DebugATPA(aPoints: T2DPointArray; BMPName: string);
var
ClientBMP, Hi, Hi2, I, Col, I2: Integer;
B: TBox;
Begin
B := GetATPABounds(aPoints);
DisplayDebugImgWindow(B.x2 - B.x1, B.y2 - B.y1);
ClientBMP := BitmapFromString(B.x2 - B.x1, B.y2 - B.y1, '');
CopyClientToBitmap(ClientBMP, B.x1, B.y1, b.x2, b.y2);
Hi := High(aPoints);
for I := 0 to Hi do
begin
Col := Random(839894);
Hi2 := High(aPoints[i]);
for I2 := 0 to Hi2 do
FastSetPixel(ClientBMP, aPoints[i][I2].X - b.x1, aPoints[i][I2].Y - b.y1, Col);
end;
SafeDrawBitmap(ClientBMP, GetDebugCanvas, 0, 0);
try
FreeBitmap(ClientBMP);
except
end;
end;
Function FindTPA(Uptex:string; Colors: TIntegerArray; Tol,
ObjWidth, ObjHeight:Integer): Boolean;
Var
TPAs: TPointArray;
TPA: Tpoint;
D2TPA: T2DPointArray;
X,Y,I,N: Integer;
Begin
n := Length(Colors) - 1;
for i := 0 to n do
FindColorsSpiralTolerance(x,y,TPAs,Colors[i],MMX1, MMY1, MMX2,MMY2,30);
If length(TPAs) = 0 Then
Exit;
D2TPA:= TPAtoATPAEx(TPAs,ObjHeight,ObjWidth);
For i:= 0 to length(D2TPA) - 1 Do
begin
TPA:= MiddleTPA(D2TPA[i]);
DebugATPA(D2TPA,'TPA');
MMouse(TPA.X, TPA.Y, 0, 0);
Wait(150 + Random(50));
If IsUpText(UpTex) Then
begin
X:= TPA.X
Y:= TPA.Y
Result:= True;
end;
end;
end;
begin
SmartSetUp('world16',true,true,false);
wait(2000);
SetTargetDC(SmartGetDC);
SetupSRL;
FindTPA('df',[(8108767)],10,30,30);
end.