Android 台灣中文網

標題: 請版上的觸寫控精靈腳本達人幫幫忙。 [打印本頁]

作者: guileman2    時間: 2013-12-30 19:13
標題: 請版上的觸寫控精靈腳本達人幫幫忙。
小弟自行寫了一組自動養魚腳本,腳本如下:
-- 脚本描述
DESCRIPTION="自動餵魚";

-- 适用屏幕参数
SCREEN_RESOLUTION="800x1280";
SCREEN_COLOR_BITS=32;

-- 主入口
function main()

function click(x, y)
touchDown(0, x+5, y+5);
touchUp(0);
end

function start()
x, y = findImageFuzzy("/mnt/sdcard/Touchelper/plugins/魚食.bmp",80);
if x ~= -1 and y ~= -1 then
notifyMessage("第一次搜尋!餵魚!");
click(x, y)
return aa()
else
x, y = findImageFuzzy("/mnt/sdcard/Touchelper/plugins/魚食.bmp",80);
if x ~= -1 and y ~= -1 then
notifyMessage("第二次搜尋!餵魚!");
click(x, y)
return aa()
else
x, y = findImageFuzzy("/mnt/sdcard/Touchelper/plugins/魚食.bmp",80);
if x ~= -1 and y ~= -1 then
notifyMessage("第三次搜尋!餵魚!");
click(x, y)
return aa()
else
x, y = findImageFuzzy("/mnt/sdcard/Touchelper/plugins/max.bmp",80);
if x ~= -1 and y ~= -1 then
notifyMessage("魚長大了。");
return bb()
else
x, y = findImageFuzzy("/mnt/sdcard/Touchelper/plugins/x.bmp",80);
if x ~= -1 and y ~= -1 then
notifyMessage("已返回繼續餵魚。");
click(x, y)
mSleep(5000);
return start()
end
end
end
end
end

function aa()
mSleep(2000);
x, y = findImageFuzzy("/mnt/sdcard/Touchelper/plugins/普通食物.bmp",80);
if x ~= -1 and y ~= -1 then
notifyMessage("餵魚成功!");
click(x, y)
mSleep(5000);
return start()
end

function bb()
mSleep(2000);
x, y = findImageFuzzy("/mnt/sdcard/Touchelper/plugins/出售1.bmp",80);
if x ~= -1 and y ~= -1 then
notifyMessage("要賣了。");
click(x, y)
mSleep(2000);
x, y = findImageFuzzy("/mnt/sdcard/Touchelper/plugins/出售2.bmp",80);
if x ~= -1 and y ~= -1 then
notifyMessage("賣出了!");
click(x, y)
mSleep(3000);
return main()
end
end

但於執行時,出現了:lua:77:"end" expected(to close "function" at line 62)near <eof>的錯誤訊息,我自己看過了多遍,不知錯在那裡,請寫腳本達人幫忙看一下,是那裡出錯,謝謝。
作者: Ming-Xian-Lee    時間: 2013-12-30 23:46
本帖最後由 Ming-Xian-Lee 於 2014-1-1 11:17 編輯

我沒測試你用看看行不行@@

自動餵魚.txt (1.51 KB, 下載次數: 35)