v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

40d:Macros and keymaps

From Dwarf Fortress Wiki
Revision as of 02:19, 20 December 2008 by Daedalusai (talk | contribs) (add script name)
Jump to navigation Jump to search

Playing Dwarf Fortress means lots of typing. Although the game (as of version v0.27.176.38c) has no internal macro/keymap system, using an external program can save you a great deal of time when dumping, rewalling, designating, and so forth.

  1. Go to Utilities#AutoHotKey and download AutoHotKey. Installation is simple and the program uses few system resources.
  2. 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.


AutoHotKey Examples

Dumping

Stock Screen Dump

Taken from an old version of Jackard's user page.

To use, first have your bookeeper do enough desk work so you can view individual items in the stocks listing. Then bring it up and press del to quickly mark stuff. To adjust the key repeat rate, edit the KEY_HOLD_MS value in \data\init\init.txt.

del::
IfWinActive Dwarf Fortress
{
  send d{down}
  return
}
else
{
  send {del}
  return
}

Designation Dump

A dumping script by Dukederek:

This script uses a system similar the commands in the designations menu to mark most of the contents of a large area for dumping. My talk page has more detailed instruction.

Essentially you need to create two text files with the following titles and content. When playing DF it is safe to have blockdumpinit running constantly as long as you dont plan on using the ctrl-d combination for something else.

blockdumpinit.ahk

^d::
RunWait, "blockdumpmain.ahk"
Return

blockdumpmain.ahk

SetKeyDelay 25
return::
Send k
return
up::
Send w
return
left::
Send a
return
down::
Send s
return
right::
Send d
return
q::
ExitApp
return
shift::
x := 0
y := 1
Loop{
Input, keypress, B, {esc} , w,a,s,d,k,q
if keypress = w
{
y := --y
Send {up}
continue
}else if keypress = s
{
y := ++y
Send {down}
continue
}else if keypress = a
{
x := --x
Send {left}
continue
}else if keypress = d
{
x := ++x
Send {right}
continue
}else if keypress = k 
{
break
}else if keypress = q
{
ExitApp
}
}
y := y / 2
z := y
z := Floor(z)
z := y/z
Send d{NumpadAdd}d
If z = 0
{	
If x = 0
ExitApp
Else{
Loop %x%{
Send {left}d
}ExitApp
}
}If z <> 1
{
Loop %y%{
Loop %x%{
Send {left}d{NumpadAdd}d
}Send {up}d
Loop %x%{
Send {right}d{NumpadAdd}d
}Send {up}d{NumpadAdd}d
}Loop %x%{
Send {left}d{NumpadAdd}d
}
}Else If z = 1
{
y := y + 0.5
Loop %y%{
Loop %x%{
Send {left}d{NumpadAdd}d
}Send {up}d
Loop %x%{
Send {right}d{NumpadAdd}d
}Send {up}d{NumpadAdd}d
}Send d{NumpadSub}d
}ExitApp

Rewalling

Taken from Valdemar's user page.

This is a macro to aid with rewalling. To use, copy-paste the script into a new .ahk file and run the script with AutoHotkey. Then, in Dwarf Fortress, press b-C-w, move the cursor to where you want to start the wall, and hold Ctrl-Shift-Arrowkey, using the direction you want to rewall in. To build floors, press b-C-f instead, and use Ctrl-Alt-Arrowkey. To stop, just release the keys.

The script will use the first material in the list. I suggest you create a stockpile near the construction site that only accepts the item you wish to build with and temporarily forbid any nearby materials you don't want to build with.

$^+Left:: ProcessEvent("Left","w")
$^+Right:: ProcessEvent("Right","w")
$^+Up:: ProcessEvent("Up","w")
$^+Down:: ProcessEvent("Down","w")

$^!Left:: ProcessEvent("Left","f")
$^!Right:: ProcessEvent("Right","f")
$^!Up:: ProcessEvent("Up","f")
$^!Down:: ProcessEvent("Down","f")


ProcessEvent(direction, type)
{   
    Send {Enter}
    Sleep 100
    Send {Enter}
    Sleep 100
    Send %type%
    Sleep 100
    Send {%direction%}
    Loop
    {
        if not GetKeyState(direction, "P") 
            break  
        Send {Enter}
        Sleep 100
        Send {Enter}
        Sleep 100
        Send %type%
        Sleep 100
        Send {%direction%}
    }
}


Grid-by-grid designation

For easier diagonal and fancy mining. Assumes that DF is active. "^!" means ctrl-alt-direction.

^!NumpadEnd::
send {Enter}{Enter}{NumpadEnd}
return
^!NumpadDown::
send {Enter}{Enter}{NumpadDown}
return
^!NumpadPgDn::
send {Enter}{Enter}{NumpadPgDn}
return
^!NumpadLeft::
send {Enter}{Enter}{NumpadLeft}
return
^!NumpadRight::
send {Enter}{Enter}{NumpadRight}
return
^!NumpadHome::
send {Enter}{Enter}{NumpadHome}
return
^!NumpadUp::
send {Enter}{Enter}{NumpadUp}
return
^!NumpadPgUp::
send {Enter}{Enter}{NumpadPgUp}
return

Embark Settings macros

These macros are used to ease the setup of skills and supplies before you embark.


Improved Food/Alcohol buying macro

This macro buys all the cost-2 food (that I have seen), as well as the four types of alcohol. Just press ctrl+f on the Items screen. It can deal with meat or drink that you already have, or is not currently featured. By Redfenix.

^f::

send ndwarven{SPACE}ale{RIGHT}{ENTER}{F9}
send ndwarven{SPACE}rum{RIGHT}{ENTER}{F9}
send ndwarven{SPACE}beer{RIGHT}{ENTER}{F9}
send ndwarven{SPACE}wine{RIGHT}{ENTER}{F9}
send ndonkey{SPACE}meat{RIGHT}{ENTER}{F9}
send nchimpanzee{SPACE}meat{RIGHT}{ENTER}{F9}
send ngazelle{SPACE}meat{RIGHT}{ENTER}{F9}
send nbonobo{SPACE}meat{RIGHT}{ENTER}{F9}
send nmule{SPACE}meat{RIGHT}{ENTER}{F9}
send ndeer{SPACE}meat{RIGHT}{ENTER}{F9}
send nraccoon{SPACE}meat{RIGHT}{ENTER}{F9}
send nfox{SPACE}meat{RIGHT}{ENTER}{F9}
send nrhesus{SPACE}macaque{SPACE}meat{RIGHT}{ENTER}{F9}
send nhorse{SPACE}meat{RIGHT}{ENTER}{F9}
send ngroundhog{SPACE}meat{RIGHT}{ENTER}{F9}
send nmountain{SPACE}goat{SPACE}meat{RIGHT}{ENTER}{F9}
send nhoary{SPACE}marmot{SPACE}meat{RIGHT}{ENTER}{F9}
send ngorilla{SPACE}meat{RIGHT}{ENTER}{F9}
send norangutan{SPACE}meat{RIGHT}{ENTER}{F9}
send nsiamang{SPACE}meat{RIGHT}{ENTER}{F9}
send nbilou{SPACE}meat{RIGHT}{ENTER}{F9}
send npileated{SPACE}gibbon{SPACE}meat{RIGHT}{ENTER}{F9}
send nmandrill{SPACE}meat{RIGHT}{ENTER}{F9}
send nturtle{RIGHT}{ENTER}{F9}

'First Fortress' setup

This macro works with the default setup of DF, and starts you with (almost) the setup suggested in the "Your first fortress" tutorial. The amounts are adjustable with the variables at the top of the macro.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; materialplanner.ahk					  	;
; this is a ahk script to set up the embark settings roughly as	;
;suggested in the "your first fortress" tutorial.  Inventory	;
;can be customized slightly.					;
; use ctrl+shift+e to run				  	;
;							  	;
; NOTEs:						  	;
; change variables to suit your desires			 	;
; the fourth guy is a Stonecrafter instead of Herbalist		;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;
;;VARIABLES;;
;;;;;;;;;;;;;

PICKS = 2	;number of picks to pack
AXES = 1 	;number of axes to pack
ANVILS = 0	;number of anvils to pack
MEATS = 7	;how much meat to take, each buys one of each cheap type (total number depends on locale)
DRINKS = 26	;how many drinks to take, each one buys 4 drinks, one of each type
SEEDS = 5	;each increment buys 5 plump helmet spawn, 2 pig tail, and 2 rock nuts



SetKeyDelay, 12	;Key delay, to keep Dwarf Fortress from being overwhelmed.
		:Set higher if you get weird results, or lower to get the
		:script to run faster
SLEEPTIME = 12	;same thing, only used in the repeated key press loops though

;;;;;;;;;;;;
;;The code;;
;;;;;;;;;;;;

^+e::
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


			;remove all of the items
Send {Tab}


loop 105{
	Send {NumpadSub}
	Sleep %SLEEPTIME%
}

Send {Tab}

			;place the skills
			;first guy
			;Proficient Miner
Send {right}
loop 5{
	Send {NumpadAdd}
	Sleep %SLEEPTIME%
}
			;novice appraiser
Send {PgUp}
loop 7{
	Send {Up}
	Sleep %SLEEPTIME%
}
Send {NumpadAdd}
			;novice Judge of Intent
Send {Up}
Send {NumpadAdd}
			;competent gem setter
Send {PgUp}
Send {PgUp}
loop 7{
	Send {Up}
	Sleep %SLEEPTIME%
}
loop 3{
	Send {NumpadAdd}
	Sleep %SLEEPTIME%
}
			;second guy
Send {Left}
Send {Down}
Send {Right}
Send {PgUp}
			;Proficient Miner
loop 5{
	Send {NumpadAdd}
	Sleep %SLEEPTIME%
}
			;Proficient Mason
loop 3{
	Send {Down}
	Sleep %SLEEPTIME%
}
loop 5{
	Send {NumpadAdd}
	Sleep %SLEEPTIME%
}
			;third guy
Send {Left}
Send {Down}
Send {Right}
			;Proficient Carpenter
Send {UP}
loop 5{
	Send {NumpadAdd}
	Sleep %SLEEPTIME%
}
			;Proficient Wood Cutter
Send {UP}
loop 5{
	Send {NumpadAdd}
	Sleep %SLEEPTIME%
}
			;fourth guy
Send {Left}
Send {Down}
Send {Right}
			;Proficient Grower
Send {PgDn}
Send {Down}
Send {Down}
loop 5{
	Send {NumpadAdd}
	Sleep %SLEEPTIME%
}
			;Proficient Stone Crafter
loop 9{
	Send {Up}
	Sleep %SLEEPTIME%
}
loop 5{
	Send {NumpadAdd}
	Sleep %SLEEPTIME%
}
			;fifth guy
Send {Left}
Send {Down}
Send {Right}
			;Proficient Mechanic
loop 5{
	Send {Down}
	Sleep %SLEEPTIME%
}
loop 5{
	Send {NumpadAdd}
	Sleep %SLEEPTIME%
}
			;Proficient Building Designer
Send {PgUp}
loop 5{
	Send {Down}
	Sleep %SLEEPTIME%
}
loop 5{
	Send {NumpadAdd}
	Sleep %SLEEPTIME%
}
			;sixth guy
Send {Left}
Send {Down}
Send {Right}
			;Proficient Weaponsmith
loop 1{
	Send {Down}
	Sleep %SLEEPTIME%
}
loop 5{
	Send {NumpadAdd}
	Sleep %SLEEPTIME%
}
			;Proficient Armorsmith
loop 2{
	Send {Down}
	Sleep %SLEEPTIME%
}
loop 5{
	Send {NumpadAdd}
	Sleep %SLEEPTIME%
}
			;seventh guy
Send {Left}
Send {Down}
Send {Right}
			;Proficient Cook
Send {PgDn}
loop 2{
	Send {Up}
	Sleep %SLEEPTIME%
}
loop 5{
	Send {NumpadAdd}
	Sleep %SLEEPTIME%
}
			;Proficient Brewer
loop 1{
	Send {Up}
	Sleep %SLEEPTIME%
}
loop 5{
	Send {NumpadAdd}
	Sleep %SLEEPTIME%
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

			;do the inventory
Send {Tab}


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
			;Meat

if MEATS > 0
{
tmp := MEATS - 1
send ndonkey{SPACE}meat{RIGHT}{ENTER}
loop %tmp%{
Send {NumpadAdd}
}
Send {F9}
send nchimpanzee{SPACE}meat{RIGHT}{ENTER}
loop %tmp%{
Send {NumpadAdd}
}
Send {F9}
send ngazelle{SPACE}meat{RIGHT}{ENTER}
loop %tmp%{
Send {NumpadAdd}
}
Send {F9}
send nbonobo{SPACE}meat{RIGHT}{ENTER}
loop %tmp%{
Send {NumpadAdd}
}
Send {F9}
send nmule{SPACE}meat{RIGHT}{ENTER}
loop %tmp%{
Send {NumpadAdd}
}
Send {F9}
send ndeer{SPACE}meat{RIGHT}{ENTER}
loop %tmp%{
Send {NumpadAdd}
}
Send {F9}
send nraccoon{SPACE}meat{RIGHT}{ENTER}
loop %tmp%{
Send {NumpadAdd}
}
Send {F9}
send nfox{SPACE}meat{RIGHT}{ENTER}
loop %tmp%{
Send {NumpadAdd}
}
Send {F9}
send nrhesus{SPACE}macaque{SPACE}meat{RIGHT}{ENTER}
loop %tmp%{
Send {NumpadAdd}
}
Send {F9}
send nhorse{SPACE}meat{RIGHT}{ENTER}
loop %tmp%{
Send {NumpadAdd}
}
Send {F9}
send ngroundhog{SPACE}meat{RIGHT}{ENTER}
loop %tmp%{
Send {NumpadAdd}
}
Send {F9}
send nmountain{SPACE}goat{SPACE}meat{RIGHT}{ENTER}
loop %tmp%{
Send {NumpadAdd}
}
Send {F9}
send nhoary{SPACE}marmot{SPACE}meat{RIGHT}{ENTER}
loop %tmp%{
Send {NumpadAdd}
}
Send {F9}
send ngorilla{SPACE}meat{RIGHT}{ENTER}
loop %tmp%{
Send {NumpadAdd}
}
Send {F9}
send norangutan{SPACE}meat{RIGHT}{ENTER}
loop %tmp%{
Send {NumpadAdd}
}
Send {F9}
send nsiamang{SPACE}meat{RIGHT}{ENTER}
loop %tmp%{
Send {NumpadAdd}
}
Send {F9}
send nbilou{SPACE}meat{RIGHT}{ENTER}
loop %tmp%{
Send {NumpadAdd}
}
Send {F9}
send npileated{SPACE}gibbon{SPACE}meat{RIGHT}{ENTER}
loop %tmp%{
Send {NumpadAdd}
}
Send {F9}
send nmandrill{SPACE}meat{RIGHT}{ENTER}
loop %tmp%{
Send {NumpadAdd}
}
Send {F9}
send nturtle{RIGHT}{ENTER}
loop %tmp%{
Send {NumpadAdd}
}
Send {F9}


}


			;copper picks
if PICKS > 0
{
Send {n}copper picks{Right}{Enter}
tmp := PICKS - 1
loop %tmp%{
	Send {NumpadAdd}
	Sleep %SLEEPTIME%
}
}
			;Axes
if AXES > 0
{
Send {n}steel axes{Right}{Enter}
tmp := AXES - 1
loop %tmp%{
	Send {NumpadAdd}
	Sleep %SLEEPTIME%
}
}
			;Seeds
if SEEDS > 0
{
send {n}Rock nuts{Right}{Enter}
Send {NumpadAdd}
send {n}plump helmet spawn{Right}{Enter}
Send {NumpadAdd}
Send {NumpadAdd}
Send {NumpadAdd}
Send {NumpadAdd}
send {n}Pig tail Seeds{Right}{Enter}
Send {NumpadAdd}

tmp := SEEDS - 1
loop %tmp%{
Send {NumpadAdd}
Send {NumpadAdd}
}
Send {up}
loop %tmp%{
Send {NumpadAdd}
Send {NumpadAdd}
Send {NumpadAdd}
Send {NumpadAdd}
Send {NumpadAdd}
}
Send {up}
loop %tmp%{
Send {NumpadAdd}
Send {NumpadAdd}
}
}

			;Anvils
if ANVILS > 0
{
Send {n}iron anvils{Right}{Enter}
tmp := ANVILS - 1
loop %tmp%{
	Send {NumpadAdd}
	Sleep %SLEEPTIME%
}
}
			;Drinks
if DRINKS > 0{
send {n}Dwarven ale{Right}{Enter}
send {n}Dwarven beer{Right}{Enter}
send {n}Dwarven wine{Right}{Enter}
send {n}Dwarven rum{Right}{Enter}

tmp := DRINKS - 1
loop 4{
loop %tmp%{
Send {NumpadAdd}
}
Send {up}
}


return

A more modular approach

Hit WIN+G to go once you are on the empty item screen

#g::
;add an anvil
Additem("iron anvils",1)
;add 31 of the boozes (kind of iffy might end up with dwarven cheese or something if the civilization does not have 4 boozes)
Additem("dw",31)
Additem("dw",31)
Additem("dw",31)
Additem("dw",31)
;adds copper nuggets 
Additem("copper n",5)
;adds cassiterite
Additem("cass",5)
;bitumous coal
Additem("coal",5)
;tower cap logs
Additem("logs",11)
return

IsCurrentItemThere()
{
	;color of text in the new item screen 0xFFFF00(selected) or 0x808000 (unselected)
	;location of text in the new item screen 305, 150
	PixelSearch, , , 305, 150, 315, 160, 0x808000, 3,
	return !ErrorLevel
}


AddItem(name,amount)
{
	Sleep 100
	amount -= 1
	SetKeyDelay 150
	SendInput n
	SendInput %name%
	;MsgBox Name Check
	Sleep 200
	if IsCurrentItemThere() 
	{
		Sleep 200
		SendInput {Right}
		SendInput {Enter}
		Sleep 200
		Loop
		{
			if amount <= 0 
			{
				break
			}
			SendInput {NumpadAdd}
			Sleep 10
			amount --
		}
		;MsgBox Done
	}
	else 
	{
		SendInput {F9}
	}
}

Bed Assigning macro

This will assign bedrooms to your dwarfs. Press F3 followed by a single digit indicating how many beds to assign. Can repeat the action, as the number of beds assigned is stored in a counter. Room size is default, but easily edited into the script. By Napsterbater.

bedcounter = 0
F3::
  Input, counter, L1
  SetKeyDelay, 100
  loop  %counter% {
    loop %bedcounter%
      send {Down}
    loop % A_Index - 1
      send {Down}
    send {q}{r}{Enter}{a}
    loop %bedcounter%
      send {NumPadAdd}
    loop % A_Index - 1
      send {NumPadAdd}
    send {NumPadAdd}{Enter}
    send {space}{r}
  }
  bedcounter += counter
return

Room-designation macros

Valdemar's Designator Macro

This macro can read a spreadsheet and designate rooms according to it. Forum Thread/Download

Fedor's chambered circle

A circular room with eight equal-sized chambers, suitable for everything from housing to workshops to a mausoleum.
See this macro in action
Macro text

Valdemar's bedroom complex

A large fractal bedroom/dining complex, with 56 bedrooms and room for 24 tables.

You can press Alt-B to create a bedroom block, or Alt-C to create a full complex with 4 bedroom blocks and a dining block in the center.

Note - the macro is much faster than the demo movie shows, it is done in under a minute.

Demo Movie

Download

Tulip's room macros

Based on the bedroom designs.

^g means alt+g, !g means ctrl+g, and so on. Open up the designations window before using these:

; This will make a basic 'x' pattern workshop/room layout
; and will 'land' back on the same tile it starts on each time,
; which happens to be the center.
; It is modified so that you will have 3 staircases, and an extra tile
; because many workshops do not have corner access.
!r::
Send di2{enter}88{enter}4d{enter}4{enter}67{enter}77{enter}66666666
Send {enter}11{enter}1{enter}6{enter}114{enter}4{enter}2{enter}11{enter}
Send 66666666{enter}77{enter}7{enter}6{enter}74
return

; This makes GnomeChomsky's Tessellated Apartments, bedrooms only.
; Your cursor will be over the left staircase.
!g::
Send i999866{enter}{enter}33332{enter}{enter}11114{enter}{enter}
Send d3{enter}22{enter}4{enter}{enter}
Send 78{enter}44{enter}8{enter}{enter}
Send 96{enter}88{enter}6{enter}{enter}	
Send 32{enter}66{enter}2{enter}{enter}
Send 96{enter}{enter}6{enter}88{enter}
Send 96{enter}{enter}8{enter}44{enter}
Send 1444{enter}{enter}2{enter}66{enter}
Send 88{enter}88{enter}6{enter}{enter}
Send 78{enter}{enter}8{enter}44{enter}
Send 78{enter}{enter}4{enter}22{enter}
Send 14{enter}{enter}2{enter}66{enter}
Send 66{enter}22{enter}4{enter}{enter}
Send 14{enter}{enter}8{enter}44{enter}
Send 78{enter}{enter}4{enter}22{enter}
Send 14{enter}{enter}2{enter}66{enter}
Send 32{enter}{enter}6{enter}88{enter}7i{enter}{enter}
return

; This makes GnomeChomsky's Tessellated Apartments, bedrooms plus dining.
; Everything above applies.
^g::
Send i{enter}{enter}999866{enter}{enter}33332{enter}{enter}11114{enter}{enter}d
Send 444{enter}{enter}2{enter}66{enter}
Send 32{enter}{enter}6{enter}88{enter}
Send 9966{enter}{enter}6{enter}88{enter}
Send 96{enter}{enter}8{enter}44{enter}
Send 7788{enter}{enter}8{enter}44{enter}
Send 78{enter}{enter}4{enter}22{enter}
Send 1144{enter}{enter}4{enter}22{enter}
Send 14{enter}{enter}2{enter}66{enter}
Send 36{enter}8886666666{enter}
Send 9{enter}4444444{enter}
Send 8{enter}6666{enter}744{enter}{enter}
Send 222222441{enter}6666666{enter}
Send {enter}22{enter}8{enter}4444{enter}
Send 7778
return


; This makes THLawrence's Living Pods (the A is for Arabia).
; Put your cursor where you want the upper left staircase to be.
; Like my other scripts, it recenters on that tile.
; Also, thank you THLawrence, this one was really easy write!
!a::
Send i{enter}{enter}d7{enter}7{enter}666{enter}3{enter}22{enter}1{enter}44{enter}7{enter}
Send 96666666
Send i{enter}{enter}d7{enter}7{enter}666{enter}3{enter}22{enter}1{enter}44{enter}7{enter}
Send 33222
Send i{enter}{enter}d7{enter}7{enter}666{enter}3{enter}22{enter}1{enter}44{enter}7{enter}
Send 7444
Send i{enter}{enter}d7{enter}7{enter}666{enter}3{enter}22{enter}1{enter}44{enter}7{enter}
Send 9988888
return

; This makes the lobby for THLawrence's Living pods.
^a::
Send i{enter}{enter}d7{enter}7{enter}666{enter}3{enter}66{enter}9{enter}66{enter}3{enter}41i{enter}{enter}
Send 36d{enter}1444444{enter}
Send 74{enter}1{enter}22{enter}3{enter}3i{enter}{enter}d1{enter}1{enter}666{enter}9{enter}
Send 66{enter}3{enter}66{enter}9{enter}88{enter}7{enter}74{enter}1144{enter}
Send 36666i{enter}{enter}777777
return

Easy Exploration Mining in 2 steps

This macro will make a 5 row, 11 column UP/DOWN stairway grid (2 empty spaces between each row/column).
Starting point as indicated (row 3, column 11)
MUST BE IN DESIGNATION MODE WITH CURSOR AT THE <-- START HERE LOCATION
Link is <ctrl> <windowskey> `
Dive is <ctrl> <alt> `

Link
X--X--X--X--X--X--X--X--X--X--X
|              |              |
|              |              |
X--X--X--X--X--X--X--X--X--X--X
|              |              |
|              |              |
X--X--X--X--X--X--X--X--X--X--X <-- start here
|              |              |
|              |              |
X--X--X--X--X--X--X--X--X--X--X
|              |              |
|              |              |
X--X--X--X--X--X--X--X--X--X--X

Filename is ExploreMine-Link.ahk

;Link
^#`::

send d
send {Enter}
tehLoop(30,"{NumPadLeft}")
send {Enter}
send {Enter}
tehLoop(6,"{NumPadUp}")
send {Enter}
send {Enter}
tehLoop(30,"{NumPadRight}")
send {Enter}
send {Enter}
tehLoop(12,"{NumPadDown}")
send {Enter}
send {Enter}
tehLoop(30,"{NumPadLeft}")
send {Enter}
send {Enter}
tehLoop(9,"{NumPadUp}")
send {Enter}
send {Enter}
tehLoop(30,"{NumPadRight}")
send {Enter}
tehLoop(6,"{NumPadDown}")
send {Enter}
tehLoop(30,"{NumPadLeft}")
send {Enter}
tehLoop(3,"{NumPadDown}")
tehLoop(15,"{NumPadRight}")
send {Enter}
tehLoop(12,"{NumPadUp}")
send {Enter}
tehLoop(15,"{NumPadLeft}")

send i
send {Enter}{Enter}
tehOtherLoop("{NumPadDown}")
tehLoop(3,"{NumPadRight}")
send {Enter}{Enter}
tehOtherLoop("{NumPadUp}")
tehLoop(3,"{NumPadRight}")

send {Enter}{Enter}
tehOtherLoop("{NumPadDown}")
tehLoop(3,"{NumPadRight}")
send {Enter}{Enter}
tehOtherLoop("{NumPadUp}")
tehLoop(3,"{NumPadRight}")

send {Enter}{Enter}
tehOtherLoop("{NumPadDown}")
tehLoop(3,"{NumPadRight}")
send {Enter}{Enter}
tehOtherLoop("{NumPadUp}")
tehLoop(3,"{NumPadRight}")

send {Enter}{Enter}
tehOtherLoop("{NumPadDown}")
tehLoop(3,"{NumPadRight}")
send {Enter}{Enter}
tehOtherLoop("{NumPadUp}")
tehLoop(3,"{NumPadRight}")

send {Enter}{Enter}
tehOtherLoop("{NumPadDown}")
tehLoop(3,"{NumPadRight}")
send {Enter}{Enter}
tehOtherLoop("{NumPadUp}")
tehLoop(3,"{NumPadRight}")

send {Enter}{Enter}
tehOtherLoop("{NumPadDown}")
tehLoop(6,"{NumPadUp}")


tehLoop(tehTimes,tehDir)
{
	loop
	{
		if tehTimes <= 0
		{
			break
		}
		send %tehDir%
		tehTimes--
	}
}

tehOtherLoop(tehOtherDir)
{
	loop 4
	{		
		tehLoop(3,tehOtherDir)		
		send {Enter}{Enter}
	}
}
Dive
X  X  X  X  X  X  X  X  X  X  X


X  X  X  X  X  X  X  X  X  X  X


X  X  X  X  X  X  X  X  X  X  X <-- start here


X  X  X  X  X  X  X  X  X  X  X


X  X  X  X  X  X  X  X  X  X  X

Filename is ExploreMine-Dive.ahk

;Dive
^!`::
tehLoop(30,"{NumPadLeft}")
tehLoop(6,"{NumPadUp}")

send i
send {Enter}{Enter}
tehOtherLoop("{NumPadDown}")
tehLoop(3,"{NumPadRight}")
send {Enter}{Enter}
tehOtherLoop("{NumPadUp}")
tehLoop(3,"{NumPadRight}")

send {Enter}{Enter}
tehOtherLoop("{NumPadDown}")
tehLoop(3,"{NumPadRight}")
send {Enter}{Enter}
tehOtherLoop("{NumPadUp}")
tehLoop(3,"{NumPadRight}")

send {Enter}{Enter}
tehOtherLoop("{NumPadDown}")
tehLoop(3,"{NumPadRight}")
send {Enter}{Enter}
tehOtherLoop("{NumPadUp}")
tehLoop(3,"{NumPadRight}")

send {Enter}{Enter}
tehOtherLoop("{NumPadDown}")
tehLoop(3,"{NumPadRight}")
send {Enter}{Enter}
tehOtherLoop("{NumPadUp}")
tehLoop(3,"{NumPadRight}")

send {Enter}{Enter}
tehOtherLoop("{NumPadDown}")
tehLoop(3,"{NumPadRight}")
send {Enter}{Enter}
tehOtherLoop("{NumPadUp}")
tehLoop(3,"{NumPadRight}")

send {Enter}{Enter}
tehOtherLoop("{NumPadDown}")
tehLoop(6,"{NumPadUp}")


tehLoop(tehTimes,tehDir)
{
	loop
	{
		if tehTimes <= 0
		{
			break
		}
		send %tehDir%
		tehTimes--
	}
}

tehOtherLoop(tehOtherDir)
{
	loop 4
	{		
		tehLoop(3,tehOtherDir)		
		send {Enter}{Enter}
	}
}


Interface Enhancement Scripts

The MOUSE control

For unrivaled mouse control in DF try this DF Mouse script

Tile Counter or Scrolling Accelerator

Lack of reference plus slow scrolling speed make planning digging area frustrating,so here is the script that shows coordinate and speed scrolling up. ShowXY


4-Pour Water Creation script

For Automating creation of water using Gibbeds Tweak.

;
;	4-pour.ahk
;	Dwarf fortress water creation script.
;
;Use this script in conjunction with Gibbeds Dwarf Fortress Tweak to create endless amounts of water.;
;
;Directions
;
;1. Have DF running and position the screen such that when you press "K" the X will appear where you 

;want the water to appear.
;2. Have Gbbed's Dwarf Fortress tweak running in the background (with the proper process selected)
;3. run the 4-pour script
;4. press alt-p to get Pouring
;
;The script will then begin a cycle that moves the cursor around in a little 2x2 square editing each 

;tile to have 7/7 of water, it then pauses for a half a seond to let the water flow a bit, and repeats. 

;It does this until you..
;
;5. press and hold <shift> to stop
;
;As always, save before you experiment with this
;I hold no responsibility for what this script ends up doing to your dwarves/fortress/computer/carpet
;Feel free to clean it up, make it more usable, whatever
;
;

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

!p::
loop 

{
GetKeyState, state, Shift
if state = D
    Break


IfWinActive Dwarf Fortress
{
    WinActivate
}
send k
sleep 100
  send {NumpadRight}

IfWinExist Gibbed's Dwarf Fortress Tweak [1.2.0.0]
{
    WinActivate
}

click 38, 184, 2
sleep 100

IfWinExist Tile Edit
{
    WinActivate
}
sleep 100
click 63, 448
sleep 100
click 106, 70
sleep 100
click 207, 255
sleep 100
send {backspace}
sleep 100
send 7
sleep 100
click 348, 449
sleep 100
IfWinExist Dwarf Fortress
{
    WinActivate
}
sleep 100
  send {NumpadDown}

IfWinExist Gibbed's Dwarf Fortress Tweak [1.2.0.0]
{
    WinActivate
}

click 38, 184, 2
sleep 100

IfWinExist Tile Edit
{
    WinActivate
}
sleep 100
click 63, 448
sleep 100
click 106, 70
sleep 100
click 207, 255
sleep 100
send {backspace}
sleep 100
send 7
sleep 100
click 348, 449
sleep 100
IfWinExist Dwarf Fortress
{
    WinActivate
}
sleep 100
  send {NumpadLeft}

IfWinExist Gibbed's Dwarf Fortress Tweak [1.2.0.0]
{
    WinActivate
}

click 38, 184, 2
sleep 100

IfWinExist Tile Edit
{
    WinActivate
}
sleep 100
click 63, 448
sleep 100
click 106, 70
sleep 100
click 207, 255
sleep 100
send {backspace}
sleep 100
send 7
sleep 100
click 348, 449
sleep 100
IfWinExist Dwarf Fortress
{
    WinActivate
}
sleep 100
  send {NumpadUp}

IfWinExist Gibbed's Dwarf Fortress Tweak [1.2.0.0]
{
    WinActivate
}

click 38, 184, 2
sleep 100

IfWinExist Tile Edit
{
    WinActivate
}
sleep 100
click 63, 448
sleep 100
click 106, 70
sleep 100
click 207, 255
sleep 100
send {backspace}
sleep 100
send 7
sleep 100
click 348, 449
sleep 100
IfWinExist Dwarf Fortress
{
    WinActivate
}
send {space}
sleep 800
}

Tesselated Apartments Builder

This one is another tesselated apartments script, with some larger areas added. Credit for layout to GnomeChomsky.

;
; TessApts.ahk
; Start script while in 'dig' mode with cursor on desired position of leftmost staircase
;
; CTRL+G       : Central room, 8 apartments (necessary on at least one z-level)
; ALT+G        : No central room, 16 apartments
; CTRL+ALT+G   : Four "central room" layouts connected in center (28 apartments)
; CTRL+SHIFT+G : Four "16 apartment" layouts, unconnected in center
;
!g::
Send i{ENTER}{ENTER}33332{ENTER}{ENTER}99996{ENTER}{ENTER}77778{ENTER}{ENTER}
Send d7{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}
Send 111{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}
Send 333333{ENTER}44{ENTER}8{ENTER}{ENTER}96{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}
Send 99999988{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}96{ENTER}88{ENTER}6{ENTER}{ENTER}114444444
return
^g::
Send i{ENTER}{ENTER}33332{ENTER}{ENTER}99996{ENTER}{ENTER}77778{ENTER}{ENTER}
Send d7{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}
Send 111{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}
Send 333333{ENTER}44{ENTER}8{ENTER}{ENTER}96{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}
Send 99999988{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}96{ENTER}88{ENTER}6{ENTER}{ENTER}
Send 7444{ENTER}{ENTER}1114{ENTER}{ENTER}3332{ENTER}{ENTER}9996{ENTER}{ENTER}788{ENTER}11111{ENTER}
return
!^g::
Send i{ENTER}{ENTER}33332{ENTER}{ENTER}99996{ENTER}{ENTER}77778{ENTER}{ENTER}
Send d7{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}
Send 111{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}
Send 333333{ENTER}44{ENTER}8{ENTER}{ENTER}96{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}
Send 99999988{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}96{ENTER}88{ENTER}6{ENTER}{ENTER}
Send 7444{ENTER}{ENTER}1114{ENTER}{ENTER}3332{ENTER}{ENTER}9996{ENTER}{ENTER}788{ENTER}11111{ENTER}88899999999
Send i{ENTER}{ENTER}33332{ENTER}{ENTER}99996{ENTER}{ENTER}77778{ENTER}{ENTER}
Send d7{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}
Send 111{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}
Send 333333{ENTER}44{ENTER}8{ENTER}{ENTER}96{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}
Send 99999988{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}96{ENTER}88{ENTER}6{ENTER}{ENTER}
Send 7444{ENTER}{ENTER}1114{ENTER}{ENTER}3332{ENTER}{ENTER}9996{ENTER}{ENTER}788{ENTER}11111{ENTER}3333332
Send i{ENTER}{ENTER}33332{ENTER}{ENTER}99996{ENTER}{ENTER}77778{ENTER}{ENTER}
Send d7{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}
Send 111{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}
Send 333333{ENTER}44{ENTER}8{ENTER}{ENTER}96{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}
Send 99999988{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}96{ENTER}88{ENTER}6{ENTER}{ENTER}
Send 7444{ENTER}{ENTER}1114{ENTER}{ENTER}3332{ENTER}{ENTER}9996{ENTER}{ENTER}788{ENTER}11111{ENTER}111114444444
Send i{ENTER}{ENTER}33332{ENTER}{ENTER}99996{ENTER}{ENTER}77778{ENTER}{ENTER}
Send d7{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}
Send 111{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}
Send 333333{ENTER}44{ENTER}8{ENTER}{ENTER}96{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}
Send 99999988{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}96{ENTER}88{ENTER}6{ENTER}{ENTER}
Send 7444{ENTER}{ENTER}1114{ENTER}{ENTER}3332{ENTER}{ENTER}9996{ENTER}{ENTER}788{ENTER}11111{ENTER}
Send 9988888888{ENTER}999{ENTER}+444444
return

+^g::
Send i{ENTER}{ENTER}33332{ENTER}{ENTER}99996{ENTER}{ENTER}77778{ENTER}{ENTER}
Send d7{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}
Send 111{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}
Send 333333{ENTER}44{ENTER}8{ENTER}{ENTER}96{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}
Send 99999988{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}96{ENTER}88{ENTER}6{ENTER}{ENTER}888889
Send i{ENTER}{ENTER}33332{ENTER}{ENTER}99996{ENTER}{ENTER}77778{ENTER}{ENTER}
Send d7{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}
Send 111{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}
Send 333333{ENTER}44{ENTER}8{ENTER}{ENTER}96{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}
Send 99999988{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}96{ENTER}88{ENTER}6{ENTER}{ENTER}+221
Send i{ENTER}{ENTER}33332{ENTER}{ENTER}99996{ENTER}{ENTER}77778{ENTER}{ENTER}
Send d7{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}
Send 111{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}
Send 333333{ENTER}44{ENTER}8{ENTER}{ENTER}96{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}
Send 99999988{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}96{ENTER}88{ENTER}6{ENTER}{ENTER}+1+46
Send i{ENTER}{ENTER}33332{ENTER}{ENTER}99996{ENTER}{ENTER}77778{ENTER}{ENTER}
Send d7{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}
Send 111{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}
Send 333333{ENTER}44{ENTER}8{ENTER}{ENTER}96{ENTER}88{ENTER}6{ENTER}{ENTER}32{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}
Send 99999988{ENTER}66{ENTER}2{ENTER}{ENTER}14{ENTER}22{ENTER}4{ENTER}{ENTER}78{ENTER}44{ENTER}8{ENTER}{ENTER}96{ENTER}88{ENTER}6{ENTER}{ENTER}+71144444