<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://dwarffortresswiki.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Prios</id>
	<title>Dwarf Fortress Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://dwarffortresswiki.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Prios"/>
	<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php/Special:Contributions/Prios"/>
	<updated>2026-05-04T15:06:48Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.11</generator>
	<entry>
		<id>http://dwarffortresswiki.org/index.php?title=v0.31:Macros_and_keymaps&amp;diff=123077</id>
		<title>v0.31:Macros and keymaps</title>
		<link rel="alternate" type="text/html" href="http://dwarffortresswiki.org/index.php?title=v0.31:Macros_and_keymaps&amp;diff=123077"/>
		<updated>2010-07-30T03:31:38Z</updated>

		<summary type="html">&lt;p&gt;Prios: /* AutoHotKey */ Created link to 40d macros page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{av}}&lt;br /&gt;
{{Quality|Fine}}&lt;br /&gt;
Playing Dwarf Fortress means lots of typing. The game has an internal macro/keymap system. Using it or any external program can save you a great deal of time when dumping, rewalling, designating, and so forth.&lt;br /&gt;
&lt;br /&gt;
== DF macros ==&lt;br /&gt;
The current version has the ability to create macros. The controls for doing so are as follows:&lt;br /&gt;
&lt;br /&gt;
*{{k|Ctrl}}+{{k|r}} = record&lt;br /&gt;
*{{k|Ctrl}}+{{k|p}} = play&lt;br /&gt;
*{{k|Ctrl}}+{{k|s}} = save&lt;br /&gt;
*{{k|Ctrl}}+{{k|l}} = load&lt;br /&gt;
&lt;br /&gt;
To create a macro press {{k|Ctrl}}+{{k|r}} to begin recording your actions. When you have recorded all the action you want stop recording by hitting {{k|Ctrl}}+{{k|r}} again and save ({{k|Ctrl}}+{{k|s}}) the macro. The macro is then added to your macro list. To load a macro form the list just press {{k|Ctrl}}+{{k|l}}. You can then play the macro using {{k|Ctrl}}+{{k|p}}.&lt;br /&gt;
&lt;br /&gt;
There is a directory data/init/macros for them. The macros are saved in .mak format. Even a recorded file for a simple marco - for example to create a 3 tiles wide ramp - may already consist of up to 50 commands listed. This is because every possible {{l|Key_bindings|binding of the key pressed}} is included in the macro and put in a block (and {{k|r}} for ramp has many by default).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pressing_enter_recorded&lt;br /&gt;
		SELECT&lt;br /&gt;
		CLOSE_MEGA_ANNOUNCEMENT&lt;br /&gt;
		WORLD_PARAM_ENTER_VALUE&lt;br /&gt;
		SETUPGAME_SAVE_PROFILE_GO&lt;br /&gt;
		D_BURROWS_DEFINE&lt;br /&gt;
		D_MILITARY_ALERTS_SET&lt;br /&gt;
	End of group&lt;br /&gt;
		CUSTOM_CTRL_R&lt;br /&gt;
	End of group&lt;br /&gt;
End of macro&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For this example the recording was started, enter was pressed and the recording was stopped. When using this macro every underlying command in the file will be called, if possible. If you are in the designation menu, it will react as a select, the other commands will be ignored. If you are in the burrow menu, it will work like pressing enter there. The macro alway ends with a block containing the end of it's recording. But executing macros seems to ignore this command. If you have changed your key bindings you'll get another result, because the underlying commands are recorded, not the keys pressed.&amp;lt;br /&amp;gt;&lt;br /&gt;
When creating or editing your own macros it is a good idea to use only those commands you really want.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ramping_created&lt;br /&gt;
		DESIGNATE_RAMP&lt;br /&gt;
	End of group&lt;br /&gt;
		CURSOR_DOWN_Z&lt;br /&gt;
	End of group&lt;br /&gt;
		SELECT&lt;br /&gt;
	End of group&lt;br /&gt;
		CURSOR_RIGHT&lt;br /&gt;
	End of group&lt;br /&gt;
		CURSOR_RIGHT&lt;br /&gt;
	End of group&lt;br /&gt;
		SELECT&lt;br /&gt;
	End of group&lt;br /&gt;
		CURSOR_LEFT&lt;br /&gt;
	End of group&lt;br /&gt;
		CURSOR_LEFT&lt;br /&gt;
	End of group&lt;br /&gt;
		CURSOR_UP&lt;br /&gt;
	End of group&lt;br /&gt;
End of macro&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This selfmade example will designate a 3 tiles wide ramp one z-level below and place the cursor to make the next execution of the macro continue the way down. The first line has to be the name of the file. You can see that there are grouping tags for every single keypress. These are important for a working macro.&amp;lt;br /&amp;gt;&lt;br /&gt;
It is unknown if there is the possibility of creationg loops/iterations, other programming features or comments.&amp;lt;br /&amp;gt;&lt;br /&gt;
There seem to be problems with changing removing and adding macros while the game is running. Save, quit and restart the game when you want to change something.&lt;br /&gt;
&lt;br /&gt;
== External utilities ==&lt;br /&gt;
&lt;br /&gt;
=== AutoHotKey ===&lt;br /&gt;
#  Go to {{L|Utilities#AutoHotKey}} and download AutoHotKey.  Installation is simple and the program uses few system resources.&lt;br /&gt;
#  Write macro scripts (file type .ahk), which may contain any number of commands.  You activate scripts by double-clicking .ahk files and deactivate them by right-clicking the AutoHotKey icon on the task bar.  Both of these can be done at any time - even right in the middle of a game.  AutoHotKey also allows for automated activation of scripts.&lt;br /&gt;
&lt;br /&gt;
:'''Please see also the [[40d:Macros and Keymaps|40d macros page]], as much of what is there works perfectly fine. If you can verify it works, please move it to this page.'''&lt;br /&gt;
&lt;br /&gt;
==== Troubleshooting Scripts ====&lt;br /&gt;
Users may experience some issues in getting scripts to work, particularly when using looping scripts when experiencing low frame-rates.&lt;br /&gt;
* If experiencing low frame-rates, try adding delays (&amp;quot;Sleep 100&amp;quot; to pause for 100 milliseconds for example) within loops to allow the interface to keep up. If there are nested loops, sometimes adding a pause at the end of an inner loop is all that is needed to flush the keyboard buffer&lt;br /&gt;
* Another way to add delay during and after each simulated key press is to put &amp;lt;B&amp;gt;SetKeyDelay, 40, 40&amp;lt;/B&amp;gt; at the start of the macro.&lt;br /&gt;
* Make sure that Dwarf Fortress maintains focus. IM windows are the enemy! Who needs friends anyhow? You've got Dwarf Fortress.&lt;br /&gt;
* This may go without saying, but most macros assume standard key-mappings. If you're using non-standard ones, you may have to edit the macro to get it to work.&lt;br /&gt;
* Visiting liaisons can bring up screens that eat keystrokes, throwing a long-looping script out-of-phase with where it expects the game to be.  Wait for the farewell screen before running a long script.&lt;br /&gt;
* The &amp;lt;B&amp;gt;SendPlay&amp;lt;/B&amp;gt; function supports keys that the &amp;lt;B&amp;gt;Send&amp;lt;/B&amp;gt; function does not, for example {{key|Shift-Enter}}.  According to the AutoHotKey documentation, &amp;lt;B&amp;gt;SendPlay&amp;lt;/B&amp;gt; may also be better at preventing dropped keystrokes.&lt;br /&gt;
&lt;br /&gt;
==== General Fortress Mode Hotkeys Script ====&lt;br /&gt;
An attempt at speeding up various designations. Includes an up/down stair builder, a fast move up/down, and some select-and-advance keys. Please see [[user:DDR#Dwarf_Fortress_General_AHK_Script]].&lt;/div&gt;</summary>
		<author><name>Prios</name></author>
	</entry>
</feed>