|
t
Apr 1, 2020 0:43:43 GMT
Post by gogefo5942 on Apr 1, 2020 0:43:43 GMT
t
|
|
|
t
Apr 11, 2020 1:10:42 GMT
Post by AnkuLua on Apr 11, 2020 1:10:42 GMT
Use following function
function existsMultiMax(target, region) local maxScore = 0 local maxIndex = 0 local match snapshot() for i, t in ipairs(target) do if (region:exists(t, 0)) then -- check once local score = region:getLastMatch():getScore() if (score > maxScore) then maxScore = score maxIndex = i match = region:getLastMatch() end end end
usePreviousSnap(false) if (maxScore == 0) then return -1 end return maxIndex, match end
And the usage example
target = {"flowerA.png, "flowerB.png", "flowerC.png", "flowerD.png"} region = Region, (100, 200, 80, 80) index, match = existsMultiMax(target, region) if (index <= 0) then print("not found") else print("found " .. target[index]) click(match) end
|
|