mcpejs研究吧 关注:232贴子:3,590
  • 7回复贴,共1

【求助】看看到底哪里错了

只看楼主收藏回复

org.mozilla.javascript.EvaluatorException: missing } after function body (浮力.js#62)
at org.mozilla.javascript.DefaultErrorReporter.runtimeError(Unknown Source)
at org.mozilla.javascript.DefaultErrorReporter.error(Unknown Source)
at org.mozilla.javascript.Parser.addError(Unknown Source)
at org.mozilla.javascript.Parser.reportError(Unknown Source)
at org.mozilla.javascript.Parser.reportError(Unknown Source)
at org.mozilla.javascript.Parser.mustMatchToken(Unknown Source)
at org.mozilla.javascript.Parser.mustMatchToken(Unknown Source)
at org.mozilla.javascript.Parser.parseFunctionBody(Unknown Source)
at org.mozilla.javascript.Parser.function(Unknown Source)
at org.mozilla.javascript.Parser.parse(Unknown Source)
at org.mozilla.javascript.Parser.parse(Unknown Source)
at org.mozilla.javascript.Context.compileImpl(Unknown Source)
at org.mozilla.javascript.Context.compileReader(Unknown Source)
at net.zhuoweizhang.mcpelauncher.ScriptManager$ParseThread.run(ScriptManager.java:190)
at java.lang.Thread.run(Thread.java:818)
@creeper吃货


IP属地:广东来自Android客户端1楼2016-03-27 12:38回复
    原js:
    function newLevel(){
    var ctx= com.mojang.minecraftpe.MainActivity.currentMainActivity.get()
    ctx.runOnUiThread(new java.lang.Runnable({run:function(){
    var simpleGUI=new android.widget.PopupWindow()
    var button=new android.widget.Button(ctx)
    button.setText("开启浮力")
    button.setOnClickListener(new android.view.View.OnClickListener({onClick:function(viewarg){
    print("浮力已开启")
    Entity.addEffect(getPlayerEnt,MobEffect.jump,7200*20,8,false,false)
    }}))
    simpleGUI.setWidth(70)
    simpleGUI.setHeight(70)
    simpleGUI.showAtLocation(ctx.getWindow().getDecorView(),android.view.Gravity.RIGHT|android.view.Gravity.TOP,100,10);
    }
    }))
    }
    function newLevel(){
    var ctx= com.mojang.minecraftpe.MainActivity.currentMainActivity.get()
    ctx.runOnUiThread(new java.lang.Runnable({run:function(){
    var simpleGUI=new android.widget.PopupWindow()
    var button=new android.widget.Button(ctx)
    button.setText("关闭浮力")
    button.setOnClickListener(new android.view.View.OnClickListener({onClick:function(viewarg){
    print("浮力已关闭")
    Entity.removeEffect(getPlayerEnt(),MobEffect.jump)
    }}))
    simpleGUI.setWidth(70)
    simpleGUI.setHeight(70)
    simpleGUI.showAtLocation(ctx.getWindow().getDecorView(),android.view.Gravity.RIGHT|android.view.Gravity.TOP,100,85);
    }
    }))
    }


    IP属地:广东来自Android客户端2楼2016-03-27 12:39
    回复
      求助啊!


      IP属地:广东来自Android客户端3楼2016-03-27 12:40
      回复
        @Feng_sha风沙


        IP属地:广东来自Android客户端4楼2016-03-27 12:40
        回复
          没加大括号。。。
          ╭( ′• o •′ )╭☞找js,学js,就来mcpejs研究吧,传送门:http://tieba.baidu.com/p/3606775219?share=9105&fr=share  


          IP属地:北京来自Android客户端5楼2016-03-27 13:17
          回复
            启动器报错说第62行(不包括注释行)缺少大括号


            IP属地:北京来自Android客户端6楼2016-03-27 13:18
            收起回复
              gui需要自定义函数,然後newLevel读取gui,之后再设置功能,还有,两个newLevel不能一起用


              IP属地:辽宁来自Android客户端7楼2016-04-05 21:06
              回复