Android 台灣中文網

標題: 唔知錯咩 [打印本頁]

作者: s031108    時間: 2014-5-19 23:41
標題: 唔知錯咩
本帖最後由 s031108 於 2014-5-19 23:43 編輯

错误:脚本编译出错...
错误代码:3
错误信息:
脚本GG主程序(ALL)1.lua第240行有语法错误, <goto D> at line 209 jumps into the scope of local "flag"

--回en1
::R1::
local flag, x, y = findImageFuzzy(image.."9.bmp", 70, w*490, h*720, w*540, h*770);
if flag then
  toast("GG");
  sleep(wait1);
        touchDown( w*720, h*770);
        sleep(60);
        touchUp();
  sleep(wait1);
  end
local flag2, x, y = findImageFuzzy(image.."6.bmp", 70, 400*w,600*h,450*w,640*h);
if flag2 then
  toast("回en");
  sleep(wait1);
        touchDown( w*430, h*560);
        touchUp();
  sleep(wait1);
  goto R2
  end
209  goto D

--回en1

--回en2
::R2::
local flag, x, y = findImageFuzzy(image.."9.bmp", 70, w*490, h*720, w*540, h*770);
if flag then
  toast("GG");
  sleep(wait1);
        touchDown( w*720, h*770);
        sleep(60);
        touchUp();
  sleep(wait1);
  end
local flag, x, y = findImageFuzzy(image.."7.bmp", 60, w*610, h*580, w*685, h*650);
if flag then
  sleep(wait1);
        touchDown( w*720, h*640);
        sleep(60);
        touchUp();
  sleep(wait1);
  goto C
else
  goto R2
  end
--回en2

--開始1
  toast("開始");
::D::
240 local flag, x, y = findImageFuzzy(image.."9.bmp", 70, w*490, h*720, w*540, h*770);
if flag then
  toast("GG");
  sleep(wait1);
        touchDown( w*720, h*770);
        sleep(60);
        touchUp();
  sleep(wait1);
  end
local flag4, x4, y4 = findImageFuzzy(image.."3.bmp", 80);
if flag4 then
  sleep(wait1);
        touchDown( w*360, h*650);
        sleep(60);
        touchUp();
else
  goto D
  end
::AT::
local flag2, x2, y2 = findImageFuzzy(image.."bs1.bmp", 90, w*690, h*450, w*730, h*490);
if flag2 then
else
goto AT
end
        sleep(800);
        touchDown( w*760, h*970);
        touchUp();
        sleep(400);
        touchDown( w*760, h*970);
        touchUp();
        sleep(400);
        touchDown( w*760, h*970);
        touchUp();
        sleep(400)
        touchDown( w*20, h*70);
        touchUp();
  sleep(wait1);
--開始1
作者: antrbangy    時間: 2014-8-30 13:54
嗯,這樣貼得很亂看不出來,但我猜測,應該是goto的問題,記得沒錯的話,你是不是有從function main()去呼叫子function,然後從子function直接用goto 回到function main的行數..有試過這樣不行,goto好像只能用在當前的function中..不能跳function..

**--錯誤範例--**
function main()
:f_m
    toast("main")
    son();
end

function son()
   print ("son")
   goto f_m-->因為由子function直接goto回main function,會錯誤.
end


--**正確範例**--
function main()
:f_m
    toast("main")
    son();
    goto f_m-->goto放在同個function是可行的
end

function son()
   print ("son")
end













歡迎光臨 Android 台灣中文網 (https://apk.tw/) Powered by Discuz! X3.1