Need help? Ask on the forum, ask a fellow user or developer (join us on IRC), or contact sk89q.
Contribute to the wiki, edit this page! Register an account, or login with Facebook first.
HEY! Do you integrate (or want to) a plugin into yours? Do you help work on WE/WG/etc.? Please subscribe to our mailing list!
WorldEdit
Scripting
Scripts allow you to program small tasks without having to learn Java, figure out how to compile WorldEdit, or bother with reinventing the wheel. CraftScripts are written in JavaScript.
The scripting support that was available before v0.8 of WorldEdit is different.
Contents |
Installing scripts
Create a plugins/WorldEdit/craftscripts/ directory in your server's root directory (.minecraft directory if single player) and place CraftScript files there. Script files should end with a .js extension.
Bundled scripts
Four scripts come with the WorldEdit download (be sure to copy the plugins/WorldEdit/craftscripts/ folder in the root directory from the download if you want them).
| Filename | Parameters | Description |
|---|---|---|
| maze.js | <block> [width] [length] | Generates a maze with wall height of two made out of the specified block. |
| draw.js | <image-file> [v] | Renders an image file in-game with colored cloth blocks. Use the v parameter to draw it vertically. Image file must be placed into a plugins/WorldEdit/drawings/ directory. |
| quickshot.js | <note1> [note2] ... | Creates a basic set of note blocks linked together with Redstone. Example usage: quickshot.js 1a# 1c 2f
|
| roof.js | <block> | Builds a pyramid roof over your selection. |
Running scripts
-
/cs <script name> [args...] -
/.s [args...](re-executes last used script) -
/<script>.js [args...](shortcut)
This command runs the script. Don't forget the .js extension. Extra parameters can be given to the script file if it uses them.
Installing Rhino
In case your version of Java doesn't come with the necessary components (you get a "Failed to find an installed script engine."), you will have to install the Rhino JavaScript engine. If you get a "ReferenceError," then installing Rhino may fix your problem.
You should install Rhino if possible because the bundled version of Rhino that comes with Java is very slow
Writing scripts
Please see the development page.
Scripts are written in JavaScript.