Simba Code:
{$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,X,Y: Integer;
begin
Result := False;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.00, 0.00);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 594520, 0, 0, 514, 338, 2);
SetColorSpeed2Modifiers(0.00, 0.00);
if (Length(TPA) < 1) then
Exit;
ATPA := TPAToATPAEx(TPA, 120, 120);
filterTPAsBetween(ATPA, 1, 120)
SortATPAFromFirstpoint(ATPA, Point(MSCX, MSCY));
for i := 0 to High(ATPA) do
begin
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;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 1.82);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 1451877, cage.x1, cage.y1, cage.x2, cage.y2, 10);
SetColorSpeed2Modifiers(0.00, 0.00);
if (Length(TPA) < 1) then Exit;
NPC_ATPA := TPAToATPAEx(TPA, 40, 40);
filterTPAsBetween(NPC_ATPA, 1, 5)
SortATPAFromFirstpoint(ATPA, Point(MSCX, MSCY));
debugATPABounds(NPC_ATPA);
for i := 0 to High(NPC_ATPA) do
begin
debugATPABounds(NPC_ATPA);
if WaitUpTextMulti(['ank', 'eposite'], 600) then
begin
MiddleTPAEx(NPC_ATPA[i], X, Y);
mmouse(x,y,1,1);
Result := true;
end;
end;
end;
begin
SetupSRL;
FindCage;
FindDemon;
end.