DashingStrike / Automato-ATITD

Automato scripts for A Tale in the Desert
MIT License
5 stars 25 forks source link

Vinetender macros sometimes don't recognize ocr #153

Closed Cegaiel closed 6 years ago

Cegaiel commented 6 years ago

vinetender

Shows Vigor as 0 when it should be 22.

To test, run Automato on the screenshot. Temporarily change these lines to allow testing on screenshot and return results (as in screenshot of Automato)

Vinetender.lua Line 98 Comment out: --- closeAllWindows();

Line 303 - Change: return "Vineyard is not ready for tending"; to return statusSuccess();

Line 361 - Change: local result = "(" .. tendedCount .. ") Tended " .. vine.name .. "\n \n"; to local result = "(" .. tendedCount .. ") Tended \n \n";

Vinetender macros call function ocrNumber (located in common_find.inc) in common files

ocrNumber in return, calls

function findDigit(x, y, sizeX, sizeY, prefix)
  local result = nil;
  for i=0, 9 do
    if srFindImageInRange(prefix .. i .. ".png", x, y,
        sizeX, sizeY, tol)
    then
      result = i;
      break;
    end
    if prefix == "ocr/" then
      if srFindImageInRange(prefix .. "decimals.png", x, y,
        sizeX, sizeY, tol)
      then
        result = ".";
        break;
      end
    end
  end
  return result;
end

I always assumed that tol (tolerance) was defaulted to 5000, but appears that is not the case.

      if srFindImageInRange(prefix .. "decimals.png", x, y,
        sizeX, sizeY, tol)

But simply adding:

tol = 5000; 

to the vinetender scripts, it appears to fix the issues.