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.

User:Djbrown79/Mining.ahk

From Dwarf Fortress Wiki
< User:Djbrown79
Revision as of 03:42, 29 December 2009 by Djbrown79 (talk | contribs) (Created page with ' ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Original Filename: mining.ahk ; Author: djbrown79, August 17th, 2008 ; ; Use this script to create mineshaft…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Original Filename: mining.ahk
; Author: djbrown79, August 17th, 2008
;
; Use this script to create mineshafts in Dwarf Fortress like
; those described on:
;	
;	http://www.dwarffortresswiki.net/index.php/Exploratory_mining#Mine_shafts
;				
; Usage
;				
; X is the number of columns, left-to-right
; Y is the number of rows, up-to-down
; Z is how many levels deep.
;
; Put Dwarf Fortress in dig-mode by pressing 'd' and place
; the cursor where you want the upper-left corner of your
; mining area to be.
;
; Press Control+Shift+m to activate.
; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
^+m::
x = 3
y = 3
z = 3 

delay = 100

Send d

flipX := true
flipY := true
flipZ := true

Loop %y%
{
	Send d{Enter}

	flipX := Not( flipX )
	Loop %x%
	{
		if( A_Index != x )
		{
			if( flipX )
				Send {Left 3}
			else
				Send {Right 3}
			
		}
	}
	Send {Enter}

	if( A_Index != y )
		Send {Down 3}
}

if( !flipX )
{
	Loop %x%
	{
		if( A_Index != x )
			Send {Left 3}
	}
}

flipX := true

Loop %y%
{
	if( A_Index = 1 )
		Send {Enter}
	if( A_Index != y )
		Send {Up 3}
}
Send {Enter}

flipY := Not( flipY )
Loop %y%
{
	flipX := Not( flipX )
	Loop %x%
	{
		flipZ := Not( flipZ )
		Loop %z%
		{
			if( A_Index = 1 )
			{
				if( flipZ )
					Send u{Enter 2}
				else
					Send j{Enter 2}
			}
			else
			if( A_Index = z )
			{
				if( flipZ )
					Send j{Enter 2}
				else
					Send u{Enter 2}
			}
			else
				Send i{Enter 2}

			if( A_Index != z )
			{
				if( flipZ )
					Send +,
				else
					Send +.
			}
		}

		if( A_Index != x )
		{
			if( flipX )
				Send {Left 3}
			else
				Send {Right 3}
		}
	}

	if( A_Index != y )
	{
		if( flipY )
			Send {Up 3}
		else
			Send {Down 3}
	}			
}

if( flipX )
{
	Loop %x%
		Send {Right 3}
}
else
	Send {Right 3}

if( !flipY )
	Loop %y%
		if( A_Index != y )
			Send {Up 3}

if( !flipZ )
	Loop %z%
		if( A_Index != z )
			Send +,

return