綁定帳號登入

Android 台灣中文網

打印 上一主題 下一主題

[求助] 觸摸腳本 語法錯誤幫修改

[複製連結] 查看: 1246|回覆: 11|好評: 0
跳轉到指定樓層
樓主
ps74747744 | 收聽TA | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
發表於 2014-1-26 14:28
50碎鑽
觸摸新手學寫腳本  
出現語法錯誤 卻不知問題出再哪...
請大神們幫修改至測試運行無誤後 碎鑽奉上 感恩



-- DESCRIPTION="自動練功";

-- 適用螢幕參數
SCREEN_RESOLUTION="1280x720";
SCREEN_COLOR_BITS=32;

function main()
::拋竿::
    x, y = findImage("/storage/sdcard0/Touchelper/ABC/拋竿.bmp");
    if x ~= -1 and y ~= -1 then
        touchDown(0, x+5, y+5);
        touchUp(0);
        notifyMessage("以拋竿");
    else
        notifyMessage("找不到拋竿")
        goto 補電力;
    end
end
mSleep(4000);
::上勾::
    x, y = findImage("/storage/sdcard0/Touchelper/ABC/上勾.bmp");
    if x ~= -1 and y ~= -1 then
        touchDown(0, x+5, y+5);
        touchUp(0);
        notifyMessage("以上勾");
    else
        notifyMessage("上勾失敗")
        goto 繼續釣魚;
    end
end
mSleep(2000);
::清除確認視窗::
    x, y = findImage("/storage/sdcard0/Touchelper/ABC/打x.bmp");
    if x ~= -1 and y ~= -1 then
        touchDown(0, x+5, y+5);
        touchUp(0);
        notifyMessage("清除確認視窗");
    else
        notifyMessage("搜尋不到確認視窗")
    end
end
mSleep(2000);
::賣出::
    x, y = findImage("/storage/sdcard0/Touchelper/ABC/賣魚.bmp");
    if x ~= -1 and y ~= -1 then
        touchDown(0, x+5, y+5);
        touchUp(0);
        notifyMessage("成功賣出");
    else
        notifyMessage("無法賣出")
    end
end
mSleep(2000);
::繼續釣魚::
    x, y = findImage("/storage/sdcard0/Touchelper/ABC/繼續釣魚.bmp");
    if x ~= -1 and y ~= -1 then
        touchUp(0);
        notifyMessage("繼續釣魚");
    else
        notifyMessage("找不到繼續釣魚")
    end
end
goto 拋竿;
mSleep(1000);
::補電力::
    x, y = findImage("/storage/sdcard0/Touchelper/ABC/使用電池.bmp");
    if x ~= -1 and y ~= -1 then
        touchDown(0, x+5, y+5);
        touchUp(0);
        mSleep(500);
        touchDown(0, x+5, y+5);
        touchUp(0);
        notifyMessage("以補電力");
    else
        notifyMessage("免補電力")
        goto 繼續釣魚;
    end
end
mSleep(1000);
::補完電力::
    x, y = findImage("/storage/sdcard0/Touchelper/ABC/打x.bmp");
    if x ~= -1 and y ~= -1 then
        touchDown(0, x+5, y+5);
        touchUp(0);
        notifyMessage("補完清除視窗");
    else
        notifyMessage("搜尋不到確認視窗")
    end
end
goto 繼續釣魚;

「用Android 就來APK.TW」,快來加入粉絲吧!
Android 台灣中文網(APK.TW)
收藏收藏 分享分享 分享專題
用Android 就來Android 台灣中文網(https://apk.tw)
回覆

使用道具 舉報

沙發
有本書 | 收聽TA | 只看該作者
發表於 2014-1-27 22:42
我有發教學文自己去看看

=================================================

四 標記與跳轉標記

功用:類似按鍵精靈中的"標記"與"跳轉標記"

原碼:(標記)

   ::apk::

原碼:(跳轉標記)

   goto apk

備註:標記與跳轉標記需搭配著用,::apk::中的apk是自訂名稱可自行輸入(只可英文)
        goto apk裡的apk是標記名稱,標記名稱需與::apk::中的名稱相同!

====================↓↓↓範例↓↓↓====================

   function main()    --主入口
   notifyMessage("0001");
   mSleep(1000);
        goto akk --akk是標記名稱,標記名稱需與::akk::中的名稱相同!
   ::apk:: --標記名稱apk PS:apk為自設名稱
   notifyMessage("0002");
   mSleep(1000);
   ::akk:: --標記名稱akk PS:akk為自設名稱
   notifyMessage("0003");
   mSleep(1000);
        goto apk --apk是標記名稱,標記名稱需與::apk::中的名稱相同!
   end --主入口end

腳本範例都有加入註解~不懂者請多看幾遍!

如果對於腳本的實際功用還有疑惑~可以自行下載下方附件參考並研究

====================↑↑↑範例↑↑↑====================
用Android 就來Android 台灣中文網(https://apk.tw)
回覆

使用道具 舉報

板凳
有本書 | 收聽TA | 只看該作者
發表於 2014-1-27 22:43
本帖最後由 有本書 於 2014-1-27 22:48 編輯

看不懂的話... goto xxxx;  <<<<<   ";" 這個鬼東東是多的~請果斷刪除試試

點評

我還是找不到問題點出再哪  發表於 2014-1-28 19:10
用Android 就來Android 台灣中文網(https://apk.tw)
回覆

使用道具 舉報

地板
 樓主| ps74747744 | 收聽TA | 只看該作者
發表於 2014-1-28 19:07
::aa::
x, y = findImage(storage/sdcard0/Touchelper/ABC/拋竿.bmp,90);
if x ~= -1 and y ~= -1 then
click(x, y)
notifyMessage(以拋竿);
else
notifyMessage(找不到拋竿)
goto ee;
end
end
mSleep(4000);
::bb::
x, y = findImage(storage/sdcard0/Touchelper/ABC/上勾.bmp,90);
if x ~= -1 and y ~= -1 then
click(x, y)
notifyMessage(以上勾);
else
notifyMessage(上勾失敗)
goto ee;
end
end
mSleep(2000);
::cc::
x, y = findImage(storage/sdcard0/Touchelper/ABC/打x.bmp,90);
if x ~= -1 and y ~= -1 then
click(x, y)
notifyMessage(清除確認視窗);
else
notifyMessage(搜尋不到確認視窗)
end
end
mSleep(2000);
::dd::
x, y = findImage(storage/sdcard0/Touchelper/ABC/賣魚.bmp,90);
if x ~= -1 and y ~= -1 then
click(x, y)
notifyMessage(成功賣出);
else
notifyMessage(無法賣出)
end
end
mSleep(2000);
::ee::
x, y = findImage(storage/sdcard0/Touchelper/ABC/繼續釣魚.bmp,90);
if x ~= -1 and y ~= -1 then
click(x, y)
notifyMessage(繼續釣魚);
else
notifyMessage(找不到繼續釣魚)
end
end
goto aa;
mSleep(1000);
::ff::
x, y = findImage(storage/sdcard0/Touchelper/ABC/使用電池.bmp,90);
if x ~= -1 and y ~= -1 then
touchDown(0, x+5, y+5);
click(x, y)
mSleep(1000);
touchDown(0, x+5, y+5);
click(x, y)
notifyMessage(以補電力);
else
notifyMessage(免補電力c)
goto ee;
end
end
mSleep(1000);
::gg::
x, y = findImage(storage/sdcard0/Touchelper/ABC/打x.bmp,90);
if x ~= -1 and y ~= -1 then
click(x, y)
notifyMessage(補完清除視窗);
else
notifyMessage(搜尋不到確認視窗)
end
end
goto ee;
end
用Android 就來Android 台灣中文網(https://apk.tw)
回覆

使用道具 舉報

5
 樓主| ps74747744 | 收聽TA | 只看該作者
發表於 2014-1-28 19:09
有本書大大  我腳本改成這樣還是語法錯誤
問題出再哪呢? 找不到問題點

用Android 就來Android 台灣中文網(https://apk.tw)
回覆

使用道具 舉報

6
有本書 | 收聽TA | 只看該作者
發表於 2014-1-29 11:35
我漏掉沒說到的話部分你倒是改好了,我說到的部分你任然沒改...
(;)<<<<<<<括弧裡的這個符號記住他!
錯誤語法:goto  ??  ;  
正確語法:goto  ??

我沒認真看你的腳本,瞄到的就上面那個了...改完還有問題再問吧:)

點評

以修正 但是還是語法錯誤  發表於 2014-1-29 12:47
用Android 就來Android 台灣中文網(https://apk.tw)
回覆

使用道具 舉報

7
 樓主| ps74747744 | 收聽TA | 只看該作者
發表於 2014-1-29 12:42
以修正 但是還是語法錯誤

::aa::
x, y = findImage(storage/sdcard0/Touchelper/ABC/拋竿.bmp,90);
if x ~= -1 and y ~= -1 then
click(x, y)
notifyMessage(以拋竿);
else
notifyMessage(找不到拋竿)
goto ee
end
end
mSleep(4000);
::bb::
x, y = findImage(storage/sdcard0/Touchelper/ABC/上勾.bmp,90);
if x ~= -1 and y ~= -1 then
click(x, y)
notifyMessage(以上勾);
else
notifyMessage(上勾失敗)
goto ee
end
end
mSleep(2000);
::cc::
x, y = findImage(storage/sdcard0/Touchelper/ABC/打x.bmp,90);
if x ~= -1 and y ~= -1 then
click(x, y)
notifyMessage(清除確認視窗);
else
notifyMessage(搜尋不到確認視窗)
end
end
mSleep(2000);
::dd::
x, y = findImage(storage/sdcard0/Touchelper/ABC/賣魚.bmp,90);
if x ~= -1 and y ~= -1 then
click(x, y)
notifyMessage(成功賣出);
else
notifyMessage(無法賣出)
end
end
mSleep(2000);
::ee::
x, y = findImage(storage/sdcard0/Touchelper/ABC/繼續釣魚.bmp,90);
if x ~= -1 and y ~= -1 then
click(x, y)
notifyMessage(繼續釣魚);
else
notifyMessage(找不到繼續釣魚)
end
end
goto aa
mSleep(1000);
::ff::
x, y = findImage(storage/sdcard0/Touchelper/ABC/使用電池.bmp,90);
if x ~= -1 and y ~= -1 then
touchDown(0, x+5, y+5);
click(x, y)
mSleep(1000);
touchDown(0, x+5, y+5);
click(x, y)
notifyMessage(以補電力);
else
notifyMessage(免補電力c)
goto ee
end
end
mSleep(1000);
::gg::
x, y = findImage(storage/sdcard0/Touchelper/ABC/打x.bmp,90);
if x ~= -1 and y ~= -1 then
click(x, y)
notifyMessage(補完清除視窗);
else
notifyMessage(搜尋不到確認視窗)
end
end
goto ee
end::aa::
x, y = findImage(storage/sdcard0/Touchelper/ABC/拋竿.bmp,90);
if x ~= -1 and y ~= -1 then
click(x, y)
notifyMessage(以拋竿);
else
notifyMessage(找不到拋竿)
goto ee
end
end
mSleep(4000);
::bb::
x, y = findImage(storage/sdcard0/Touchelper/ABC/上勾.bmp,90);
if x ~= -1 and y ~= -1 then
click(x, y)
notifyMessage(以上勾);
else
notifyMessage(上勾失敗)
goto ee
end
end
mSleep(2000);
::cc::
x, y = findImage(storage/sdcard0/Touchelper/ABC/打x.bmp,90);
if x ~= -1 and y ~= -1 then
click(x, y)
notifyMessage(清除確認視窗);
else
notifyMessage(搜尋不到確認視窗)
end
end
mSleep(2000);
::dd::
x, y = findImage(storage/sdcard0/Touchelper/ABC/賣魚.bmp,90);
if x ~= -1 and y ~= -1 then
click(x, y)
notifyMessage(成功賣出);
else
notifyMessage(無法賣出)
end
end
mSleep(2000);
::ee::
x, y = findImage(storage/sdcard0/Touchelper/ABC/繼續釣魚.bmp,90);
if x ~= -1 and y ~= -1 then
click(x, y)
notifyMessage(繼續釣魚);
else
notifyMessage(找不到繼續釣魚)
end
end
goto aa
mSleep(1000);
::ff::
x, y = findImage(storage/sdcard0/Touchelper/ABC/使用電池.bmp,90);
if x ~= -1 and y ~= -1 then
touchDown(0, x+5, y+5);
click(x, y)
mSleep(1000);
touchDown(0, x+5, y+5);
click(x, y)
notifyMessage(以補電力);
else
notifyMessage(免補電力c)
goto ee
end
end
mSleep(1000);
::gg::
x, y = findImage(storage/sdcard0/Touchelper/ABC/打x.bmp,90);
if x ~= -1 and y ~= -1 then
click(x, y)
notifyMessage(補完清除視窗);
else
notifyMessage(搜尋不到確認視窗)
end
end
goto ee
end
用Android 就來Android 台灣中文網(https://apk.tw)
回覆

使用道具 舉報

8
 樓主| ps74747744 | 收聽TA | 只看該作者
發表於 2014-1-29 12:46
有本書 大大 我懷疑是否是::標記:: 這符號有誤
因為剛寫了以下判圖喊話測試
去掉::標記:: 即可正常開始
加上::標記::  又語法錯誤
為何會這樣呢?



function main()
::1::
x, y = findImage("storage/sdcard0/Touchelper/ABC/拋竿.bmp");
if x ~= -1 and y ~= -1 then
click(x, y);
mSleep(1000);
notifyMessage("ok");
else
mSleep(1000);
notifyMessage("no")
end
::2::
mSleep(1000)
x, y = findImage("storage/sdcard0/Touchelper/ABC/上勾.bmp");
if x ~= -1 and y ~= -1 then
click(x, y);
mSleep(1000);
notifyMessage("ok2");
else
mSleep(1000);
notifyMessage("no2")
end
::3::
mSleep(1000)
x, y = findImage("storage/sdcard0/Touchelper/ABC/賣魚.bmp");
if x ~= -1 and y ~= -1 then
click(x, y);
mSleep(1000);
notifyMessage("ok3");
else
mSleep(1000);
notifyMessage("no3")
end
end
用Android 就來Android 台灣中文網(https://apk.tw)
回覆

使用道具 舉報

9
有本書 | 收聽TA | 只看該作者
發表於 2014-1-29 13:16
標記和跳轉標記不得用英文以外的,不如你把錯誤訊息截圖下來 我看看
用Android 就來Android 台灣中文網(https://apk.tw)
回覆

使用道具 舉報

10
 樓主| ps74747744 | 收聽TA | 只看該作者
發表於 2014-1-29 16:47
本帖最後由 ps74747744 於 2014-1-29 16:48 編輯

語法錯誤 顯示這個.......
用Android 就來Android 台灣中文網(https://apk.tw)
回覆

使用道具 舉報

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

本版積分規則