From: Ollybest
That isn't in ps (at least in 992)
procedure filterTPAsBetween(var atpa: T2DPointArray; len1, len2: integer);
var
h, l, i: integer;
c: T2DPointArray;
begin
h := high(atpa);
for i := 0 to h do
begin
l := length(atpa[i]);
if (not (inRange(l, len1, len2))) then
begin
setLength(c, length(c) + 1); // could be done way more efficiency but meh.
c[high(c)] := atpa[i];
end;
end;
atpa := c;
end;
I figured it would be in lape, but there is a problem now, it cannot find the object within the box, but I know the object exists because I have a high tolerance.
{$I SRL-OSR/SRL.Simba}
{$I SRL/SRL/Misc/Debug.simba}
Var
cage: TBox;
ATPA: T2DPointArray;
procedure filterTPAsBetween(var atpa: T2DPointArray; len1, len2: integer);
var
h, l, i: integer;
c: T2DPointArray;
begin
h := high(atpa);
for i := 0 to h do
begin
l := length(atpa[i]);
if (not (inRange(l, len1, len2))) then
begin
setLength(c, length(c) + 1);
c[high(c)] := atpa[i];
end;
end;
atpa := c;
end;
Function FindCage: Boolean;
var
TPA,TPA2: TPointArray;
i,CTS,X,Y: Integer;
begin
Result := False;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.00, 0.00);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 594520, 0, 0, 514, 338, 8);
SetColorSpeed2Modifiers(0.02, 0.02);
ColorToleranceSpeed(CTS);
if (Length(TPA) < 1) then
Exit;
ATPA := TPAToATPAEx(TPA, 120, 120);
SortATPAFromFirstpoint(ATPA, Point(MSCX, MSCY));
for i := 0 to High(ATPA) do
begin
filterTPAsBetween(ATPA, 1, 8)
debugATPABounds(ATPA);
cage := GetTPABounds(ATPA[i]);
result := true;
end;
end;
Function FindDemon: Boolean;
var
cage: TBox;
TPA: TPointArray;
i,CTS,X,Y: Integer;
NPC_ATPA: T2DPointArray;
h:TPoint;
begin
Result := False;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.15, 1.94);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 662873, cage.x1, cage.y1, cage.x2, cage.y2, 11);
SetColorSpeed2Modifiers(0.02, 0.02);
ColorToleranceSpeed(CTS);
if (Length(TPA) < 1) then Exit;
NPC_ATPA := TPAToATPAEx(TPA, 40, 40);
SortATPAFromFirstpoint(ATPA, Point(MSCX, MSCY));
debugATPABounds(NPC_ATPA);
for i := 0 to High(NPC_ATPA) do
begin
filterTPAsBetween(NPC_ATPA, 1, 5)
debugATPABounds(NPC_ATPA);
if WaitUpTextMulti(['', ''], 600) then
begin
MiddleTPAEx(NPC_ATPA[i], X, Y);
Result := true;
end;
end;
end;
begin
SetupSRL;
FindCage;
FindDemon;
end.
I have not added for it to move the mouse to the object yet, just trying to see if it will find it.