What does it do?
You put in a TPointArray.
It takes the outer points of the TPointArray, uses that box to copy that part from the client to your bitmap, set's all the points in the TPA red on that Bitmap and Draws the bitmap on the debug image.
Has the option to save the file in your scriptpath.
Make the name '' if you don't want it to save the Bitmap
SCAR Code:
Function DebugTPA(Points: TPointArray; BmpName: String): Boolean;
Var
Width, Height, ClientBMP, I, L: Integer;
xs, ys, xe, ye: Integer;
Begin
Try
Begin
xe := xs xor xs;
ye := ys xor ys;
xs := 1 shl 20;
ys := 1 shl 20;
For I := 0 To High(Points) Do
Begin
xs := Min(xs, Points[I].X);
ys := Min(ys, Points[I].Y);
xe := Max(xe, Points[I].X);
ye := Max(ye, Points[I].Y);
End;
Width := xe - xs;
Height := ye - ys;
DisplayDebugImgWindow(0, 0);
DisplayDebugImgWindow(Width, Height);
ClientBMP := BitmapFromString(Width, Height, '');
CopyClientToBitmap(ClientBMP, xs, ys, xe, ye);
For I := 0 To High(Points) Do
FastSetPixel(ClientBMP, Points[I].X - xs, Points[I].Y - ys, 255);
If BmpName <> '' Then
SaveBitmap(ClientBMP, ScriptPath + BmpName + '.bmp');
SafeDrawBitmap(ClientBMP, GetDebugCanvas, 0, 0);
DisplayDebugImgWindow(Width, Height);
FreeBitmap(ClientBMP);
End
Except
FreeBitmap(ClientBMP);
End;
Result := True;
End;
How do you use this?
SCAR Code:
Function IsFishRod: Boolean;
Var
x, y, z: Integer;
Ar: TPointArray;
Begin
If Not LoggedIn Then Exit;
GameTab(4);
Result := FindColor(x, y, FishingRodColor, MIX1, MIY1, MIX2, MIY2);
If Result Then Exit;
If FindBitmapToleranceIn(FishingRod, x, y, MIX1, MIY1, MIX2, MIY2, 50) Then
Begin
z := GetColorToleranceSpeed;
Result := True;
FishingRodColor := GetColor(x, y);
ColorToleranceSpeed(2);
FindColorsTolerance(Ar, FishingRodColor, x - 20, y - 20, x + 20, y + 20, 25);
ColorToleranceSpeed(z);
DebugTPA(Ar, 'InvRod'); // HERE.
FishRodColors := GetColors(Ar);
ShrinkArray(FishRodColors);
WriteLn('FishingRodColor: ' +IntToStr(FishingRodColor));
End;
End;
SCAR Code:
Function DebugATPA(aPoints: Array Of TPointArray; BmpName: String): Boolean;
Var
Width, Height, ClientBMP, I, L, C, Col: Integer;
xs, ys, xe, ye: Integer;
OuterPoints: TPointArray;
Begin
For I := 0 To High(aPoints) Do
L := L + Length(aPoints[I]);
SetLength(OuterPoints, L + 1);
C := 0;
For I := 0 To High(aPoints) Do
For L := 0 To High(aPoints[I]) Do
Begin
C := C + 1;
OuterPoints[C] := aPoints[I][L];
End;
Try
Begin
xe := xs xor xs;
ye := ys xor ys;
xs := 1 shl 20;
ys := 1 shl 20;
For I := 0 To High(OuterPoints) Do
Begin
xs := Min(xs, OuterPoints[I].X);
ys := Min(ys, OuterPoints[I].Y);
xe := Max(xe, OuterPoints[I].X);
ye := Max(ye, OuterPoints[I].Y);
End;
Width := xe - xs;
Height := ye - ys;
DisplayDebugImgWindow(0, 0);
DisplayDebugImgWindow(Width, Height);
ClientBMP := BitmapFromString(Width, Height, '');
CopyClientToBitmap(ClientBMP, xs, ys, xe, ye)
For I := 0 To High(aPoints) Do
Begin
Col := Random(16777215);
For L := 0 To High(aPoints[I]) Do
FastSetPixel(ClientBMP, aPoints[I][L].X - xs, aPoints[I][L].Y - ys, Col);
End;
SafeDrawBitmap(ClientBMP, GetDebugCanvas, 0, 0);
DisplayDebugImgWindow(Width, Height);
If BmpName <> '' Then
SaveBitmap(ClientBMP, ScriptPath + BmpName + '.bmp');
FreeBitmap(ClientBMP);
End
Except
FreeBitmap(ClientBMP);
End;
Result := True;
End;
Few TPA examples:
http://82.92.130.193/Pictures/InvRod.bmp
http://82.92.130.193/Pictures/Fishing.bmp
http://82.92.130.193/Pictures/Spot.bmp
aTPA example:
http://82.92.130.193/Pictures/coal.bmp
~ Wizzup?