ScriptCraft

ScriptCraft

14.6k Downloads

require('drone') can't find the drone plugin

walteriousnut opened this issue ยท 5 comments

commented

Running the latest CanaryMod (1.2.0) and ScriptCraft (3.1.3) get the following error after setting up the skyscraper.js sample.

[07:53:17] [org.scriptcraftjs.canarymod.ScriptCraftPlugin] [ERROR]: Plugin C:/Coderdojo/CanaryMod/scriptcraft/plugins/sk
yscraper.js Error: Error executing module C:/Coderdojo/CanaryMod/scriptcraft/plugins/skyscraper.js line #212 : require()
failed to find matching file for module 'drone' in working directory 'C:\Coderdojo\CanaryMod\scriptcraft\plugins' and
not found in paths ["C:/Coderdojo/CanaryMod/scriptcraft/lib/","C:/Coderdojo/CanaryMod/scriptcraft/modules/"]

Here's the Full boot sequence
image

I tried require('utils') and this is discovered successfully but utils is a module and drone is a plugin.

and this is the skyscraper.js plugin code (should be as-is from the tutorial)

function myskyscraper( floors ) {
var i ;
if ( typeof floors == 'undefined' ) {
floors = 10;
}
// bookmark the drone's position so it can return there later
this.chkpt('myskyscraper');
for ( i = 0; i < floors; i++ ) {
this
.box(blocks.iron,20,1,20)
.up()
.box0(blocks.glass_pane,20,3,20)
.up(3);
}
// return the drone to where it started
this.move('myskyscraper');
};
var Drone = require('drone');
Drone.extend( myskyscraper );

commented

I've tried reproducing this problem with the following code from the young person's guide to modding minecraft and have been unable to reproduce the issue so I'm closing it.

function myskyscraper( floors ) {
  var i ;
  if ( typeof floors == 'undefined' ) {
    floors = 10;
  }
  // bookmark the drone's position so it can return there later
  this.chkpt('myskyscraper'); 
  for ( i = 0; i < floors; i++ ) {
    this
      .box(blocks.iron,20,1,20)
      .up()
      .box0(blocks.glass_pane,20,3,20)
      .up(3);
  }
  // return the drone to where it started
  this.move('myskyscraper'); 
};
var Drone = require('drone'); 
Drone.extend( myskyscraper );
commented

Do you have the latest version of ScriptCraft installed?

commented

I have the same problem with ScriptCraft 1.2.0

Please wait while the libraries initialize...
Starting: CanaryMod 1.8.0-1.2.0
Canary Path: /tmp/canarymod/CanaryMod-1.2.0.jar & Working From: /tmp/canarymod
Registered xml Database
Found 1 plugins; total: 1
[10:36:34] [CanaryMod] [INFO]: Starting: CanaryMod 1.8.0-1.2.0
[10:36:34] [CanaryMod] [INFO]: Canary Path: /tmp/canarymod/CanaryMod-1.2.0.jar & Working From: /tmp/canarymod
[10:36:35] [CanaryMod] [INFO]: Registered xml Database
[10:36:35] [CanaryMod] [INFO]: Found 1 plugins; total: 1
[10:36:39] [net.minecraft.server.dedicated.DedicatedServer] [INFO]: Starting minecraft server version 1.8
[10:36:39] [net.minecraft.server.dedicated.DedicatedServer] [INFO]: Loading properties
[10:36:39] [net.minecraft.server.dedicated.DedicatedServer] [INFO]: Generating keypair
[10:36:39] [net.minecraft.server.dedicated.DedicatedServer] [INFO]: Starting Minecraft server on *:25565
[10:36:40] [CanaryMod] [INFO]: Enabling early Plugins...
[10:36:40] [CanaryMod] [INFO]: Enabling late Plugins...
[10:36:40] [CanaryMod] [INFO]: Enabling plugin org.scriptcraftjs.canarymod.ScriptCraftPlugin
[10:36:44] [org.scriptcraftjs.canarymod.ScriptCraftPlugin] [WARN]: alias plugin is not yet supported in CanaryMod
[10:36:44] [org.scriptcraftjs.canarymod.ScriptCraftPlugin] [WARN]: commando-test not yet supported in CanaryMod
[10:36:44] [org.scriptcraftjs.canarymod.ScriptCraftPlugin] [WARN]: commando plugin is not yet supported in CanaryMod
[10:36:47] [org.scriptcraftjs.canarymod.ScriptCraftPlugin] [WARN]: cow-clicker minigame is not yet supported in CanaryMod
[10:36:47] [org.scriptcraftjs.canarymod.ScriptCraftPlugin] [WARN]: signs/menu is not yet supported in CanaryMod
[10:36:47] [org.scriptcraftjs.canarymod.ScriptCraftPlugin] [WARN]: arrows plugin not yet supported in CanaryMod
[10:36:47] [org.scriptcraftjs.canarymod.ScriptCraftPlugin] [ERROR]: Plugin /tmp/canarymod/scriptcraft/plugins/MaxPrih/myskyscraper.js Error: Error executing module /tmp/canarymod/scriptcraft/plugins/MaxPrih/myskyscraper.js line #212 : require() failed to find matching file for module 'drone' in working directory '/tmp/canarymod/scriptcraft/plugins/MaxPrih' and not found in paths ["/tmp/canarymod/scriptcraft/lib/","/tmp/canarymod/scriptcraft/modules/"]
undefined

undefined

[10:36:48] [net.minecraft.server.MinecraftServer] [INFO]: Preparing start region for level default_NORMAL (0)
[10:36:48] [net.minecraft.server.dedicated.DedicatedServer] [INFO]: Done (9.021s)! For help, type "help" or "?"
[10:36:49] [org.scriptcraftjs.canarymod.ScriptCraftPlugin] [INFO]: js-patch setTimeout() test complete

commented

Hi @prihodko
Can you upgrade to the latest version of ScriptCraft?

commented

Thanks. I don't know what happened, but somewhere in the guides the link to ScriptCraft pointed to an old version and I thought I had the latest one. Anyway, it all works with version 3.1.3.