Refer to our WorldEdit Basics guide for an introduction.
Refer to our VoxelSniper Basics guide for an introduction.
Macros and Scripts
Have you ever thought how annoying it is to type in the same chain of WE commands for some very repetitive terraforming jobs? Replace X with Y, Gmask on, Replace Y with 50%Z,20%Q etc.? Well this no longer has to be the case! The following method allows you to do entire rivers with just a selection and some rudimentary surface brushing!
The Macro/Keybind Mod enables you to run a chain of commands to, for instance, create a river system with not more than the push of a single button, after creatively outlining the meanders and additional rivulets. The Mod allows conditionals and loops to be applied to our chain of commands which makes it insanely powerful. To understand more of its abilities, and to learn how to set up the mod, please refer to these introductions.
It is recommended to never use a script that you don't understand. Always test a script in a safe environment, the amount of damage you can do with a script you don't fully understand is extremely large.
Setting things up
- Download and install the Macro/Keybind Mod following the descriptions provided by the author.
- Browse our large Script Database and download the .txt file of the script of your choice.
- Move all your scripts into
and bind the script to a key.
- Execute the script following the Macro/Keybind Mod manual.
What are Scripts?
Scripts are not more than algorithms of WorldEdit commands, sometimes with some basic logic applied to them, that are automatically issued in your stead. In order to understand how scripts work you need to understand an approach to terraforming that's working solely based on selections and selection related commands. No brushes or similar can be used.
Let's look at an example:
We want a more or less rectangular shape for our field, but it should be off the grid. For that our regular cuboid selection (the default selection type: two points at opponent corners define a box within blocks are affected) isn't suitable as it only follows the grid. Using the polygon selection (//sel poly) we can select off-grid polygonal bodies with up to 21 vertices. WE would calculate the whole body within the selection points and commands would affect blocks that are located within it. Note that the polygonal shape only affects x and z values of our selection points. No matter on which y level our selection points lay, WE always takes the two most extreme y values, those of the lowest respectively highest selection point. The selected body will thusly always have a flat top and bottom, while otherwise it can have whatever shape.
Now that we selected an off-grid rectangle for our field, we need to replace the ground. But we only want to replace the top layer to later turn into the farmland block. This is very important, as stacked farmland blocks inevitably crash the server. In order to avoid that we need to tell WE to only affect the top layer, which we do using a mask. As you know, //mask only affects brushes, but there is the so called global mask (//gmask) which applies to most WE commands. If we only want to affect the top layer, but that layer consists of various materials, including some that would also be found underground (such as dirt or gravel) we need to define that only blocks that are located under a block of air are affected. We do that by applying a //gmask <0 (global mask under air). Now we can safely run a replace command that will only affect blocks that are located under a block of air.
With our global mask applied, we can now run a //replace [placeholder] farmland, which sets every block (but air) that is located under a block of air to farmland.
All that's left to do now is to add crops. In order to plant those, we need to change our global mask to a //gmask >farmland (global mask on farmland). This means, commands will only affect blocks that are located on a block of farmland.
We can now run a //replace air crops:7 in order to replace every block of air that is situated on a block of farmland with grown crops and the field is done.
Here is the full syntax:
<select polygonal field> //gmask <0 //replace 35:4 [placeholder block] //gmask //replace 35:4 60 [replace placeholder with farmland] //gmask >60 //replace 0 59:7 //gmask
We just planted a field with only a selection and a couple of commands. No brushes, no time-consuming flying in circles, no WE spam. A clean and efficient way to plant a field, and on both a small and larger scale a real time safer!
Rivers can be done in a similar fashion, only utilizing selections, gmasks and replaces.
However, you'll have to give WE some information to work off of, in this case a "2D" heightmap.
The way the heightmap works is fairly simple: We have 6 different colours, each indicating a different depth of the river.
|y-offset||grass||red||orange||light blue||cyan||dark blue||purple|
In order to get from a one-layer, "2D" heightmap to the three-dimensional result we were using a number of gmasks, replace-commands and placeholders. A total of 67 commands allows us to turn a couple of wool blocks into a very nice looking river, including a populated shoreline.
The colour scheme is:
Red (35:14): Transition Area: Mix of Grass, Dirt, Gravel, with mostly regular grass and some tall grass
Orange (35:1): Shoreline: Very little Grass and Dirt, some River Rocks, more Mud and Gravel, majorly Wet Sand
Light Blue (35:3):Water, percentage of Mud, Gravel and Dirt increases compared to Wet Sand
Cyan (35:9): Water, mostly Mud and Dirt, some Sand and River Rocks
Blue (35:11): Water, almost the same as above
Purple (35:10): Water, almost the same as above
The user can vary the size and depth of the river by leaving away colours and changing the width of each respective layer. The maximal depth is 4 blocks of water, which is 5 blocks below the colour code level.