Post by varenicou on Jul 25, 2021 1:31:21 GMT
okay so, i wanna search some image, yes i did it on very first run.
But when i'm doing it for a loops, it won't find again.
This is my code
But when i'm doing it for a loops, it won't find again.
This is my code
-- Settings
DeveY = 960
DeveX = 540
Settings:setCompareDimension(true, 540)
Settings:setScriptDimension(true, 540)
Settings:set("MinSimilarity", 0.80)
-- Script Starts Here
left = (Region((DeveX - 500) / 2 , (DeveY - 100) / 2 , 500 , 100))
left:highlight("Farming Start!")
wait(1)
left:highlightOff()
color_id = getColor(Location(302, 100))
print(color_id)
-- click("repeat.png")
-- Refill Stamina
enable_loop = true
while enable_loop do
local sim_val = 0.8
local ok_btn = 0.5
local num_try = 3
toast("7")
if find(Pattern("ok.png"):similar(sim_val), 3) then
getLastMatch():highlight(1)
print(getLastMatch())
-- click(getLastMatch())
end
toast("1")
-- Pressing Repeat Button
if exists(Pattern("repeat.png"):similar(sim_val), 3) then
getLastMatch():highlight(1)
-- click(getLastMatch())
end
toast("2")
-- Finding the Confirmation to use Stamina Potion
if exists(Pattern("yes.png"):similar(sim_val), 3) then
toast("Refilling Stamina...")
getLastMatch():highlight(1)
-- click(getLastMatch())
end
toast("3")
-- Finding the Stamina Potion
if exists(Pattern("limited_potion.png"):similar(sim_val), 3) then
getLastMatch():highlight(1)
-- click(getLastMatch())
end
toast("4")
if exists(Pattern("max.png"):similar(sim_val), 3) then
getLastMatch():highlight(1)
-- click(getLastMatch())
end
toast("5")
if exists(Pattern("recover.png"):similar(sim_val), 3) then
getLastMatch():highlight(1)
-- click(getLastMatch())
toast("Stamina Refill Success!")
end
toast("6")
if exists(Pattern("close.png"):similar(sim_val), 3) then
getLastMatch():highlight(1)
-- click(getLastMatch())
end
toast("8")
if exists(Pattern("close.png"):similar(sim_val), 3) then
getLastMatch():highlight(1)
-- click(getLastMatch())
end
end