Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: DDR's Essential Dwarf Fortress Hotkeys (.exe)  (Read 7814 times)

DDR

  • Bay Watcher
    • View Profile
    • Frogatto
DDR's Essential Dwarf Fortress Hotkeys (.exe)
« on: February 14, 2012, 08:02:31 pm »

By running this program, you can now:
- Scroll up/down z-levels about 10x faster than before, by pressing alt-shift-<. Tapping the key, you can scroll at about one level per frame.
- Resist carpal tunnel syndrome by holding ctrl-enter or ctrl-plus to select the current element of a list and advance to the next one. Essential for the trade screen.
- Select barrel, in trade, and advance to the next barrel by holding ctrl-pagedown.
- Freeform walls, because every essential helper for DF has to include that. Hold 'w' and press an arrow key, with the wall tool active.
- Freeform grates. See above, but with 'g' and building grates active.

Code available here.


[edit]: New .exe. (Thanks, Blakmane.)
« Last Edit: February 18, 2012, 09:12:06 pm by DDR »
Logged
Il Palazzo: "Urist, quick, grab your ax! There's a troll rampaging through the decimal conversion chambers!"
melomel: DF is like OCD candy, isn't it? existent: No, DF is like the stranger in the trench coat offering the candy.

DDR

  • Bay Watcher
    • View Profile
    • Frogatto

A small update; it turned out that now you have to enter-confirm stacks of items. Now alt-enter goes 'enter-enter-down'. 8)
Code: [Select]
; AutoHotkey Version: 1.x
; Language: English
; Platform: WinXP
; Author: D. D. Roberts <robertsdavidddr@gmail.com>
; Version: MIN-1.0
; License: GNU GPL

; Script Keys:
; These keys aim to speed up the playing of Dwarf Fortress by automating some common tasks.
;
; Furnish & Room:
;~ w + arrow key . . Position a single wall segment. Hold w and an arrow key to build that wall and advance a tile.
;~ g + arrow key . . Position a floor grate. Press g and {direction} arrow key to build that grate and position a floor grate to the {direction} of the first grate.
;
; Misc.:
; alt <, > . . . Move up or down ten levels. Very handy for 150 z-level forts. (Or, alt-shift-,, ..)
; ctrl enter . . . Enter select, and advance the cursor with the down arrow key.
; alt enter . . . Enter select, enter confirm, and advance the cursor with the down arrow key.
; ctrl number pad plus. Enter select, and advance the cursor with the number pad plus key.
; ctrl page down . . Select current barrel or bin in trade screen (traders' side), and advance to the next barrel.
; alt number pad plus . Press keys tiq+. For use selecting squads to train at a baracks.

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetKeydelay, 20

#SingleInstance force

;WinWaitActive, Shortcut to dfvdig.exe
;Send, {ENTER}
;WinActivate, Dwarf Fortress
;Reload

#IfWinActive Dwarf Fortress

!+.::Send {> 10}
Return
!+,::Send {< 10}
Return

^Enter::
Send {ENTER}{DOWN}
Return
!Enter::
Send {ENTER}{ENTER}{DOWN}
Return

^PGDN::
Send, {ENTER}{PGDN}{UP}{UP}
Return

^NumpadAdd::
Send {ENTER}{NumpadAdd}
Return

!NumpadAdd::
Send, tiq{+}
Return

; -- Begin G Section --
g & Right::
Send, {ENTER}
Sleep, 300
Send, {ENTER}{SHIFTDOWN}g{SHIFTUP}{RIGHT} ;Grate in direction. Traps g, though, so re-g code is needed.
Return

g & Left::
Send, {ENTER}
Sleep, 300
Send, {ENTER}{SHIFTDOWN}g{SHIFTUP}{LEFT}
Return

g & Up::
Send, {ENTER}
Sleep, 300
Send, {ENTER}{SHIFTDOWN}g{SHIFTUP}{UP}
Return

g & Down::
Send, {ENTER}
Sleep, 300
Send, {ENTER}{SHIFTDOWN}g{SHIFTUP}{DOWN}
Return


+g::Send, {SHIFTDOWN}g{SHIFTUP} ;Send g if g pressed; otherwise g won't work. Script traps g in above trigger.
Return
g::Send, g
Return


; -- Begin W Section --
w & Left::
Send, {ENTER}
Sleep, 250
Send, {ENTER 2}{LEFT}
Return

w & Up::
Send, {ENTER}
Sleep, 250
Send, {ENTER 2}{UP}
Return

w & Right::
Send, {ENTER}
Sleep, 250
Send, {ENTER 2}{RIGHT}
Return

w & Down::
Send, {ENTER}
Sleep, 250
Send, {ENTER 2}{DOWN}
Return

+w::Send, {SHIFTDOWN}w{SHIFTUP}
Return
w::Send, w
Return
Logged
Il Palazzo: "Urist, quick, grab your ax! There's a troll rampaging through the decimal conversion chambers!"
melomel: DF is like OCD candy, isn't it? existent: No, DF is like the stranger in the trench coat offering the candy.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist

Thanks, I just found out about DF macros, but this adds another layer of use-ability to DF. I will try it out. Any chance that this could be included pre-installed in a mod ?
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

DDR

  • Bay Watcher
    • View Profile
    • Frogatto

Short version: Sorry, I can't do that. :(

Long version:
*begin log*
Yes-ish. I think I can, somehow, bind the whole thing as a .exe, so that'll at least be more usable. If only I knew why that specific menu item was greyed out. :/

*time passes*
Ah. The menu was pointing to the wrong place on disk.

*more time passes*
Ok. So, the compiler is ass. :P The .exe, while it does /run/, doesn't run /right/. Unfortunately, the result is useless. Sorry, I can't do that. :(
Logged
Il Palazzo: "Urist, quick, grab your ax! There's a troll rampaging through the decimal conversion chambers!"
melomel: DF is like OCD candy, isn't it? existent: No, DF is like the stranger in the trench coat offering the candy.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist

Ok, so what I could do is add a download link, and your code, and a short manual, and the user has to set it up himself. Could be worse, could be better.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

DDR

  • Bay Watcher
    • View Profile
    • Frogatto

To run the script, you install autohotkey, from the link in the first post, and then paste the code I included in the second post in a file called filename.ahk. Then you double-click the file to run it. Now, whenever you start DF, you have the hotkeys listed in the comments at the start of the file.

If you could do some sort of installer/help package, that'd be great. I, myself, should have a look at the macro capabilities of Dwarf Fortress. When they were first introduced, I'd already made this script. It might be that I can just remake the script entirely inside DF.
Logged
Il Palazzo: "Urist, quick, grab your ax! There's a troll rampaging through the decimal conversion chambers!"
melomel: DF is like OCD candy, isn't it? existent: No, DF is like the stranger in the trench coat offering the candy.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist

Yes, you could, BUT DF can only run one macro. No quick hotkeys... all are played by CRTL+P, and you have to select one to be run. Your system is way better, but the way I know the average user, he will not go through the trouble and actually set it up for himself.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

DDR

  • Bay Watcher
    • View Profile
    • Frogatto

Oh, right -- I knew I'd messed with macros before, but I couldn't remember why I stopped. :P
This way is a touch nicer. If I can help you, let me know.
Logged
Il Palazzo: "Urist, quick, grab your ax! There's a troll rampaging through the decimal conversion chambers!"
melomel: DF is like OCD candy, isn't it? existent: No, DF is like the stranger in the trench coat offering the candy.

Blakmane

  • Bay Watcher
    • View Profile

Just to let you know that there is interest in this DDR: just because noone has posted doesn't mean you are forgotten! I think this has a lot of potential as a means of shoring up weakness in DF's UI.

Have you considered trying to bundle the portable version of AHK with your script? The user would still need to place the script in the correct folder but at least this would be a step up from installing the program in its entirety.
Logged

DDR

  • Bay Watcher
    • View Profile
    • Frogatto
Re: DDR's Essential Dwarf Fortress Hotkeys (.exe)
« Reply #9 on: February 18, 2012, 09:07:29 pm »

Just noticed AutoHotKey_L was about 3 years newer, so I downloaded it and tried compiling again. This time, the .exe version works! 8) Here is the executable, and the source code.

Thanks for encouraging me, Blakmane! I never would have poked around there if you hadn't mentioned it.
« Last Edit: February 18, 2012, 09:13:35 pm by DDR »
Logged
Il Palazzo: "Urist, quick, grab your ax! There's a troll rampaging through the decimal conversion chambers!"
melomel: DF is like OCD candy, isn't it? existent: No, DF is like the stranger in the trench coat offering the candy.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: DDR's Essential Dwarf Fortress Hotkeys (.exe)
« Reply #10 on: February 19, 2012, 03:22:00 pm »

Thanks for the PM. I downloaded it, and will play around a bit. If it works as well as I think, I would like to make it a default part of my mod. Just another step towards user-accessability. :)
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

DDR

  • Bay Watcher
    • View Profile
    • Frogatto
Re: DDR's Essential Dwarf Fortress Hotkeys (.exe)
« Reply #11 on: February 19, 2012, 09:06:13 pm »

I'm flattered.  :D
Let me know if it doesn't work, I haven't been able to properly test it.
Logged
Il Palazzo: "Urist, quick, grab your ax! There's a troll rampaging through the decimal conversion chambers!"
melomel: DF is like OCD candy, isn't it? existent: No, DF is like the stranger in the trench coat offering the candy.