本帖最後由 dh7007 於 2013-11-26 21:13 編輯
寫法如下,其實已做完整套自動練功了這部分會執行到主畫面停止可以自行截圖修改給您參考。
-- 主入口
function main()
--外掛程式執行
x , y = findImageFuzzy("/mnt/sdcard/1/Judge/4.bmp", 95);
if x ~= -1 and y ~= -1 then
notifyMessage("已啟動自動轉珠小幫手")
appRun("com.madhead.tos.zh");
else
::A::
appRun("com.acheese.gamehelper");
mSleep(2000);
x1 , y1 = findImageFuzzy("/mnt/sdcard/1/Judge/1.bmp", 95);
if x1 ~= -1 and y1 ~= -1 then
touchDown(0, x1+10, y1+10);
touchUp(0);
notifyMessage("啟動自動轉珠小幫手")
mSleep(2000);
appRun("com.madhead.tos.zh");
else
notifyMessage("未啟動自動轉珠小幫手,重新啟動中")
goto A
return
end
end
--外掛程式執行
--選關
這部分為自動選關核心
--選關
--判斷關卡內是否出現貓頭鷹
::B::
x0 , y0 = findImageFuzzy("/mnt/sdcard/1/Choose/0.bmp", 90);
if x0 ~= -1 and y0 ~= -1 then
touchDown(0, x0+10, y0+10);
touchUp(0);
goto B
return
end
--判斷關卡內是否現面貓頭鷹
::E::
--判斷是否死亡
x2 , y2 = findImageFuzzy("/mnt/sdcard/1/Choose/6.bmp", 90);
if x2 ~= -1 and y2 ~= -1 then
notifyMessage("狀態死亡")
x3 , y3 = findImageFuzzy("/mnt/sdcard/1/Choose/8-4.bmp", 90);
mSleep(2000);
notifyMessage("點擊取消")
touchDown(0, x3+10, y3+10);
touchUp(0);
x4 , y4 = findImageFuzzy("/mnt/sdcard/1/Choose/10-3.bmp", 90);
mSleep(2000);
notifyMessage("點擊確定")
touchDown(0, x4+10, y4+10);
touchUp(0);
return
end
--判斷是否死亡
--判斷是否結束
x5 , y5 = findImageFuzzy("/mnt/sdcard/1/Choose/7.bmp", 90);
if x5 ~= -1 and y5 ~= -1 then
notifyMessage("狀態結束")
mSleep(1000);
x6 ,y6 = findImageFuzzy("/mnt/sdcard/1/Choose/2.bmp", 90);
::C::
if x6 ~= -1 and y6 ~= -1 then
notifyMessage("點擊繼續")
touchDown(0, x6+10, y6+10);
touchUp(0);
else
x6 ,y6 = findImageFuzzy("/mnt/sdcard/1/Choose/2.bmp", 75);
goto C
return
end
::D::
mSleep(1000);
touchDown(0, 360, 160);
touchUp(0);
x7 , y7 = findImageFuzzy("/mnt/sdcard/1/Choose/8.bmp", 90);
if x7 ~= -1 and y7 ~= -1 then
mSleep(1000);
notifyMessage("取消加好友")
touchDown(0, x7+10, y7+10);
touchUp(0);
else
x8 , y8 = findImageFuzzy("/mnt/sdcard/1/Choose/10.bmp", 90);
if x8 ~= -1 and y8 ~= -1 then
mSleep(1000);
notifyMessage("點擊確定")
touchDown(0, x8+10, y8+10);
touchUp(0);
x9 , y9 = findImageFuzzy("/mnt/sdcard/1/Choose/9.bmp", 90);
if x9 ~= -1 and y9 ~= -1 then
mSleep(1000);
notifyMessage("背包以抵達上限")
return
else
notifyMessage("關卡已結束")
mSleep(1000);
return
end
else
goto D
end
end
--判斷是否結束
--戰鬥判定
else
x10 , y10 = findImageFuzzy("/mnt/sdcard/1/Judge/2.bmp", 95);
x11 , y11 = findImageFuzzy("/mnt/sdcard/1/Judge/3.bmp", 90);
if x10 ~= -1 and y10 ~= -1 and x11 ~= -1 and y11 ~= -1 then
notifyMessage("狀態檢測中…")
--mSleep(1000);
touchDown(0, x11+10, y11+5);
touchUp(0);
mSleep(1500);
else
notifyMessage("狀態戰鬥中")
mSleep(1000);
goto E
end
x12 , y12 = findImageFuzzy("/mnt/sdcard/1/Choose/8-1.bmp", 90);
if x12 ~= -1 and y12 ~= -1 then
notifyMessage("狀態可戰鬥")
mSleep(1000);
touchDown(0, x12+10, y12+10);
touchUp(0);
else
notifyMessage("狀態戰鬥中")
mSleep(1000);
goto E
end
x13 , y13 = findImageFuzzy("/mnt/sdcard/1/Judge/4.bmp", 90);
notifyMessage("執行戰鬥中!")
mSleep(1000);
touchDown(0, x13+10, y13+10);
touchUp(0);
mSleep(8000);
goto E
end
end
--戰鬥判定
|