Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get Scriptcraft core libraries working (Dec 27 2013 jar) #103

Closed
kleaf opened this issue Dec 28, 2013 · 7 comments
Closed

Can't get Scriptcraft core libraries working (Dec 27 2013 jar) #103

kleaf opened this issue Dec 28, 2013 · 7 comments
Assignees
Labels

Comments

@kleaf
Copy link

kleaf commented Dec 28, 2013

/js 1+1, etc. are working fine, but whenever I try to use a library function like /js box(blocks.oak), I get an exception:

20:55:42 [SEVERE] javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "box" is not defined. (#1) in at line number 1
20:55:42 [SEVERE] at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:156)
20:55:42 [SEVERE] at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:170)
...

Could this be related to the severe error I get when starting Bukkit (1.6.4-R2.0)?

20:50:19 [INFO] [ScriptCraftPlugin] Enabling ScriptCraftPlugin v2.0-2013-12-27
20:50:19 [INFO] [ScriptCraftPlugin] Unzipping lib/console.js
20:50:19 [INFO] [ScriptCraftPlugin] Unzipping lib/scriptcraft.js
20:50:19 [INFO] [ScriptCraftPlugin] Unzipping plugins/alias/alias.js
20:50:19 [INFO] [ScriptCraftPlugin] Unzipping plugins/classroom/classroom.js
20:50:19 [INFO] [ScriptCraftPlugin] Unzipping plugins/commando/commando-test.js
20:50:19 [INFO] [ScriptCraftPlugin] Unzipping plugins/commando/commando.js
20:50:19 [INFO] [ScriptCraftPlugin] Unzipping lib/coffeescript.js
20:50:20 [SEVERE] [ScriptCraftPlugin] Error:Error: require('utils',/Users/kurt/CraftBukkit/scriptcraft/plugins/classroom) failed while executing module /Users/kurt/CraftBukkit/scriptcraft/plugins/classroom/classroom.js
20:50:20 [SEVERE] javax.script.ScriptException: sun.org.mozilla.javascript.internal.JavaScriptException: [object Error](Unknown source>#239) in at line number 239
20:50:20 [SEVERE] at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:156)
20:50:20 [SEVERE] at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:232)
20:50:20 [SEVERE] at net.walterhiggins.scriptcraft.ScriptCraftPlugin.onEnable(Unknown Source)
20:50:20 [SEVERE] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
20:50:20 [SEVERE] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:457)
20:50:20 [SEVERE] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:381)
20:50:20 [SEVERE] at org.bukkit.craftbukkit.v1_6_R3.CraftServer.loadPlugin(CraftServer.java:284)
20:50:20 [SEVERE] at org.bukkit.craftbukkit.v1_6_R3.CraftServer.enablePlugins(CraftServer.java:266)
20:50:20 [SEVERE] at net.minecraft.server.v1_6_R3.MinecraftServer.l(MinecraftServer.java:315)
20:50:20 [SEVERE] at net.minecraft.server.v1_6_R3.MinecraftServer.f(MinecraftServer.java:292)
20:50:20 [SEVERE] at net.minecraft.server.v1_6_R3.MinecraftServer.a(MinecraftServer.java:252)
20:50:20 [SEVERE] at net.minecraft.server.v1_6_R3.DedicatedServer.init(DedicatedServer.java:152)
20:50:20 [SEVERE] at net.minecraft.server.v1_6_R3.MinecraftServer.run(MinecraftServer.java:393)
20:50:20 [SEVERE] at net.minecraft.server.v1_6_R3.ThreadServerApplication.run(SourceFile:583)
20:50:20 [INFO] Server permissions file permissions.yml is empty, ignoring it
20:50:20 [INFO] Done (4.097s)! For help, type "help" or "?"

@SEAPUNK
Copy link
Contributor

SEAPUNK commented Dec 28, 2013

The issue has to deal with the new modules update.
Many modules aren't global anymore, so you're going to have to "require" them, so to speak.
The only issue with that atm is that the drones.js right now is used as a plugin right now, not a module, so you're going to have to try something like

/js require("/plugins/drone/drone.js").Drone().box(5)

_(note: it doesn't work, since the Drone module hasn't been fully converted to the new update)_

We're going to have to just wait for Walter to either update the module, or for me to make a pull request that updates the module.

@walterhiggins
Copy link
Owner

I'll look into the original error above...

20:50:20 [SEVERE] [ScriptCraftPlugin] Error:Error: require('utils',/Users/kurt/CraftBukkit/scriptcraft/plugins/classroom)

@Strategetical I don't recommend using require() at the in-game prompt. require() is for use by plugin authors. The above require would not work anyway because it's using an absolute path (unless your drone.js file was located in that exact path on the filesystem).

... Like I say, I'll look into the issue @kleaf reported.

@walterhiggins
Copy link
Owner

@kleaf Can you do me a favor? At the server console can you type ...

js config.verbose = true
js refresh()

And post the output here? Once posted you can turn off verbose scriptcraft reporting by typing...

js config.verbose = false

@ghost ghost assigned walterhiggins Dec 28, 2013
@SEAPUNK
Copy link
Contributor

SEAPUNK commented Dec 28, 2013

@walterhiggins Yes, but guess what.
The / directory with require is the same as {minecraft-directory}/scriptcraft/
That's the implied root for require. (for security/convenience reasons, I think)
I tested it, and it fetched the file just fine, as it looked for [mc]/scriptcraft/plugins/drone/drone.js

This may be for just Linux, I don't know, but it worked for me.

Rationale
These are the outputs of the below commands.
With the /
Without the /
notice the automatically appended directory of [mc]/scriptcraft/ as the second argument of require() in the error
Fetching from root
Fetching from PATH

@walterhiggins
Copy link
Owner

I can reproduce this problem on a Mac. Looking into it.

walterhiggins added a commit that referenced this issue Dec 29, 2013
walterhiggins added a commit that referenced this issue Dec 29, 2013
@walterhiggins
Copy link
Owner

Fixed in latest release

@konsumer
Copy link

konsumer commented Jan 5, 2014

#108 fixed it for me. Now /js box works in console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants