
Originally Posted by
Le Jingle
Not sure if this is the end-goal you're looking for or not, but from mustering up some code on the tired/sluggish brain of mine (at the moment), I think this may help point you (at minimum)
so it found the judge but it would never click him, it would mouse over him then go to my inv tab and keep hovering around the tab. definetly helpful though. how do know what size or length of a ATPA you are looking for?? like 'if (Length(ATPA) < 1) then' what does that mean?
Simba Code:
function Start_Comp(): Boolean; // result in a boolean type, because it is useful to know if we talked to the NPC or not
var
i, t, TempCTS: Integer;
OldHue, OldSat: Extended;
Pt: TPoint;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
Result := False;
// Save old CTS 2 stuffs, then setup the new stuffs to seach with
TempCTS := GetColorToleranceSpeed();
GetColorspeed2Modifiers(OldHue, OldSat);
ColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.00, 0.11);
// tpa search + length check for inadequate results
FindColorsTolerance(TPA, 6774623, MSX1, MSY1, MSX2, MSY2, 12);
if (Length(TPA) < 1) then
begin
ColorToleranceSpeed(TempCTS);
SetColorspeed2Modifiers(OldHue, OldSat);
end;
// atpa split + length check for inadequate results
SplitTPAExWrap(TPA, 7, 5, ATPA);
if (Length(ATPA) < 1) then
begin
ColorToleranceSpeed(TempCTS);
SetColorspeed2Modifiers(OldHue, OldSat);
end;
// atpa sorting
SortATPASize(ATPA, True);
SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
// remove tpa's in the atpa that exceed a large-ish distances (in terms of searching for a NPC's head)
for i := 0 to high(ATPA) do
if (Distance(ATPA[i][Low(ATPA[i])].x, ATPA[i][Low(ATPA[i])].y,
ATPA[i][High(ATPA[i])].x, ATPA[i][High(ATPA[i])].y) > 2 shl 4) then
DeleteValueInATPA(ATPA, i);
// atpa length check for inadequate results
if (Length(ATPA) < 1) then
begin
ColorToleranceSpeed(TempCTS);
SetColorspeed2Modifiers(OldHue, OldSat);
end;
// remove tpa's in the atpa that don't match at least 10 points/pixels and are under 100 too
for i := 0 to high(ATPA) do
if not ((Length(ATPA[i]) < 100) and (Length(ATPA[i]) > 10)) then
DeleteValueInATPA(ATPA, i);
// atpa length check for inadequate results
if (Length(ATPA) < 1) then
begin
ColorToleranceSpeed(TempCTS);
SetColorspeed2Modifiers(OldHue, OldSat);
end;
// Mark time marker, used potentially later if we exceed 10 seconds
MarkTime(t);
for i := 0 to high(ATPA) do
begin
writeln('found');
MiddleTPAEx(ATPA[i], Pt.x, Pt.y);
SMART_DebugATPA(False, ATPA);
MMouse(Pt.x, Pt.y, 3, 3);
if (IsUpTextMultiCustom(['omp', 'tition'])) then
begin
writeln('found again');
Result := True; // reached objective
ClickMouse2(Mouse_Left);
writeln('did click');
Break;
end;
if (TimeFromMark(t) > 10000) then
begin
LogOut;
Break;
end;
end;
end;