That's kind of like what i'm doing for my find ent procedure. First I track the tree while a flag is present:
SCAR Code:
function UpdateXY:boolean;
begin
while (FlagPresent) do
begin
if (FindColorSpiralTolerance(x, y, TreeColor[0], x - 10, y - 10, x + 10, y + 10, 3))
or (FindColorSpiralTolerance(x, y, TreeColor[1], x - 10, y - 10, x + 10, y + 10, 3))
or (FindColorSpiralTolerance(x, y, TreeColor[2], x - 10, y - 10, x + 10, y + 10, 3)) then
Wait(50+random(10)) else
result := false;
end;
Wait(50);
if (FindColorSpiralTolerance(x, y, TreeColor[0], x - 15, y - 15, x + 15, y + 15, 3))
or (FindColorSpiralTolerance(x, y, TreeColor[1], x - 15, y - 15, x + 15, y + 15, 3))
or (FindColorSpiralTolerance(x, y, TreeColor[2], x - 15, y - 15, x + 15, y + 15, 3)) then
begin
result := true;
end else
if (FindColorSpiralTolerance(x, y, TreeColor[0], x - 30, y - 30, x + 30, y + 30, 3))
or (FindColorSpiralTolerance(x, y, TreeColor[1], x - 30, y - 30, x + 30, y + 30, 3))
or (FindColorSpiralTolerance(x, y, TreeColor[2], x - 30, y - 30, x + 30, y + 30, 3)) then
begin
result := true;
end else
result := false;
end;
Then my find ent procedure has coordinates to go off of to look for the tree colors. Except my find ent is triggered by a yellow npc dot showing up on the mm. (ents count as monsters therefore they show up on the mm as yellow dots) Then it moves to the x, y coordinates that were updated in the above function. If the up text is not the tree up text then it searches in a box around the x, y coords for the trees color moves the mouse to that point and checks the up text. With the correct up text it then searches for the yellow text and avoids the ent.
Here is the function, it is still not done:
SCAR Code:
function MyFindEnt:boolean; //looks for yellow npc dot color close to player
var // indicating an ent then searches for yellow text
I:integer;
begin
if (not (FindColor(x, y, 195836, MMCX - 12, MMCY - 12, MMCX + 12, MMCY + 12))) then
Result := False;
if (FindColor(x, y, 195836, MMCX - 12, MMCY - 12, MMCX + 12, MMCY + 12)) then
begin
if (FindNormalRandoms) then
Exit;
WriteLn('Found a yellow dot next to us...It might be an ent.');
MMouse(x, y, 2, 2);
if (not(IsUpText(TreeText))) then
begin
for I := 0 to 2 do
begin
if (FindColorSpiralTolerance(x, y, TreeColor[I], x-30, y-30, x+30, y+30, 7)) then
begin
MMouse(x, y, 1, 1);
if (IsUpText(TreeText)) then
Break;
end;
end;
end;
if (FindColorTolerance(x, y, 55769, 85, 15, 115, 15, 15)) then
begin
WriteLn('Found ENT!!! Avoiding it now.');
Mouse(MSCX, MSCY, 2, 2, true);
EntsAvoided := EntsAvoided + 1;
Result := True;
repeat
MarkTime(Mark);
Wait(500+random(500));
until (not (FindColor(x, y, 195836, MMCX-12, MMCY-12, MMCX+12, MMCY+12)))
or (TimeFromMark(Mark) > 25000);
end else
begin
WriteLn('Did not find an ent. It might have been an impling or ' +
'another players random. Worst case: we have a broken axe. :('); // <---- Add in procedure to find broken axe dtm
end;
end;
end;