wiki:ExportingFromCommandLine

It is possible to export from the command line using WorldPainter's scripting support.

Step 1

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.

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:

var filename = 'test.world';
var exportDir = '.';

print('Loading world ' + filename);
var world = wp.loadWorld(filename);

print('Exporting world');
wp.exportWorld(world, exportDir);

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.

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.

Step 2

Run the script from the directory where the .world file is:

cd /dir/to/world/files
wpscript exportworld.js

Of course you can adapt the script to include the full path to the .world file and/or specify a different export directory.

Notes

  • 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.
  • 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.
Last modified 7 years ago Last modified on Apr 15, 2018, 7:13:16 PM
Note: See TracWiki for help on using the wiki.