Simba Code:
function FindMoss(LookForRedHpBar : Boolean) : Boolean;
var
TPA1, TPA2, TPA3, TPA4, TPA5, TPA6, TPA7, TPA8, TPA : TPointArray;
ATPA : Array of TPointArray;
RedHpBarDTM : Integer;
i, DetectTime, UptextTime, RedHpBarDTMTime : Integer;
ExcludeNearRedHpBAr : Boolean;
begin
MarkTime(DetectTime);
ExcludeNearRedHpBAr := False;
if LookForRedHPBar then //finding the red hpbar from the last fight then we exclude points around it to avoid to attack a dying monster
begin
RedHpBarDTM:= DTMFromString('mWAAAAHicY2FgYOBjZGDgAmJOKH0IKHYAiA8D8TEg3sfBwmDNzgTHrEAxZMyIhkEAABsyBO0=');
if FindDTM(RedHpBarDTM,X,Y,MSX1,MSY1,MSX2,MSY2) then
ExcludeNearRedHpBAr := True;
FreeDTM(RedHpBarDTM);
end;
RedHpBarDTMTime := TimeFromMark(DetectTime);
FindColorsTolerance(TPA1,3823447,MSX1,MSY1,MSX2,MSY2,12); //colors for Mossies
FindColorsTolerance(TPA2,5665130,MSX1,MSY1,MSX2,MSY2,12);
FindColorsTolerance(TPA3,2375742,MSX1,MSY1,MSX2,MSY2,9);
FindColorsTolerance(TPA4,2179404,MSX1,MSY1,MSX2,MSY2,8);
FindColorsTolerance(TPA5,2371894,MSX1,MSY1,MSX2,MSY2,11);
FindColorsTolerance(TPA6,1844005,MSX1,MSY1,MSX2,MSY2,8);
FindColorsTolerance(TPA7,4611177,MSX1,MSY1,MSX2,MSY2,8);
FindColorsTolerance(TPA8,1581349,MSX1,MSY1,MSX2,MSY2,10);
AppendTPA(TPA,TPA1);
AppendTPA(TPA,TPA2);
AppendTPA(TPA,TPA3);
AppendTPA(TPA,TPA4);
AppendTPA(TPA,TPA5);
AppendTPA(TPA,TPA6);
AppendTPA(TPA,TPA7);
AppendTPA(TPA,TPA8);
if (High(TPA)> 0) then
begin
if ExcludeNearRedHpBAr then
begin
SortTPAFrom(TPA,Point(X,Y));
InvertTPA(TPA);
for i:=0 to High(TPA) do
if (Abs(TPA[i].x - (X+30)) < 75) and (Abs(TPA[i].y - Y) < 75) then
Break;
SetArrayLength(TPA,i);
end;
//excluding points near middle
SortTPAFrom(TPA,Point(MSCX,MSCY));
InvertTPA(TPA);
for i:=0 to High(TPA) do
if (Abs(TPA[i].x - MSCX) < 30) and (Abs(TPA[i].y - MSCY) < 30) then
Break;
SetArrayLength(TPA,i);
ATPA := SplitTPA(TPA,10); //splitting TPAs
SortATPASize(ATPA,True);
for i:=0 to High(ATPA) do //excluding TPAs with less than 300 points
begin
if High(ATPA[i]) < 400 then
Break;
end;
SetArrayLength(ATPA,i);
if High(ATPA) < 1 then
Exit;
SortATPAFromFirstPoint(ATPA,Point(MSCX,MSCY)); //making the closest TPA the first in the array
if DebugTPAs then //DebugTPAs
DebugPoints(TPA,ATPA);
if DebugLines and (High(ATPA) > 0) then //DebugLines
begin
Writeln('[Mosses] (400)');
for i:=0 to High(ATPA) do
Writeln('-'+IntToStr(High(ATPA[i])));
end;
if MiddleTPAEx(ATPA[0],X,Y) then //getting the middle point of the TPA, moving mouse there then looking for uptext
begin
MMouse(X,Y,0,0);
MarkTime(UptextTime);
if WaitUpText('ttack',400) then
begin
if DebugLines then //DebugLines
Writeln('Found Moss in ' + IntToStr(TimeFromMark(DetectTime)) + ' ms. Uptext was ' + IntToStr(TimeFromMark(UptextTime)) + ' ms. RedTime was ' + IntToStr(RedHpBarDTMTime) + ' ms.');
Result := True;
Exit;
end;
end;
end;
Result := False;
end;