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.

Difference between revisions of "User:Daedalusai"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
(now response to shift+arrow keys,shift+r retain original function)
Line 20: Line 20:
 
SetTitleMatchMode, 3
 
SetTitleMatchMode, 3
 
#InstallKeybdHook
 
#InstallKeybdHook
 +
SendMode, Play
  
 
;Create Gui
 
;Create Gui
Line 41: Line 42:
 
ownPID := DllCall("GetCurrentProcessId")
 
ownPID := DllCall("GetCurrentProcessId")
 
WinSet, AlwaysOnTop, On, ahk_pid %ownPID%
 
WinSet, AlwaysOnTop, On, ahk_pid %ownPID%
SendMode, Play
 
BlockInput, Off
 
BlockInput, Default
 
 
 
Return
 
Return
  
 
;Hotkeys
 
;Hotkeys
 +
 
Left::
 
Left::
 
Right::
 
Right::
 
Up::
 
Up::
 
Down::
 
Down::
 +
+Left::
 +
+Right::
 +
+Up::
 +
+Down::
 
SetTimer, supplementchkswitch, Off
 
SetTimer, supplementchkswitch, Off
 
SetTimer, supplementchk, Off
 
SetTimer, supplementchk, Off
Line 61: Line 63:
 
Return
 
Return
  
 +
~+r::
 
;Button
 
;Button
 
Reset:
 
Reset:
+r::
 
 
x := 0
 
x := 0
 
y := 0
 
y := 0
Line 72: Line 74:
 
;timer routine
 
;timer routine
 
supplementchk:
 
supplementchk:
if (ChkaxisX(x) + ChkaxisY(y) = 0)
+
if (ChkaxisX(x)+ChkaxisY(y) = 0)
 
{
 
{
 
SetTimer, supplementchk, Off
 
SetTimer, supplementchk, Off
Line 87: Line 89:
  
 
;Functions
 
;Functions
 +
 
ChkaxisX(ByRef x)
 
ChkaxisX(ByRef x)
 
{
 
{
 
xmove := 0
 
xmove := 0
 +
steps := 1
 +
prefix := ""
 
GetKeyState, state, Left, P
 
GetKeyState, state, Left, P
 
if state = D
 
if state = D
Line 96: Line 101:
 
if state = D
 
if state = D
 
xmove += 3
 
xmove += 3
 +
GetKeyState, state, Shift, P
 +
if state = D
 +
{
 +
prefix := prefix "+"
 +
steps := 10
 +
}
 +
GetKeyState, state,Ctrl,
 +
if state = D
 +
{
 +
prefix := prefix "^"
 +
steps := 0
 +
}
 +
GetKeyState, state, Alt,
 +
if state = D
 +
{
 +
prefix := prefix "!"
 +
steps := 0
 +
}
 
if xmove != 4
 
if xmove != 4
 
{
 
{
Line 102: Line 125:
 
if xmove = 1
 
if xmove = 1
 
{
 
{
Send { Left }
+
Send %prefix%{Left}
x -= 1
+
x -= %steps%
 
Return 1
 
Return 1
 
}
 
}
 
else
 
else
 
{
 
{
Send { Right }
+
Send %prefix%{Right}
x += 1
+
x += %steps%
 
Return 3
 
Return 3
 
}
 
}
Line 128: Line 151:
 
{
 
{
 
ymove := 0
 
ymove := 0
 +
steps := 1
 +
prefix := ""
 
GetKeyState, state, Up, P
 
GetKeyState, state, Up, P
 
if state = D
 
if state = D
Line 134: Line 159:
 
if state = D
 
if state = D
 
ymove += 3
 
ymove += 3
 +
GetKeyState, state, Shift,
 +
if state = D
 +
{
 +
prefix := prefix "+"
 +
steps := 10
 +
}
 +
GetKeyState, state,Ctrl,
 +
if state = D
 +
{
 +
prefix := prefix "^"
 +
steps := 0
 +
}
 +
GetKeyState, state, Alt,
 +
if state = D
 +
{
 +
prefix := prefix "!"
 +
steps := 0
 +
}
 
if ymove != 4
 
if ymove != 4
 
{
 
{
Line 140: Line 183:
 
if ymove = 1
 
if ymove = 1
 
{
 
{
Send { Up }
+
Send %prefix%{Up}
y += 1
+
y += %steps%
 
Return 1
 
Return 1
 
}
 
}
 
else
 
else
 
{
 
{
Send { Down }
+
Send %prefix%{Down}
y -= 1
+
y -= %steps%
 
Return 3
 
Return 3
 
}
 
}

Revision as of 14:19, 21 December 2008

Some interface utilities

Tile Counter or Scrolling Accelerator

Lack of reference make me feel really stupid while planning digging area,so i tried to make a utility that shows coordinate.

This utility intercept arrow key strokes,then send keystrokes to game according to which key being pressed down(physiaclly),while counting how many keystrokes have been sent. As a side effect of sending keystrokes directly to the game,keystrokes can be sent much faster,result in much faster scrolling speed.

Note: This utility can't see where the cursor is in game,so if you move cursor over edge of map,the counter will not stop. If you want to measure how many tiles between edge of map and a giving spot,start measuring from edge of map. Otherwise,the counter is quite accurate as long as you don't touch the border.

Hotkey

Shift+r: Reset counter


;init config
SetTitleMatchMode, 3
#InstallKeybdHook
SendMode, Play

;Create Gui
Gui, Add, Text, x6 y10 w100 h20 vTXvalue, X: 0
Gui, Add, Text, x6 y30 w100 h20 vTYvalue, Y: 0
Gui, Add, Button, x106 y0 w40 h50 vBReset gReset, Reset
; Generated using SmartGUI Creator 4.0
Gui, Show, x554 y336 h53 w149, ShowXY

;var
x := 0
y := 0
	
;timer
SetTimer, supplementchk, 20
SetTimer, supplementchk, Off
SetTimer, supplementchkswitch, -90
SetTimer, supplementchkswitch, Off

;init routine
ownPID := DllCall("GetCurrentProcessId")
WinSet, AlwaysOnTop, On, ahk_pid %ownPID%
Return

;Hotkeys

Left::
Right::
Up::
Down::
+Left::
+Right::
+Up::
+Down::
SetTimer, supplementchkswitch, Off
SetTimer, supplementchk, Off
if ChkaxisX(x) != 0
GuiControl, Text, TXvalue, % "X: " x
if ChkaxisY(y) != 0
GuiControl, Text, TYvalue, % "Y: " y
SetTimer, supplementchkswitch, On
Return

~+r::
;Button
Reset:
x := 0
y := 0
GuiControl, Text, TXvalue, % "X: " x
GuiControl, Text, TYvalue, % "Y: " y
Return

;timer routine
supplementchk:
if (ChkaxisX(x)+ChkaxisY(y) = 0)
{
	SetTimer, supplementchk, Off
	Return
}
GuiControl, Text, TXvalue, % "X: " x
GuiControl, Text, TYvalue, % "Y: " y
Return

supplementchkswitch:
SetTimer, supplementchk, On
Return


;Functions

ChkaxisX(ByRef x)
{
xmove := 0
steps := 1
prefix := ""
GetKeyState, state, Left, P
if state = D
xmove += 1
GetKeyState, state, Right, P
if state = D
xmove += 3
GetKeyState, state, Shift, P
if state = D
{
	prefix := prefix "+"
	steps := 10
}
GetKeyState, state,Ctrl,
if state = D
{
	prefix := prefix "^"
	steps := 0
}
GetKeyState, state, Alt,
if state = D
{
	prefix := prefix "!"
	steps := 0
}
if xmove != 4
{
	if xmove != 0
	{
		if xmove = 1
		{
			Send %prefix%{Left}
			x -= %steps%
		Return 1
		}
		else
		{
			Send %prefix%{Right}
			x += %steps%
		Return 3
		}
	}
	else
	{
	Return 0
	}
}
else
{
Return 4
}
Return
}

ChkaxisY(ByRef y)
{
ymove := 0
steps := 1
prefix := ""
GetKeyState, state, Up, P
if state = D
ymove += 1
GetKeyState, state, Down, P
if state = D
ymove += 3
GetKeyState, state, Shift,
if state = D
{
	prefix := prefix "+"
	steps := 10
}
GetKeyState, state,Ctrl,
if state = D
{
	prefix := prefix "^"
	steps := 0
}
GetKeyState, state, Alt,
if state = D
{
	prefix := prefix "!"
	steps := 0
}
if ymove != 4
{
	if ymove != 0
	{
		if ymove = 1
		{
			Send %prefix%{Up}
			y += %steps%
		Return 1
		}
		else
		{
			Send %prefix%{Down}
			y -= %steps%
		Return 3
		}
	}
	else
	{
	Return 0
	}
}
else
{
Return 4
}
Return
}

;build-in function
GuiClose:
ExitApp