Simba Code:
procedure FindMonster;
var
FoundMonster:Boolean;
x, y, i, _i, j, ColorTolerance:Integer;
Monster1TPA, Monster2TPA:TPointArray;
MonsterATPA:T2DPointArray;
MonsterBox:TBox;
MonsterColor1, MonsterColor2:TIntegerArray;
MSCTP:TPoint;
begin
ColorTolerance := 5;
MSCTP := Point(MSCX, MSCY);
MonsterColor1 := ([6136697]); // initial color of the creature (in this case goblin. green)
MonsterColor2 := ([7965847,2453907,11250614]); // secondary color of the creature, to refine the search and make sure it's the right monster (in this case goblin. grey, silver, brown)
repeat
for i:=0 to high(MonsterColor1) do
begin
if findcolorstolerance(Monster1TPA, MonsterColor1[i], MSX1, MSY1, MSX2, MSY2, ColorTolerance) then
begin
MonsterATPA := SplitTPAEx(Monster1TPA, 30, 30);
SortATPAFrom(MonsterATPA, MSCTP);
for j := 0 to high(MonsterATPA) do
begin
MonsterBox := GetTPABounds(MonsterATPA[j]);
for _i:=0 to high(MonsterColor2) do
begin
if findcolorstolerance(Monster2TPA, MonsterColor2[_i], Monsterbox.x1-10, Monsterbox.Y1-10, Monsterbox.X2+10, Monsterbox.Y2+10, ColorTolerance) then
begin
mmouse(Monster2TPA[0].x,Monster2TPA[0].y,2,2);
wait(RandomRange(50,100));
if (isUpText(MonsterName)) then
begin
ClickMouse2(mouse_right);
Wait(RandomRange(40,70));
if (WaitOptionEx('ttack', 'npc', ClickLeft, RandomRange(20,140))) then
begin
FoundMonster := True;
exit;
end;
end;
end;
end;
end;
end;
end;
until (FoundMonster);
end;