Kyopaxa Posted May 7, 2017 Share Posted May 7, 2017 Frustrated by the lack of a "keep forward" hotkey in game, I made a small AutoHotkey script that implements a "keep forward" functionality. It works like this: When you press q, you'll keep moving forward. Pressing q again, backward or forward keys will cancel it. Use at your own risk, if your character dies jumping from a cliff because of this, don't blame me. What is AutoHotkey AutoHotkey is an automation/macro program that runs scripts tied to hotkeys or other events. It is widely used, open source, and has been out there for years. It is not a hack, consider it similar to those fancy keyboards with extra function keys, but without the need of a fancy keyboard. Also, it shouldn't affect your performance, the script is really light. You can find more information and download AutoHotkey here. You'll have to install it in order to use the script below. The "Keep forward" script Once you have AutoHotkey installed, you can save this script in a text file with ahk extension (or download it directly from this post, attached) and double click it when you want to play. AutoHotkey will open it and leave it running in a tray icon. What this script does is really simple. It listens to three hotkeys, then presses or releases the forward key according to the situation. If for any reason you use different keys for forward or backward in game, change them in the first lines of the text to match the ones you want to use. forwardKey := "w" backwardsKey := "s" keepForwardKey := "q" TLDProcessName := "tld.exe" forwardWasDown = 0 Hotkey, *%keepForwardKey%, KeepForward Hotkey, ~*%forwardKey% UP, ForwardUp Hotkey, ~*%backwardsKey%, Backwards return ; Keep forward KeepForward: WinGet, activeProcess, ProcessName, A if (activeProcess != TLDProcessName) { Send, {%keepForwardKey%} return } if (GetKeyState(forwardKey, "P")) { ; if forward was physically down, save it to keep it down when it goes up forwardWasDown = 1 } else if (GetKeyState(forwardKey)) { ; if forward was not physically down, but it was pressed by authotkey, cancel forward send, {%forwardKey% up} } else { ; else, activate Keep forward send, {%forwardKey% down} } return ; Going backwards cancels Keep forward Backwards: WinGet, activeProcess, ProcessName, A if (activeProcess = TLDProcessName and GetKeyState(forwardKey)) { send, {%forwardKey% up} } return ; Don't allow forward UP to cancel Keep forward if it was activated when going forward ForwardUp: WinGet, activeProcess, ProcessName, A if (forwardWasDown = 1) { if (activeProcess = TLDProcessName) { send, {%forwardKey% down} } forwardWasDown = 0 } return TLD-KeepForward.ahk Link to comment Share on other sites More sharing options...
PINGU Posted May 7, 2017 Share Posted May 7, 2017 Thanks. How much does this affect game performance? I guess it would if it works thru an external program Link to comment Share on other sites More sharing options...
Carbon Posted May 7, 2017 Share Posted May 7, 2017 It would have to or it would violate the EULA, a hack. Link to comment Share on other sites More sharing options...
Kyopaxa Posted May 7, 2017 Author Share Posted May 7, 2017 3 hours ago, PINGU said: Thanks. How much does this affect game performance? I guess it would if it works thru an external program AutoHotkey is a hotkey/scripting external program designed to be used for automation, and has been out there for years. It's not heavy on the system, but it depends on what you script with it, of course. This "keep forward" script is super simple, really, I doubt you'll notice anything with it running in the background. The only thing it does is to listen to 3 hotkeys, then press or release the forward key according to what key you pressed. Link to comment Share on other sites More sharing options...
Kyopaxa Posted May 7, 2017 Author Share Posted May 7, 2017 2 hours ago, Carbon said: It would have to or it would violate the EULA, a hack. I doubt this can be considered a hack since it doesn't interfere with any memory or file from The Long Dark directly. It's just a keyboard macro. Lots of fancy keyboards out there do similar things. This is just software based, no need for a fancy keyboard Link to comment Share on other sites More sharing options...
Dirmagnos Posted May 7, 2017 Share Posted May 7, 2017 2 hours ago, Carbon said: It would have to or it would violate the EULA, a hack. I seriously doubt that you actually read terms of service, to post something as unintelligent. Personally i just use X-Mouse, since i have 2 extra keys on my mouse, this way they serve a purpose as well. Link to comment Share on other sites More sharing options...
Kyopaxa Posted May 8, 2017 Author Share Posted May 8, 2017 Edited the script to ensure it only presses the forward key if you are playing TheLongDark. This will prevent the script from doing anything in other programs, which can be annoying if you forgot to close the script after playing Also added more info to the OP and attached the script for direct download. Enjoy! Link to comment Share on other sites More sharing options...
JAFO Posted May 19, 2017 Share Posted May 19, 2017 So many times I've wished I could put a brick on the 'W' key.. Many, many thanks for supplying such an elegant brick! I'm loving it. Link to comment Share on other sites More sharing options...
Amazombie Posted May 19, 2017 Share Posted May 19, 2017 Yeah , i made this too! lol I use AHK for other games as well. Mainly 7 days to die, ya dont want to be clicking to take down a 10k gun safe at 10 pts a hack lol would be nice if auto walk was put in the game thou. Link to comment Share on other sites More sharing options...
Pillock Posted May 19, 2017 Share Posted May 19, 2017 3 hours ago, JAFO said: So many times I've wished I could put a brick on the 'W' key.. I usually use a €0.01 coin jammed between the 'W' key and the '2' and '3' keys. Allows one to eat sandwiches while playing. Link to comment Share on other sites More sharing options...
Ruruwawa Posted May 19, 2017 Share Posted May 19, 2017 I use an autohotkey script too -- I have to after a long hiatus from TLD to heal a repetitive use injury to my W finger, ugh. (Never had this problem with any other WASD game, I blame the wind. ) My script is a little different: It disables autowalk if certain UI keys are pressed - Inventory, Radial, and Clothing (prevents autowalk from trying to navigate the UI in these windows!) Also disables autowalk if you press W or S... but not the strafe keys. So you can just tap W to stop to pick up a stick. Or if you backpedal when you spot a wolf, autowalk is cancelled. I use some different code for the same functionality... maybe a bit more performant and compact ; Autowalk for The Long Dark ; To cancel autowalk hit the (autowalk) key again, or press w, s, (inventory), (radial) or (clothing) #SingleInstance Force #IfWinActive ahk_exe tld.exe ; only when TLD is the active window Numpad7:: ; KEYBIND Autowalk SendInput % "{w " ( (autowalk:=!autowalk) ? "down" : "up" ) "}" Return #if autowalk ; PERFORMANCE capture these keystrokes only when autowalk is active w:: s:: TAB:: ; KEYBIND inventory c:: ; KEYBIND clothing SendInput {%A_ThisHotkey%} autowalk:=0 SendInput {w up} Return e:: ; KEYBIND Radial menu autowalk:=0 SendInput {w up} SendInput {%A_ThisHotkey% down} Return #if Going for the best performance (and because I'm lazy) I hardcoded my personal keybinds into the script. I honestly no longer remember the defaults, but they aren't hard to change. Look for KEYBIND in the script above and substitute the key name at the start of the line (before the two colons) with the name of the key or mouse button you use. Consult this page for the names of special keys: https://autohotkey.com/docs/KeyList.htm. One important tip: AutoHotKey is incredibly picky about spaces vs. tabs. The indented lines MUST start with a single tab, so make sure your editor doesn't convert to spaces or the script won't run. Link to comment Share on other sites More sharing options...
JAFO Posted June 12, 2017 Share Posted June 12, 2017 Here's my customised version of @Ruruwawa's script.. adapted to use 'q', the same as @Kyopaxa's script, and with Ruruwawa's custom keybinds replaced by standard ones. It's also been tweaked to play nice with v.423 Cartographer. ; Autowalk for The Long Dark ; To cancel autowalk hit the (autowalk) key again, or press w, s, (inventory), (radial) or (clothing) #SingleInstance Force #IfWinActive ahk_exe tld.exe ; only when TLD is the active window q:: ; KEYBIND Autowalk SendInput % "{w " ( (autowalk:=!autowalk) ? "down" : "up" ) "}" Return #if autowalk ; PERFORMANCE capture these keystrokes only when autowalk is active w:: s:: ; TAB:: ; KEYBIND information i:: ; KEYBIND inventory c:: ; KEYBIND clothing SendInput {%A_ThisHotkey%} autowalk:=0 SendInput {w up} Return Space:: ; KEYBIND Radial menu autowalk:=0 SendInput {w up} SendInput {%A_ThisHotkey% down} Return #if Link to comment Share on other sites More sharing options...
Ruruwawa Posted June 12, 2017 Share Posted June 12, 2017 @JAFO Thanks, nice to have a version of the script that uses the default keybinds. Just curious -- what did you change to play nice with v423? I didn't update my own script and it works the same as always. Link to comment Share on other sites More sharing options...
JAFO Posted June 13, 2017 Share Posted June 13, 2017 13 hours ago, Ruruwawa said: Just curious -- what did you change to play nice with v423? I commented out the TAB line.. so you can check your condition while you continue walking. Link to comment Share on other sites More sharing options...
Ruruwawa Posted June 13, 2017 Share Posted June 13, 2017 15 hours ago, JAFO said: I commented out the TAB line.. so you can check your condition while you continue walking. Ah gotcha. I use TAB for inventory so to me it looks like a straight replacement Link to comment Share on other sites More sharing options...
JAFO Posted August 15, 2017 Share Posted August 15, 2017 A new version, merged with @Ruruwawa's F2 RapidClicker for wolf struggles. ; Autowalk & RapidClicker for The Long Dark ; To cancel autowalk hit the (autowalk) key again, or press w, s, (inventory), (radial) or (clothing) ; Send left mouse button clicks by holding down a key ; Hold F2 down to send a left mouse click every 50 millisecond. Release F2 to stop sending clicks. #SingleInstance Force #IfWinActive ahk_exe tld.exe ; works only when TLD is the active window F2:: ; hold down 'F2' for wolf struggle While GetKeyState("F2", "P") { Click Sleep 50 } Return q:: ; KEYBIND Autowalk SendInput % "{w " ( (autowalk:=!autowalk) ? "down" : "up" ) "}" Return #if autowalk ; PERFORMANCE capture these keystrokes only when autowalk is active w:: s:: ; TAB:: ; KEYBIND information i:: ; KEYBIND inventory c:: ; KEYBIND clothing SendInput {%A_ThisHotkey%} autowalk:=0 SendInput {w up} Return Space:: ; KEYBIND Radial menu autowalk:=0 SendInput {w up} SendInput {%A_ThisHotkey% down} Return #if Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.