I am using count color tolerance to check to see if there correct amount of text is up when I am clicking a tree for a RSPS.


Each tree has the blue text part in a slightly different place, And I am using that as a bootleg text recognition. For example here is the maple info:

Simba Code:
'maple':
    begin
      Data.Tree_col := 19324;
      Data.Tree_tol := 9;
      Data.Tree_hue := 0.38;
      Data.Tree_sat := 0.00;
      Data.min_blue  := 185;
      Data.max_blue  := 220;
      Bounds.heidth := 60;
      Bounds.width  := 60;
      Bounds.TextBox := (IntToBox(82,8,157,22));
    end;

The color count when hovering over a maple must be inbetween 185 and 220 and it is searching in this area 82,8,157,22

My function looks like:

Simba Code:
function IfBarbrady_Uptext():boolean;
Var
  CTS, T_Count:integer;
begin
  Result := False;
  CTS := GetColorToleranceSpeed;

  ColorToleranceSpeed(2);
  SetColorSpeed2Modifiers(0.16, 1.53);

  T_Count := CountColorTolerance(13162510, Bounds.Textbox.x1, Bounds.Textbox.y1, Bounds.Textbox.x2, Bounds.Textbox.y2, 20);

  SetColorSpeed2Modifiers(0.02, 0.02);

  if InRange(T_Count,Data.min_blue,Data.max_blue) then Result := True;

end;

I am using TPAS to look for the tree:

Simba Code:
function ChopTree: Boolean;
var
  j, CTS, Timeout, MineCount, T: Integer;
  TPA_Tree: TPointArray;
  Tree_ATPA: T2DPointArray;
  g: TPoint;
begin

  Result := False;
  CTS := GetColorToleranceSpeed;
  ColorToleranceSpeed(2);

  begin
    SetColorSpeed2Modifiers(Data.Tree_hue, Data.Tree_sat);
    FindColorsTolerance(TPA_Tree, Data.Tree_Col, SS_MSX1, SS_MSY1, SS_MSX2, SS_MSY2, Data.Tree_Tol);
    SetColorSpeed2Modifiers(0.02, 0.02);
    ColorToleranceSpeed(CTS);
   // SplitTPAWrap(TPA_Tree, 5, Tree_ATPA);
    Tree_ATPA := TPAToATPAEx(TPA_tree, Bounds.width, Bounds.heidth);
    SortATPAFromFirstPoint(Tree_ATPA, Point(SS_MSCX, SS_MSCY));
  end;

  MarkTime(MineCount);
  if Length(Tree_ATPA) < 1 then Exit;

  SetLength(Tree_ATPA,5)

  DebugATPABounds(Tree_ATPA);
  for j := 0 to High(Tree_ATPA) do
    begin
      if (Length(Tree_ATPA[j]) < 5) then Continue;

      g := MiddleTPA(Tree_ATPA[j]);
      MMouse(g.x, g.y, RandomRange( - 5, 5), RandomRange( - 5, 5));
      wait(900);
      if IfBarbrady_Uptext() then
      begin
        Result := True;

        clickmouse2(mouse_left);
        Wait(RandomRange(400, 1500));
        repeat
          Wait(RandomRange(15, 200));
        until (TimeFromMark(MineCount) > TimeOut);
        exit;
    end;
  end;
end;

It hovers over the tree but does not click it because there is not the amount of blue, but when I test the color count with my other script it has the right amount, what am I doing wrong?