J J
2012-05-21 14:52:02
EDIT: Got it, thanks for the help.
I want to know in which box the biggest amount of yellow NPC colors are found. I've split the minimap up in 9 boxes and yeah this is the code:
It's probably extremely easy but yeah. How do I find the highest integer in this array? High(NPCDots) gives 8 because it is [0..8]
I want to know in which box the biggest amount of yellow NPC colors are found. I've split the minimap up in 9 boxes and yeah this is the code:
procedure NPCWalk;
var
i: Integer;
NPCDots: Array[0..8] of Integer;
// North, Middle, South | North/east, East, South/east | North/west, West, South/west
begin
// NPC WALKING
SMART_ClearCanvas;
SMART_DrawBoxEx(False, IntToBox(MMCX-25, MMCY-75, MMCX+25, MMCY-25), clRed); // 0
SMART_DrawBoxEx(False, IntToBox(MMCX-25, MMCY-25, MMCX+25, MMCY+25), clRed); // 1
SMART_DrawBoxEx(False, IntToBox(MMCX-25, MMCY+25, MMCX+25, MMCY+75), clRed); // 2
SMART_DrawBoxEx(False, IntToBox(MMCX+25, MMCY-75, MMCX+75, MMCY-25), clRed); // 3
SMART_DrawBoxEx(False, IntToBox(MMCX+25, MMCY-25, MMCX+75, MMCY+25), clRed); // 4
SMART_DrawBoxEx(False, IntToBox(MMCX+25, MMCY+25, MMCX+75, MMCY+75), clRed); // 5
SMART_DrawBoxEx(False, IntToBox(MMCX-75, MMCY+25, MMCX-25, MMCY+75), clRed); // 6
SMART_DrawBoxEx(False, IntToBox(MMCX-75, MMCY-25, MMCX-25, MMCY+25), clRed); // 7
SMART_DrawBoxEx(False, IntToBox(MMCX-75, MMCY-75, MMCX-25, MMCY-25), clRed); // 8
ColorToleranceSpeed(1);
NPCDots[0] := CountColorTolerance(645100, MMCX-25, MMCY-75, MMCX+25, MMCY-25, 35);
NPCDots[1] := CountColorTolerance(645100, MMCX-25, MMCY-25, MMCX+25, MMCY+25, 35);
NPCDots[2] := CountColorTolerance(645100, MMCX-25, MMCY+25, MMCX+25, MMCY+75, 35);
NPCDots[3] := CountColorTolerance(645100, MMCX+25, MMCY-75, MMCX+75, MMCY-25, 35);
NPCDots[4] := CountColorTolerance(645100, MMCX+25, MMCY-25, MMCX+75, MMCY+25, 35);
NPCDots[5] := CountColorTolerance(645100, MMCX+25, MMCY+25, MMCX+75, MMCY+75, 35);
NPCDots[6] := CountColorTolerance(645100, MMCX-75, MMCY+25, MMCX-25, MMCY+75, 35);
NPCDots[7] := CountColorTolerance(645100, MMCX-75, MMCY-25, MMCX-25, MMCY+25, 35);
NPCDots[8] := CountColorTolerance(645100, MMCX-75, MMCY-75, MMCX-25, MMCY-25, 35);
for i:=0 to 8 do
WriteLn(''+IntToStr(NPCDots[i])+'');
end;It's probably extremely easy but yeah. How do I find the highest integer in this array? High(NPCDots) gives 8 because it is [0..8]
