
Originally Posted by
hoodz
I fixed a lot of errors, A LOT! The script is flawless but the monsterfinding function only uses the first color of the array so multipe colors dont work yet. Dont think i didnt do anything at all, i just dont get it working. Im also pretty new to scripting - started around 1 march. Some people offered me to help so the update will be fast. I cant promise a date but it will be fast.
Sorry for all the delay
ideally this would work. though the more colors you have, the more of a performance impact it will have. but that's true with everything
code is based off of Elfyyy's pc script, heavily modified by me
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;
how it works:
finds the first color(s), then creates a box where the first color(s) was found. at which point it proceeds to search for the secondary color(s) in that box. if the secondary color(s) are found, it will move the mouse to where the color was found, right click, attack.