Writing and Editing Code
There are two primary methods to writing Mindustry Logic: The Visual Editor and manual editing. Each is better in their own way, so choose whichever works for you the best.
The Visual Editor
The Visual Editor is the "Editing" interface of a processor (when you press the "pencil" button). It's the recommended method for beginners, since it has been designed to be easy to understand and use.
The advantages of editing this way as opposed to editing manually are:
- A block-based, color-coded, drag-and-drop interface
- Easy parameter chooser, shows all of the needed parameters
- Visual, easy-to-set jump relationships
- Mobile-friendly
You can also export and import code to and from text form.
Manual Editing
Manual editing involves using a text editor such as Notepad++, Vim, or Visual Studio Code to edit your code. For more advanced users and longer code, manual editing is the way to go.
The advantages of manually editing code as opposed to the Visual Editor are:
- Denser than the Visual Editor; more code can be seen at a time
- Typing is faster than dragging-and-dropping across long walls of code
- Can be used to make quick pieces of code for demonstration without opening Mindustry
- Syntax highlighting in some editors, such as VS Code (plugin), Emacs (package), Vim (plugin), and Sublime Text (package)
- A text block does not block part of the parameter text
- Ability to save and access code outside of Mindustry
However, it can be a little difficult for beginners or those who aren't used to editing code, since variables have to be typed out explicitly, and jumps can get very messy without a visual guide, among other things.