when gardening, the click should be made more quickly,
or how to give us feature about setting timer of clicker
You can delete all the lines with highlight.
local operators = {{target = "multiply.png", char = "*"},
{target = "add.png", char = "+"},
{target = "minus.png", char = "-"}
}
function resSortByX(data)
local sortFunc = function(a, b) return (a.match:getX() < b.match:getX()) end
table.sort(data, sortFunc)
return data
end
function calculate()
usePreviousSnap(true)
local match = getLastMatch()
local x = -match:getW()
local calReg = match:grow(x, 260, 8, 2)
--calReg:highlight(1)
local opRes = {}
for k, o in ipairs(operators) do
print(o.target)
local matches = regionFindAllNoFindException(calReg, o.target)
for l, m in ipairs(matches) do
opRes[#opRes + 1] = {match = m, char = o.char}
end
end
opRes = resSortByX(opRes)
local startX = calReg:getX()
local y = calReg:getY()
local h = calReg:getH()
local str = ""
local numReg
opRes[#opRes + 1] = {match = Region(calReg:getX() + calReg:getW(), y, 5, h), char = ""}
for k, r in ipairs(opRes) do
numReg = Region(startX, y, r.match:getX()-startX + 1, h)
--numReg:highlight(0.5); wait(0.3)
local num = numberOCR(numReg, "num")
--numReg:highlight("" .. num, 1)
str = str .. num .. r.char
startX = r.match:getX() + r.match:getW() - 1
end
print("str = " .. str)
func = assert(loadstring("return " .. str))
y = "" .. func()
print(y)
--calReg:save("calc_" .. str .. "=" .. y .. ".png")
Region(0, 0, 2000, 800):saveColor("calc_" .. str .. "=" .. y .. ".png")
click(match:offset(90, 40))
exists("calc8.png")
wait(0.5)
snapshot()
for c in y:gmatch"." do
existsClick("calc" .. c .. ".png", 0)
end
existsClick(Pattern("button4.png"):similar(0.7))
existsClick(Pattern("button4.png"):similar(0.7))
end
setImmersiveMode(true)
Settings:setScriptDimension(false, 720)
Settings:setCompareDimension(false, 720)
version = "Garden: 1.1.0"
print(version)
while (true) do
existsClick("hand.png")
if (exists("calFig.png", 5)) then
calculate()
usePreviousSnap(false)
end
--waitVanish("mature.png", 30)
end
I have edited, the result still same, I need more quickly when click gardening