Originally Posted by
bg5
I would also recommend my AND_TPA plugin. It was made as a plugin due to large number of iterations, which would take Lape quite a lot of time. From what I know Aerolib also uses it. What's TColEx? Uhmm, looks familiar.
You could probably do the same just by making a copy of Aerolib's function and modifying it. But here is raw code from scratch:
I gonna use only AND_TPA and
this little include, because I'm familiar with it, but it's easy to transcript to Aerolib.
Simba Code:
program new;
{$include TCol.simba}
{$loadlib AND_TPA}
function FindDemon() : TPoint;
var
DemonCol1, DemonCol2 : TCol;
TPA1, TPA2 :TPointArray;
begin
DemonCol1.Create(792912, 13, 2, 0.16, 2.04);
DemonCol2.Create($FFFFF, 13, 2, 0.16, 2.04); // just define second color here
DemonCol1.FindTPA(TPA1,MSX1, MSY1, MSX2, MSY2);
DemonCol2.FindTPA(TPA2,MSX1, MSY1, MSX2, MSY2);
FilterTPADistTPA(TPA1 , 0 , 5 , TPA2);
// It means: Keep each Point in TPA1, which is in the distance of 0 to 5 to any Point from TPA2.
// Notice, that as an output you get only the part of TPA1, which was close to TPA2, so second colour is not included at all.
//Thus, it's recommended that first colour should be the one closest to center of object.
//
//If you would like to combine output from both colours you would need to do:
// FilterTPADistTPA(TPA2 , 0 , 5 , TPA1);
// AppendTPA(TPA1,TPA2);
//
// Now you can do your ATPA stuff
// ATPA := ClusterTPA(TPA, 3); ...
end;
begin
end.
Hey, I want to use this but I think Im doing something wrong. The script compiled successfully but wont find anything.
Code:
function Getdemonpos(var Position : TPoint): Boolean;
var
DemonCol1, DemonCol2 : TCol;
TPA, TPA1, TPA2 :TPointArray;
ATPA : T2DPointArray;
I : Integer;
begin
DemonCol1.Create(7445944, 56, 1, 8, 8);
DemonCol2.Create(4679031, 78, 1, 8, 9); // just define second color here
DemonCol1.FindTPA(TPA1,MSX1, MSY1, MSX2, MSY2);
DemonCol2.FindTPA(TPA2,MSX1, MSY1, MSX2, MSY2);
FilterTPADistTPA(TPA1 , 0 , 5 , TPA2);
ATPA := ClusterTPA(TPA1, 3);
FilterTPAsBetween(ATPA, 0, 400);
Result := (Length(ATPA) > 0);
if Result then
begin
if (Length(ATPA) > 1) then
SortATPASize(ATPA, True);
SortTPAFrom(ATPA[0], MiddleTPA(ATPA[0]));
I := Abs(iGaussRange(-High(ATPA[0]), High(ATPA[0])));
Position := ATPA[0][I];
end;
end;
function AttackedDemon() : Boolean;
var
DemonPos : TPoint;
begin
for 1 to 3 do
if GetDemonPos(DemonPos) and PointInBox(DemonPos, IntToBox(MSX1, MSY1, MSX2, MSY2)) then
begin
Mouse(DemonPos, 0, 0, Mouse_Move);
end else
Wait(Random(1300, 2450));
end;
begin
inital;
attackeddemon;
end.