綁定帳號登入

Android 台灣中文網

打印 上一主題 下一主題

[求助] 請版上的觸寫控精靈腳本達人幫幫忙。

[複製連結] 查看: 3472|回覆: 4|好評: 1
跳轉到指定樓層
樓主
guileman2 | 收聽TA | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
發表於 2013-12-30 19:13

馬上加入Android 台灣中文網,立即免費下載應用遊戲。

您需要 登錄 才可以下載或查看,沒有帳號?註冊

x
小弟自行寫了一組自動養魚腳本,腳本如下:
-- 脚本描述
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>的錯誤訊息,我自己看過了多遍,不知錯在那裡,請寫腳本達人幫忙看一下,是那裡出錯,謝謝。
「用Android 就來APK.TW」,快來加入粉絲吧!
Android 台灣中文網(APK.TW)
收藏收藏 分享分享 分享專題
用Android 就來Android 台灣中文網(https://apk.tw)
回覆

使用道具 舉報

沙發
Ming-Xian-Lee | 收聽TA | 只看該作者
發表於 2013-12-30 23:46
本帖最後由 Ming-Xian-Lee 於 2014-1-1 11:17 編輯

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

自動餵魚.txt (1.51 KB, 下載次數: 35)
用Android 就來Android 台灣中文網(https://apk.tw)
回覆 支持 反對

使用道具 舉報

板凳
有本書 | 收聽TA | 只看該作者
發表於 2014-1-27 22:46
教你抓魚不如教你釣魚...

:lua:77:"end" expected(to close "function" at line 62)near <eof>

照上面所說的 你的腳本第77行或62行附近少了end

簡單講就是少了end...以後出現這訊息 在確定一夏end有沒有放好~
用Android 就來Android 台灣中文網(https://apk.tw)
回覆 支持 反對

使用道具 舉報

地板
youmark2003 | 收聽TA | 只看該作者
發表於 2014-9-30 22:50
這個腳本好像都正確耶
用Android 就來Android 台灣中文網(https://apk.tw)
回覆 支持 反對

使用道具 舉報

5
歐菲爾 | 收聽TA | 只看該作者
發表於 2014-10-5 21:19
本帖最後由 歐菲爾 於 2014-10-5 21:21 編輯
  1. -- 腳本描述
  2. DESCRIPTION="自動餵魚";

  3. -- 適用屏幕參數
  4. SCREEN_RESOLUTION="800x1280";
  5. SCREEN_COLOR_BITS=32;

  6. -- 主入口
  7. function main()

  8. function click(x, y)
  9. touchDown(0, x+5, y+5);
  10. touchUp(0);
  11. end

  12. function start()
  13. x, y = findImageFuzzy("/mnt/sdcard/Touchelper/plugins/魚食.bmp",80);
  14. if x ~= -1 and y ~= -1 then
  15. notifyMessage("第一次搜尋!餵魚!");
  16. click(x, y)
  17. return aa()
  18. else
  19. x, y = findImageFuzzy("/mnt/sdcard/Touchelper/plugins/魚食.bmp",80);
  20. if x ~= -1 and y ~= -1 then
  21. notifyMessage("第二次搜尋!餵魚!");
  22. click(x, y)
  23. return aa()
  24. else
  25. x, y = findImageFuzzy("/mnt/sdcard/Touchelper/plugins/魚食.bmp",80);
  26. if x ~= -1 and y ~= -1 then
  27. notifyMessage("第三次搜尋!餵魚!");
  28. click(x, y)
  29. return aa()
  30. else
  31. x, y = findImageFuzzy("/mnt/sdcard/Touchelper/plugins/max.bmp",80);
  32. if x ~= -1 and y ~= -1 then
  33. notifyMessage("魚長大了。");
  34. return bb()
  35. else
  36. x, y = findImageFuzzy("/mnt/sdcard/Touchelper/plugins/x.bmp",80);
  37. if x ~= -1 and y ~= -1 then
  38. notifyMessage("已返回繼續餵魚。");
  39. click(x, y)
  40. mSleep(5000);
  41. return start()
  42. end
  43. end
  44. end
  45. end
  46. end

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

  56. function bb()
  57. mSleep(2000);
  58. x, y = findImageFuzzy("/mnt/sdcard/Touchelper/plugins/出售1.bmp",80);
  59. if x ~= -1 and y ~= -1 then
  60. notifyMessage("要賣了。");
  61. click(x, y)
  62. mSleep(2000);
  63. x, y = findImageFuzzy("/mnt/sdcard/Touchelper/plugins/出售2.bmp",80);
  64. if x ~= -1 and y ~= -1 then
  65. notifyMessage("賣出了!");
  66. click(x, y)
  67. mSleep(3000);
  68. return main()
  69. end
  70. end


複製代碼

把74行移動到77行看看
用Android 就來Android 台灣中文網(https://apk.tw)
回覆 支持 反對

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則