| 1 | It is possible to export from the command line using !WorldPainter's scripting support. |
| 2 | |
| 3 | = Step 1 = |
| 4 | |
| 5 | Write the script which will export the world. !WorldPainter uses Java's built-in scripting support called JSR223. By default it supports !JavaScript, but you can install support for many other scripting languages. To find out if your favourite scripting language is supported, google "''language'' jsr223". You're on your own with getting it to work though! Google is your friend. |
| 6 | |
| 7 | This instruction will assume you'll be using !JavaScript. A script to load a .world file and export it to a Minecraft map might look something like: |
| 8 | |
| 9 | {{{ |
| 10 | #!js |
| 11 | var filename = 'test.world'; |
| 12 | var exportDir = '.'; |
| 13 | |
| 14 | print('Loading world ' + filename); |
| 15 | var world = wp.loadWorld(filename); |
| 16 | |
| 17 | print('Exporting world'); |
| 18 | wp.exportWorld(world, exportDir); |
| 19 | }}} |
| 20 | |
| 21 | Name it `exportworld.js` and place it in the directory where your .world files are. The extension is important, as it is how Java detects the scripting language used. |
| 22 | |
| 23 | This script will load a .world file named `test.world` from the current directory, and export it to a directory called `test` in the current directory. |
| 24 | |
| 25 | = Step 2 = |
| 26 | |
| 27 | Run the script from the directory where the .world file is: |
| 28 | |
| 29 | {{{ |
| 30 | cd /dir/to/world/files |
| 31 | wpscript exportworld.js |
| 32 | }}} |
| 33 | |
| 34 | Of course you can adapt the script to include the full path to the .world file and/or specify a different export directory. |
| 35 | |
| 36 | = Notes = |
| 37 | |
| 38 | * There is no way to change the export settings from the script yet, so you must store those in the .world file beforehand. You can do that by starting an export (with your desired settings) in !WorldPainter, cancelling the export and then saving the .world file. |
| 39 | * To get !WorldPainter on the server, if you can't run an installer (because there is no graphical environment, for instance), you can use one of the installerless archives. The download links are in the text underneath the download links for the installers. Just extract it to a directory of your choice. |