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:Digger

From Dwarf Fortress Wiki
Jump to navigation Jump to search

Hi, I'm Digger, usually I go by a nick of Meat_Grinder, however in case of digging a fortress I had to assume this one. Usually I'm adding some minor stuff and just being nitpicky, feel free to remind me of that when you think I go overboard. These are my first wiki-contributions after all :)


BEHOLD THE MOUSE SCRIPT 1.1[edit]

I dedicate this script to ignir, who, unable to use mouse in DF, left this awesome game long ago.

[UPDATE] Added some minor tweaks/comments/explanations, simplified some hotkeys, fixed 1(omg) typo. The script now starts suspended, you have to "Alt + s" to enable it. LCtrl + z/x will navigate you horizontally, and LCtrl + mouse wheel vertically in a no-cursor mode.

Note:The script has been created for maximum comfort of a "left hand on a keyboard & right hand on a mouse" position. If you are left handed, you probably might want to switch any left hotkey combo to a right one, Find>Replace>LCtrl/LShift/LWin/LAlt with RCtrl/RShift/RWin/RAlt, also you might want to change F1/tilda/x/z/a keys to something else that's closer to the right side.

;This is a script that enables basic mouse controls in DF. The precision of the scipt is ~1 tile for me.
;Feel free to modify it, however remember that DF cannot tell where your mouse is, and AutoHotKey cannot tell where the DF's cursor is, so it is your job to synchronize them :)
;Alright, I did everything to KILL that Numpad control setup >:) Laptop users could probably easily play with this one.
;The only problem with this control is that it takes 2 mouseclicks to navigate, so it will probably kill your mouse(instead of your keyboard, what DF inevitably does) in the long run.

;Recommendations: 12x12 tileset, Windowed mode, wide/large screen, 3-button wheeled mouse, brains.
;Once you get a hand of it, you will realize that you can navigate to the places you can't even see on the screen.

Suspend			;This one suspends the script in the beginning.
#InstallMouseHook 	;This module of AutoHotKey tracks the mouse movement and clicks, it is not enabled by default, see AutoHotKey's readme for details
^`::Reload		;This one obviously reloads the script = Ctrl + tilda(under Esc)
!s::Suspend		;This one toggles hotkeys on and off = Alt + s


;these ones scroll -/+. Just scroll the wheel! Hold shift for a speed boost.
~WheelUp::
Loop %A_EventInfo%
{
	Send {NumpadSub}
}
return

~WheelDown::
Loop %A_EventInfo%
{
	Send {NumpadAdd}
}
return

~LShift & WheelUp::
Loop %A_EventInfo%
{
	Send {NumpadDiv}
}
return

~LShift & WheelDown::
Loop %A_EventInfo%
{
	Send {NumpadMult}
}
return


;these ones scroll Up/Down. Hold Left Ctrl & scroll! Hold a instead of Ctrl for a speed boost.
~LCtrl & WheelUp::
Loop %A_EventInfo%
{
	Send {NumpadUp}
}
return

~LCtrl & WheelDown::
Loop %A_EventInfo%
{
	Send {NumpadDown}
}
return

~z & WheelUp::
Loop %A_EventInfo%
{
	Send {NumpadPgUp}
}
return

~z & WheelDown::
Loop %A_EventInfo%
{
	Send {NumpadPgDn}
}
return


;Switching z-levels. Hold Left Alt & scroll the wheel! Alt for altitude ;)
~LAlt & WheelUp::
Loop %A_EventInfo%
{
	Send +{<}
}
return

~LAlt & WheelDown::
Loop %A_EventInfo%
{
	Send +{>}
}
return


;Makes an Enter of Left Shift/Left Ctrl & LMB click.
LShift & LButton::
Send {Enter}
return

LCtrl & LButton::
Send {Enter}
return


;These two make a "c" of a MMB click both with and without Left shift
LShift & MButton::
Send {c}
return

MButton::
Send {c}
return


;RMB click is made into a Space both with and without Left Shift by these two
LShift & RButton::
Send {Space}
return

RButton::
Send {Space}
return


;My supreme script that tracks mouse movements in between two LMB clicks and transforms them into cursor movements. You WILL have to adjust the 2 values down there if you are not using 12x12 tileset.
LButton::
Label1:
CoordMode, Mouse, Screen
;estimating coordinates
IfEqual xpos1, 0
{
	IfEqual ypos1, 0
	{
		MouseGetPos, xpos1, ypos1
	}
}else{
	IfEqual xpos2, 0
	{
		IfEqual ypos2, 0
		{
			MouseGetPos, xpos2, ypos2
			{
				;estimating difference in coordinates
				xpos2 -= %xpos1%
				ypos2 -= %ypos1%
				;MsgBox %xpos2% %ypos2%
			}

			{
				;estimating number of tiles to move, change 12x12 to YOUR tile size in order to get it right, it might be different in fullscreen/windowed, making it harder for you to use mouse
				xpos2 /= 12 ;Change 12 to your tileset width
				ypos2 /= 12 ;Change 12 to your tileset height
				;MsgBox %xpos2% %ypos2%
			}
			;moving the cursor
			Loop % Abs(xpos2)
			{
				If xpos2 > 0
				{
					Send {Right}
					;MsgBox WIN
				}else If xpos2 < 0
				{
					Send {Left}
					;MsgBox WIN
				}
			}
			Loop % Abs(ypos2)
			{
				if ypos2 > 0
				{
					Send {Down}
					;MsgBox WIN
				}else if ypos2 < 0
				{
					Send {Up}
					;MsgBox WIN
				}
			}
		} else
		{
			xpos1 = 0
			ypos1 = 0
			xpos2 = 0
			ypos2 = 0
			gosub Label1
		}
	} else
	{
		xpos1 = 0
		ypos1 = 0
		xpos2 = 0
		ypos2 = 0
		gosub Label1
	}
}
return

;Resetting mouse coordinates
LWin::
xpos1 = 0
ypos1 = 0
xpos2 = 0
ypos2 = 0
return


;Toggling left-right
LCtrl & z::
{
	Send {NumpadLeft}
}
return

LCtrl & x::
{
	Send {NumpadRight}
}
return


;Simple Ctrl + a to toggle 20 items in a trade window, perfect for people who buy all/sell all.
$^a:: 
Loop 20
{
	Send {Enter}
	Sleep 30
	Send {Down}
}
return