綁定帳號登入

Android 台灣中文網

打印 上一主題 下一主題

[其他] 【觸摸精靈】簡單腳本編寫+基礎教學文(新帖)

   關閉 [複製連結] 查看: 50485|回覆: 82|好評: 11
41
ChangMichael | 收聽TA | 只看該作者
發表於 2014-6-11 15:13
charxp 發表於 2014-6-7 15:09
:7:unexpected symbol near "or"
前面為路徑檔就不打了   謝謝!!

不能直接用 or
如果你是要二選一,要用if else 等條件判斷語句
第一頁教學麻煩去惡補一下


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

使用道具 舉報

42
小小小瀧 | 收聽TA | 只看該作者
發表於 2014-6-25 16:47
請問這腳本怎麼不可以使用

-- 脚本描述
DESCRIPTION="1";

-- 适用屏幕参数
SCREEN_RESOLUTION="1080x1920";
SCREEN_COLOR_BITS=4;


function appa()--攻擊副程式
        touchDown(0, 682, 1814);
        mSleep(184);
        touchUp(0);

        mSleep(200);
        touchDown(0, 678, 1805);
        mSleep(145);
        touchUp(0);

        mSleep(200);
        touchDown(0, 691, 1794);
        mSleep(105);
        touchUp(0);

        mSleep(200);
        touchDown(0, 691, 1794);
        mSleep(105);
        touchUp(0);
end--結束攻擊副程式

function appb()--補魔副程式
        touchDown(0, 871, 1795);  -- 那麼點擊該坐標
        mSleep(135);
        touchUp(0);

        mSleep(135);
        touchDown(0, 871, 1795);
        mSleep(135);
        touchUp(0);

        mSleep(1500);
        touchDown(0, 871, 1795);
        mSleep(135);
        touchUp(0);

        mSleep(135);
        touchDown(0, 871, 1795);
        mSleep(135);
        touchUp(0);
end--結束補魔副程式

function appc()--補血副程式
        touchDown(0, 444, 353);
        mSleep(140);
        touchUp(0);

        mSleep(140);
        touchDown(0, 444, 353);
        mSleep(140);
        touchUp(0);
end--結束補血副程式

function main()--主入口
y1=os.time()
while true do
y2=os.time()
mSleep(100);
if y2-y1>=1*60 then
y1=os.time()

        b = getColor(1043, 950);  --  補血
        c = getColor(1043, 1294);  --
補魔

        if b ~= 0xba3d1f
        then
        appc()--調用appc補血副程式
else--否則
        if c ~= 0x1f7eb2
        then -- 如果該點顏色不為魔
        appb()--調用appb補魔副程式
else--否則
        if b == 0xba3d1f and c == 0x1f7eb2
        then
        mSleep(500);
appa()--調用appa攻擊副程式
end--這裡是while true do
的end
end--這裡if y2-y1>=1*60 then的end
end--主入口的end
-- 脚本描述
DESCRIPTION="1";

-- 适用屏幕参数
SCREEN_RESOLUTION="1080x1920";
SCREEN_COLOR_BITS=4;


function appa()--攻擊副程式
        touchDown(0, 682, 1814);
        mSleep(184);
        touchUp(0);

        mSleep(200);
        touchDown(0, 678, 1805);
        mSleep(145);
        touchUp(0);

        mSleep(200);
        touchDown(0, 691, 1794);
        mSleep(105);
        touchUp(0);

        mSleep(200);
        touchDown(0, 691, 1794);
        mSleep(105);
        touchUp(0);
end--結束攻擊副程式

function appb()--補魔副程式
        touchDown(0, 871, 1795);  -- 那麼點擊該坐標
        mSleep(135);
        touchUp(0);

        mSleep(135);
        touchDown(0, 871, 1795);
        mSleep(135);
        touchUp(0);

        mSleep(1500);
        touchDown(0, 871, 1795);
        mSleep(135);
        touchUp(0);

        mSleep(135);
        touchDown(0, 871, 1795);
        mSleep(135);
        touchUp(0);
end--結束補魔副程式

function appc()--補血副程式
        touchDown(0, 444, 353);
        mSleep(140);
        touchUp(0);

        mSleep(140);
        touchDown(0, 444, 353);
        mSleep(140);
        touchUp(0);
end--結束補血副程式

function main()--主入口
y1=os.time()
while true do
y2=os.time()
mSleep(100);
if y2-y1>=1*60 then
y1=os.time()

        b = getColor(1043, 950);  --  補血
        c = getColor(1043, 1294);  --
補魔

        if b ~= 0xba3d1f
        then
        appc()--調用appc補血副程式
else--否則
        if c ~= 0x1f7eb2
        then -- 如果該點顏色不為魔
        appb()--調用appb補魔副程式
else--否則
        if b == 0xba3d1f and c == 0x1f7eb2
        then
        mSleep(500);
appa()--調用appa攻擊副程式
end--這裡是while true do
的end
end--這裡if y2-y1>=1*60 then的end
end--主入口的end
用Android 就來Android 台灣中文網(https://apk.tw)
回覆 支持 反對

使用道具 舉報

43
ChangMichael | 收聽TA | 只看該作者
發表於 2014-6-25 18:46
本帖最後由 ChangMichael 於 2014-6-26 13:19 編輯

我大概看下來,if elseif 這樣改看看
參考:
if 條件1 then
動作
elseif 條件2 then
動作
elseif 條件3 then
動作
else  最後條件 then
動作
end;

另外還有可能座標跟色值取不正確。
用Android 就來Android 台灣中文網(https://apk.tw)
回覆 支持 反對

使用道具 舉報

44
ChangMichael | 收聽TA | 只看該作者
發表於 2014-6-27 14:27
剛剛在觸摸精靈官網→論壇那邊發現有放出腳本編輯器,裡面有檢查語法的功能,對於想入門的人來說很有幫助,有興趣的人請自行去下載吧。
用Android 就來Android 台灣中文網(https://apk.tw)
回覆 支持 反對

使用道具 舉報

45
 樓主| 有本書 | 收聽TA | 只看該作者
發表於 2014-6-27 19:13
ChangMichael 發表於 2014-6-27 14:27
剛剛在觸摸精靈官網→論壇那邊發現有放出腳本編輯器,裡面有檢查語法的功能,對於想入門的人來說很有幫助, ...

好久沒來注意這個帖子了 = =
最近迷上Minecraft PE~也開始介入編寫插件!

所以有可能會放棄這個帖子吧?
除非有用到或又學到新的函數~
用Android 就來Android 台灣中文網(https://apk.tw)
回覆 支持 反對

使用道具 舉報

46
skyran | 收聽TA | 只看該作者
發表於 2014-6-30 22:42
請問一下  函數的回傳值 該怎麼寫
假設我寫好了一個函數  每次隨機回傳一個數字  
oneNumber = getRand()
twoNumber = getRand()
...

function getRand(){
// 這裡面該如何寫 ?

}
用Android 就來Android 台灣中文網(https://apk.tw)
回覆 支持 反對

使用道具 舉報

48
z62373212002 | 收聽TA | 只看該作者
發表於 2014-7-6 20:16
我沒任何基礎重複看了基礎文5遍了 還是不知道要重哪學起  
用Android 就來Android 台灣中文網(https://apk.tw)
回覆 支持 反對

使用道具 舉報

49
bluesula | 收聽TA | 只看該作者
發表於 2014-7-16 16:27
感謝你的用心  我下載下來研究一下LUA
用Android 就來Android 台灣中文網(https://apk.tw)
回覆 支持 反對

使用道具 舉報

50
darick_one2000 | 收聽TA | 只看該作者
發表於 2014-8-3 14:20
感謝大大的分享 謝謝
用Android 就來Android 台灣中文網(https://apk.tw)
回覆 支持 反對

使用道具 舉報

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

本版積分規則