[S]paz
2008-02-23 07:57:28
Ok, im trying to learn Tpa's, more specifically Tbox's
I read Infantry's tut on it and came up with this
i know this is kinda rubbishy but i cant get to grips with the whole tpa thing.
This is meant to find an iron ore filled rock, box the rock or most of it,
make a bitmap of that box and use that so prevent color changes and use a type of auto coloring.
could someone point me in the right direction concerning tpa's and tbox's cos i read n3ss and infantry's tut but im still like ???…..
thanks
~Spaz
I read Infantry's tut on it and came up with this
{.Include SRL/SRL.scar}
var
x, y : Integer;
MyTBox : TBox;
function FindColorInBox(x,y,color : integer) : boolean;
begin
MyTBox.x1 := x - 30;
MyTBox.y1 := y - 30;
MyTBox.x2 := x + 30;
MyTBox.y2 := y + 30;
if FindColor(x,y,color,MyTBox.x1,MyTBox.y1,MyTBox.x2,MyTBox.y2) then
result := true;
end;
Procedure FindColorBoxIt;
var
Tx, Ty, Rock : Integer;
begin
SetArrayLength(MyTBox,0)
If FindColorSpiralTolerance(x, y, 2370383, MSX1, MSY1, MSX2, MSY2, 5) then
GetMousePos(Tx, Ty);
If FindColorInBox(Tx, Ty, 2370383) then
begin
Rock := BitmapFromString(30, 30, '');
CopyClientToBitmap(Rock, 0, 0, 30, 30);
SetTargetBitmap(Rock);
end;
If FindBitmapIn(Rock, x, y, MSX1, MSY1, MSX2, MSY2) then
MMouse(x, y, 1, 1);
Writeln('Found Boxed Bitmap at '+IntToStr(Tx)+' X, and '+IntToStr(Ty)+' y.');
Terminatescript;
If Not FindBitmapToleranceIn(I, x, y, MSX1, MSY1, MSX2, MSY2, 5) then
Writeln(' NotFound');
Terminatescript;
end;
begin
FindColorBoxIt;
end.it complies but i always get a runtime error, Do i have to define my array?i know this is kinda rubbishy but i cant get to grips with the whole tpa thing.
This is meant to find an iron ore filled rock, box the rock or most of it,
make a bitmap of that box and use that so prevent color changes and use a type of auto coloring.
could someone point me in the right direction concerning tpa's and tbox's cos i read n3ss and infantry's tut but im still like ???…..
thanks
~Spaz