askesis 發表於 Oct 18, 2018 14:51:00 GMT
我寫了一段很簡單的代碼,功能正常。因爲發熱考慮從1920*1080換到1280*720,但是在1280下重新截圖,修改找圖區域之後卻用不了了,找不到任何匹配圖片。在0.1相似度的情況下會在找圖區域點擊,所以區域應該沒問題。代碼如下。
-- ========== Settings ================
Settings:setCompareDimension(true, 1280)
Settings:setScriptDimension(true, 1280)
Settings:set("MinSimilarity", 0.65)
-- ========== main program ===========
count = 29999
i = 0
for i = 0, count do
roi = Region(478,603,250,50)
roiSummon = Region(818,153,110,450)
if(roi:exists("RcvAcc2.png", 6)) then
roi:existsClick("RcvAcc2.png", 6)
-- click once extra
wait(3)
click(Location(600, 360))
wait(3)
end
roi=Region(662,142,130,450)
if(roi:exists("CheckReward2.png", 6)) then
roi:existsClick("CheckReward2.png", 4)
-- click once extra
wait(6)
click(Location(600, 360))
wait(4)
existsClick("ConfirmOrange2.png", 4)
end
if(roi:exists("Participate2.png", 6)) then
roi:existsClick("Participate2.png", 4)
wait(3)
existsClick("Ready2.png", 4)
wait(3)
existsClick("StartBattle2.png", 4)
wait(3)
if(exists("Notice2.png", 6)) then
wait(2)
click(Location(600, 360))
wait(1)
existsClick("Backward2.png",6)
wait(4)
else
-- if(exists("21sp2.png", 105)) then
-- existsClick("Jin2.png", 10)
--wait(2)
--click(Location(600, 600))
--wait(1)
--end
roi = Region(1071,639,170,60)
roi:existsClick("Exit2.png", 240)
end
elseif(roiSummon:exists("110wendy2.png", 6)) then
roiSummon:existsClick("SummonButton2.png", 6)
wait(3)
if(exists("Summon2.png",6)) then
existsClick("Summon2.png",6)
wait(10)
click(Location(600, 360))
wait(3)
else
-- mine already summoned, confirm the Notice
wait(3)
click(Location(600, 360))
wait(3)
end
end
wait(3)
end
print("Done!")