
Originally Posted by
Runaway
Try this:
Simba Code:
for i := 1 to 8 do
begin
Highest := NPCDots[0];
if (NPCDots[i] > Highest) then
Highest := NPCDots[i];
end;
Haven't tested it, but it makes sense

Hm thanks will test
Also rewrote mine to an array so yeah
Simba Code:
procedure NPCWalk;
var
i: Integer;
NPCDots: Array[0..8] of Integer;
X1, Y1, X2, Y2: Array of Integer;
begin
// North, Middle, South | North/east, East, South/east | North/west, West, South/west
X1 := [-25, -25, -25, 25, 25, 25, -75, -75, -75];
Y1 := [-75, -25, 25, -75, -25, 25, 25, -25, -75];
X2 := [25, 25, 25, 75, 75, 75, -25, -25, -25];
Y2 := [-25, 25, 75, -25, 25, 75, 75, 25, -25];
ColorToleranceSpeed(1);
SMART_ClearCanvas;
for i:=0 to 8 do
begin
SMART_DrawBoxEx(False, IntToBox(MMCX+X1[i], MMCY+Y1[i], MMCX+X2[i], MMCY+Y2[i]), clRed); // 0
NPCDots[i] := CountColorTolerance(645100, MMCX+X1[i], MMCY+Y1[i], MMCX+X2[i], MMCY+Y2[i], 35);
WriteLn(''+IntToStr(NPCDots[i])+'');
end;
end;
Will edit it now :P
EDIT: your idea will output the highest number of colors found. That way I still don't know in which box it finds the highest number of colors, but it helped anyway. Trying to figure it out now.
EDIT 2: By simply declaring HighestBox as i it will work 
Simba Code:
function NPCWalk: String;
var
i, Highest, HighestBox: Integer;
NPCDots: Array[0..8] of Integer;
X1, Y1, X2, Y2: Array of Integer;
begin
// North, Middle, South | North/east, East, South/east | North/west, West, South/west
X1 := [-25, -25, -25, 25, 25, 25, -75, -75, -75];
Y1 := [-75, -25, 25, -75, -25, 25, 25, -25, -75];
X2 := [25, 25, 25, 75, 75, 75, -25, -25, -25];
Y2 := [-25, 25, 75, -25, 25, 75, 75, 25, -25];
ColorToleranceSpeed(1);
SMART_ClearCanvas;
Highest:=0;
for i:=0 to 8 do
begin
SMART_DrawBoxEx(False, IntToBox(MMCX+X1[i], MMCY+Y1[i], MMCX+X2[i], MMCY+Y2[i]), clRed); // 0
NPCDots[i] := CountColorTolerance(645100, MMCX+X1[i], MMCY+Y1[i], MMCX+X2[i], MMCY+Y2[i], 35);
if (NPCDots[i] > Highest) then
begin
Highest := NPCDots[i];
HighestBox := i;
end;
end;
case i of
0: Result := 'North';
1: Result := 'Middle';
2: Result := 'South';
3: Result := 'NorthEast';
4: Result := 'East';
5: Result := 'SouthEast';
6: Result := 'NorthWest';
7: Result := 'West';
8: Result := 'SouthWest';
end;
end;
Thanks, +rep 
EDIT3: You must spread some Reputation around before giving it to Runaway again
Hm, I guess you were the last person I gave rep for your TPACluster.
EDIT4: Might aswell rewrite the results to an array
Simba Code:
function NPCWalk: String;
var
i, Highest, HighestBox: Integer;
NPCDots: Array[0..8] of Integer;
X1, Y1, X2, Y2: Array of Integer;
PossibleResults: Array of String;
begin
// North, Middle, South | North/east, East, South/east | North/west, West, South/west
PossibleResults := ['North', 'Middle', 'South', 'NorthEast', 'East', 'SouthEast', 'NorthWest', 'West', 'SouthWest'];
X1 := [-25, -25, -25, 25, 25, 25, -75, -75, -75];
Y1 := [-75, -25, 25, -75, -25, 25, 25, -25, -75];
X2 := [25, 25, 25, 75, 75, 75, -25, -25, -25];
Y2 := [-25, 25, 75, -25, 25, 75, 75, 25, -25];
ColorToleranceSpeed(1);
SMART_ClearCanvas;
Highest:=0;
for i:=0 to 8 do
begin
SMART_DrawBoxEx(False, IntToBox(MMCX+X1[i], MMCY+Y1[i], MMCX+X2[i], MMCY+Y2[i]), clRed); // 0
NPCDots[i] := CountColorTolerance(645100, MMCX+X1[i], MMCY+Y1[i], MMCX+X2[i], MMCY+Y2[i], 35);
if (NPCDots[i] > Highest) then
begin
Highest := NPCDots[i];
HighestBox := i;
end;
end;
Result := PossibleResults[HighestBox];
end;
Anyways, thanks.