I found myself making a new dtm or bitmap about every three days. I said screw it and now use CTS 2 with CountColorTolerance. These four functions are my food finding procedures. I ran a script that reloaded the client to test my min and max color counts.
Simba Code:
function BankSearchBox(Index: Integer): TBox;
var
P: TPoint;
begin
if not LoggedIn then Exit;
if not BankScreen then Exit;
P := BankIndexToMSPoint(Index);
Result := IntToBox(P.x + 6, P.y + 12, P.x + 20, P.y + 25);
end;
function InvSearchBox(Index: Integer): TBox;
var
B: TBox;
begin
if not LoggedIn then Exit;
B := InvBox(Index);
Result := IntToBox(B.X1 + 6, B.Y1 + 11, B.X1 + 20, B.Y1 + 24);
end;
function FoodACI: TAutoColorInfo;
begin
case Players[CurrentPlayer].Integers[INT_FOOD] of
FOOD_TROUT:
begin
Result.Color := 5724517;
Result.LumTol := 12;
Result.HueMod := 0.10;
Result.SatMod := 0.07;
Result.MinCount := 130;
Result.MaxCount := 148;
end;
FOOD_SALMON:
begin
Result.Color := 2966183;
Result.LumTol := 14;
Result.HueMod := 0.05;
Result.SatMod := 2.13;
Result.MinCount := 135;
Result.MaxCount := 150;
end;
FOOD_TUNA:
begin
Result.Color := 5921639;
Result.LumTol := 8;
Result.HueMod := 0.26;
Result.SatMod := 0.13;
Result.MinCount := 155;
Result.MaxCount := 167;
end;
FOOD_LOBSTER:
begin
Result.Color := 1527969;
Result.LumTol := 12;
Result.HueMod := 0.02;
Result.SatMod := 0.12;
Result.MinCount := 130;
Result.MaxCount := 140;
end;
FOOD_SWORDFISH:
begin
Result.Color := 9130882;
Result.LumTol := 10;
Result.HueMod := 0.04;
Result.SatMod := 0.59;
Result.MinCount := 70;
Result.MaxCount := 85;
end;
end;
end;
function FindFoodIn(Box: TBox): Boolean;
var
ACI: TAutoColorInfo;
CTS, c: Integer;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
ACI := FoodACI;
SetColorspeed2Modifiers(ACI.HueMod, ACI.SatMod);
c := CountColorTolerance(ACI.Color, Box.X1, Box.Y1, Box.X2, Box.Y2, ACI.LumTol);
Result := (c >= ACI.MinCount) and (c <=ACI.MaxCount);
ColorToleranceSpeed(CTS);
SetColorspeed2Modifiers(0.2, 0.2);
end;