Once you've installed the macro mod, as described here, you are able to not only able to run a lot of World Edit commands in simple sequence, but also using iterative using loops and adaptive to special conditions.
In this thread, I'll try to outline and collect some of the quirks of this awesome power while also touching on things that I consider good conduct.
Resources:
FAWE Wiki
Macro/Keybind Mod Readme
Tham's Script Collection And Macro Config
Good Conduct:
In this thread, I'll try to outline and collect some of the quirks of this awesome power while also touching on things that I consider good conduct.
Resources:
FAWE Wiki
Macro/Keybind Mod Readme
Tham's Script Collection And Macro Config
Good Conduct:
- Use log statements at the very beginning of your script to introduce what your script does and what preconditions need to be met for it to run:
Code:$${LOG(Before you start using this script)}$$$${LOG(make sure that you have selected ONLY the y layer of the water surface)}$$ $${LOG(This script provides three general profiles:)}$$ $${LOG(U-shaped, U: each step becomes one block wider)}$$ $${LOG(U-shaped inverted, UI: the first step is as wide as the provided maximum depth, each subsequent step becomes one block shorter)}$$ $${LOG(V-shaped, V: equal step size all the way down, you will be prompted for the step size)}$$ $${LOG(Custom, C: you will be prompted at each step for the desired step size)}$$
- Keep using log statements throughout to indicate the different stages of your script. This is both helpful for you and others for debugging but also to see if execution runs without interruptions.
Code:ELSEIF(%&type% == "UI") LOG(Initiating inverted U-shaped profile) #width = #maxdepthminus2
- Also, consider using a log statement at the end of the script. This is a nice indicator that all commands in your script have been triggered. Although it is important to point out that due to the asynchronicity of FAWE the commands may NOT have completed yet.
Code:$${WAIT(1)}$$|//replace 0 31:1,31:2 $${WAIT(2)}$$| $${LOG(Script Complete)}$$|
- Avoid using /gmask if possible. In scripts, this is quite an expensive operation! If you use it without accounting for the time it takes to mask/unmask the scripts commands may run out of sync and mess up a large area big time! Instead, use smarter /replace or /rep statements:
Code://replace <[air]&[white] #biome[river]
Code://gmask <[air] //rep white #biome[river]
- ALWAYS, seriously, always use placeholders when you work with scripts. I prefer to use wool because I can simply use color words like 'red' and 'black' etc. However, that's obviously a little more difficult when working with selections that already contain wool blocks i.e. scripts that are supposed to run on an area after some construction has been done. In this case I'd suggest mapping the wool blocks to concrete bocks first and then mapping them back once the script is completed. Wool is nice for the above reason, concrete is nice because it most definitely isn't used in regular builds and coloured glass is nice because you can see through it (good for scripts that work with caves or rivers). Try to take great care never to mask/ replace 'natural' blocks i.e. blocks that could be used, instead map to a placeholder and at the end of the script map it back to regular blocks.
Code://replace [blue] #simplex[6][30%blue,70%pink]$${WAIT(1)}$$ //replace [[blue]&~[pink][1][8]] pink,blue $${WAIT(1)}$$ //replace [[wool]&<[pink]] brown $${WAIT(1)}$$ $${LOG(Transform Wool)}$$ //replace blue 90%air,3%2006:6,7%2205:2,3%2061:6,7%2061:8 $${WAIT(1)}$$ //replace pink air $${WAIT(1)}$$ //replace [[air]&>[brown]] 2066:12 $${WAIT(1)}$$ //replace white #simplex[7][70%black,15%2034:0] $${WAIT(1)}$$ //replace brown 2034:1 $${WAIT(1)}$$
- Try to make modular scripts. Here's an example of how you could do it. Imagine you want to create a field script. Some fields require rows of crops, some are just densely packed. Instead of bundling the logic to determine the packing with each crop, separate it out into a script of it's own. Now users can create a bunch of shapes to their liking and override the 'packing' placeholders with the crops of their choice.
I'll edit this thread over the coming week to include more guidelines and give y'all a brief rundown on the more arcane things to do with the Macro/Keybind Mod like variables, loops, and controlflow; and the maths functionality from FAWE. Gotta run!
Last edited: