Skip to content

scriptcraft v2.1.0-2014-08-23 generated an exception #158

Description

@Rob-bb

Hi

I am getting this error while trying to chain functions together using the callback from utils.foreach. I have pasted the two js files I am using after this error. The error happens about line 36 in the first file, jsut after the line of

console.log("2...");

[Server thread/WARN]: [scriptcraft] Task #6029585 for scriptcraft v2.1.0-2014-08-23 generated an exception
java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.$Proxy33.run(Unknown Source) ~[?:?]
at org.bukkit.craftbukkit.v1_7_R4.scheduler.CraftTask.run(CraftTask.java:71) ~[CraftTask.class:git-Cauldron-MCPC-Plus-1.7.10-1.1207.01.195]
at org.bukkit.craftbukkit.v1_7_R4.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:346) [CraftScheduler.class:git-Cauldron-MCPC-Plus-1.7.10-1.1207.01.195]
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:862) [MinecraftServer.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:423) [lt.class:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:798) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:658) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:745) [?:1.7.0_67]
Caused by: java.security.PrivilegedActionException
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.7.0_67]
at com.sun.script.util.InterfaceImplementor$InterfaceImplementorInvocationHandler.invoke(InterfaceImplementor.java:67) ~[?:1.7.0_67]
... 8 more
Caused by: javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "self" is not defined. (#740) in at line number 740
at com.sun.script.javascript.RhinoScriptEngine.invoke(RhinoScriptEngine.java:300) ~[?:1.7.0_67]
at com.sun.script.javascript.RhinoScriptEngine.invokeMethod(RhinoScriptEngine.java:266) ~[?:1.7.0_67]
at com.sun.script.util.InterfaceImplementor$InterfaceImplementorInvocationHandler$1.run(InterfaceImplementor.java:72) ~[?:1.7.0_67]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.7.0_67]
at com.sun.script.util.InterfaceImplementor$InterfaceImplementorInvocationHandler.invoke(InterfaceImplementor.java:67) ~[?:1.7.0_67]
... 8 more
Caused by: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "self" is not defined. (#740)
at sun.org.mozilla.javascript.internal.ScriptRuntime.constructError(ScriptRuntime.java:3770) ~[?:1.7.0_67]
at sun.org.mozilla.javascript.internal.ScriptRuntime.constructError(ScriptRuntime.java:3748) ~[?:1.7.0_67]
at sun.org.mozilla.javascript.internal.ScriptRuntime.notFoundError(ScriptRuntime.java:3833) ~[?:1.7.0_67]
at sun.org.mozilla.javascript.internal.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1826) ~[?:1.7.0_67]
at sun.org.mozilla.javascript.internal.ScriptRuntime.name(ScriptRuntime.java:1765) ~[?:1.7.0_67]
at sun.org.mozilla.javascript.internal.Interpreter.interpretLoop(Interpreter.java:1785) ~[?:1.7.0_67]
at sun.org.mozilla.javascript.internal.Interpreter.interpret(Interpreter.java:849) ~[?:1.7.0_67]
at sun.org.mozilla.javascript.internal.InterpretedFunction.call(InterpretedFunction.java:162) ~[?:1.7.0_67]
at sun.org.mozilla.javascript.internal.ContextFactory.doTopCall(ContextFactory.java:430) ~[?:1.7.0_67]
at com.sun.script.javascript.RhinoScriptEngine$1.superDoTopCall(RhinoScriptEngine.java:116) ~[?:1.7.0_67]
at com.sun.script.javascript.RhinoScriptEngine$1.access$200(RhinoScriptEngine.java:71) ~[?:1.7.0_67]
at com.sun.script.javascript.RhinoScriptEngine$1$1.run(RhinoScriptEngine.java:105) ~[?:1.7.0_67]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.7.0_67]
at com.sun.script.javascript.RhinoScriptEngine$1.doTopCall(RhinoScriptEngine.java:103) ~[?:1.7.0_67]
at sun.org.mozilla.javascript.internal.ScriptRuntime.doTopCall(ScriptRuntime.java:3160) ~[?:1.7.0_67]
at sun.org.mozilla.javascript.internal.InterpretedFunction.call(InterpretedFunction.java:160) ~[?:1.7.0_67]
at com.sun.script.javascript.RhinoScriptEngine.invoke(RhinoScriptEngine.java:294) ~[?:1.7.0_67]
at com.sun.script.javascript.RhinoScriptEngine.invokeMethod(RhinoScriptEngine.java:266) ~[?:1.7.0_67]
at com.sun.script.util.InterfaceImplementor$InterfaceImplementorInvocationHandler$1.run(InterfaceImplementor.java:72) ~[?:1.7.0_67]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.7.0_67]
at com.sun.script.util.InterfaceImplementor$InterfaceImplementorInvocationHandler.invoke(InterfaceImplementor.java:67) ~[?:1.7.0_67]
... 8 more

These are the two files I am using,

//// Functions to create a creeper face grinder// varutils=require('utils');varblocks=require('blocks');varDrone=require('../drone/drone').Drone;vardrone;// 98:1 is mossy stone brick, the main block for the grinder.varm_blk="98:1";functionbuild_grinder(){// This is a huge structure. Each pixel in the face// is 10x10 blocks in the world.drone=newDrone(this.location);drone.up(3);drone.chkpt('grinder_start_pos');// clear the airbig_box(drone.location,0,100,100,100,face);}Drone.extend(build_grinder);varface=function(){console.log("building the front wall...");drone.chkpt('face_start_pos');console.log("1...");drone.left(2).down(2).back(2);console.log("2...");big_box(drone.location,m_blk,104,104,3,left);// Border for the faceconsole.log("3...");drone.move('face_start_pos');console.log("4...");};varleft=function(){console.log("building the left wall...");drone.fwd(99).turn(1);drone.chkpt('left_start_pos');drone.left(2).down(2).back(2);big_box(drone.location,m_blk,104,104,3,back);// Border for the boxdrone.move('left_start_pos');};varback=function(){console.log("building the back wall...");drone.fwd(99).turn(1);drone.chkpt('back_start_pos');drone.left(2).down(2).back(2);big_box(drone.location,m_blk,104,104,3,right);// Border for the boxdrone.move('back_start_pos');};varright=function(){console.log("building the right wall...");drone.fwd(99).turn(1);drone.chkpt('right_start_pos');drone.left(2).down(2).back(2);big_box(drone.location,m_blk,104,104,3,rf);// Border for the boxdrone.move('right_start_pos');};varrf=function(){console.log("removing blocks...");drone.move('face_start_pos').back(2);big_box(drone.location,0,100,100,2,rl);};varrl=function(){console.log("removing blocks...");drone.move('left_start_pos').back(2);big_box(drone.location,0,100,100,2,rb);};varrb=function(){console.log("removing blocks...");drone.move('back_start_pos').back(2);big_box(drone.location,0,100,100,2,rr);};varrr=function(){console.log("removing blocks...");drone.move('right_start_pos').back(2);big_box(drone.location,0,100,100,2,bfloor);};varbfloor=function(){console.log("building bottom floor...");drone.move('face_start_pos')big_box(drone.location,m_blk,100,1,100,roof);// bottom floor};varroof=function(){console.log("building roof...");drone.move('face_start_pos').up(99);big_box(drone.location,m_blk,100,1,100);// roof };//// Nicely draw big boxes// without stressing the client or server // too much.// varutils=require('utils');varblocks=require('blocks');varDrone=require('../drone/drone').Drone;vardelay=3;varon_done=function(){console.log("Finished building the big box.");};functionbox_width(location,block,width,height,depth,callback){//vara=[];a.length=width;vardrone=newDrone(location);varprocess_width=function(item,index,object,array){drone.box(block,1,height,depth);drone.right(1);};utils.foreach(a,process_width,null,delay,callback);};functionbox_height(location,block,width,height,depth,callback){//vara=[];a.length=height;vardrone=newDrone(location);varprocess_height=function(item,index,object,array){drone.box(block,width,1,depth);drone.up(1);};utils.foreach(a,process_height,null,delay,callback);};functionbox_depth(location,block,width,height,depth,callback){//vara=[];a.length=depth;vardrone=newDrone(location);varprocess_depth=function(item,index,object,array){drone.box(block,width,height,1);drone.fwd(1);};utils.foreach(a,process_width,null,delay,callback);};functionbig_box(location,block,width,height,depth,callback){if(typeofcallback==="undefined"){callback=on_done;}varlargest=Math.max(width,height,depth);console.log("Building a big box in "+largest.toString()+" steps...");if(width==largest){box_width(location,block,width,height,depth,callback);}elseif(height==largest){box_height(location,block,width,height,depth,callback);}elseif(depth==largest){box_depth(location,block,width,height,depth,callback);}}Drone.extend(big_box);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions