This is Dwarf Fortress Automation repository - home of Dwarf Fortress macro's
Releases of Dwarf Fortress Automation project: https://github.com/TopStreamsNet/df-automation/releases
Some information on Dwarf Fortress macro's can be found in Dwarf Fortress Wiki
Simple macro that would designate a line of length 5 left from cursor position for mining.
Create HelloWorld.mak file with following content in /data/init/macros
!!!Important!!! File name should match first line of the macro
HelloWorld
DESIGNATE_DIG
SELECT
CURSOR_LEFT
CURSOR_LEFT
CURSOR_LEFT
CURSOR_LEFT
SELECT
End of macro
Note: There should be an empty line at the end of the macro file, or loading will fail with an error - "I/O error while loading macro"
Now in game use Ctrl+l to bring up load macro menu:
Select desired macro (in this example case HelloWorld is the only macro available) and press Enter.
To run the macro:
- Switch into Designation menu - d
- Place your cursor into position from where you wand macro to start
- Press Ctrl+p - notice "Play" label indicator:
Dwarf Fortress uses some weird caching mechanism, so simply reloading previously loaded macro with Ctrl+l won't work. To "reload" a macro one needs to delete existing macro, recreate it and then reload it. Here is how this can be done:
Having HelloWorld macro loaded lets say we want to modify it to designate a 5x5 area instead of 5x1. This means that original HelloWorld macro needs to be modified to be the following:
HelloWorld
DESIGNATE_DIG
SELECT
CURSOR_LEFT
CURSOR_LEFT
CURSOR_LEFT
CURSOR_LEFT
CURSOR_DOWN
CURSOR_DOWN
CURSOR_DOWN
CURSOR_DOWN
SELECT
End of macro
Note: There should be an empty line at the end of the macro file, or loading will fail with an error - "I/O error while loading macro"
-
Get into macro's management menu, to get there enter Options menu with Esc, then, using arrow keys to navigate and Enter to select, open Key Bindings menu and Macros would be the first submenu.
-
Delete existing macro that to be reloaded (HelloWorld in this example) using BackSpace !!!WARNING!!! Macro you are deleting is going to be also removed from data/init/macros/ directory - so make sure that NEW content is not yet there and original is backed up if needed
-
Now, before leaving the menu or doing anything else - place new content into data/init/macros/, then leave Macros menu pressing Esc and exit Key Binding menu saving changes
-
Exit Options menu by pressing Esc and load desired macro by using Ctrl+l
-
Switch into Designation menu with d and run new (reloaded) macro with Ctrl+p