Auto Hotkey script for numberpad users

Post » Thu Nov 26, 2015 9:39 pm

If you're a lefty like me, you're probably annoyed that you can't rebind anything to the numberpad. I've sorted out a fix using Auto Hotkey, so I thought I'd post it here to help anyone else in the same boat.

This is also useful for others who use non-default key bindings, since some actions like looting are hardcoded (to E in this case) and don't properly change with your new binds.

First thing, download and install http://www.autohotkey.com/.

With that done, right-click on your desktop and in the context menu, click New>Auto Hotkey script.

It will create a notepad document with a few lines of code at the top. Below those lines, paste in the lines of text that I've posted below. I've mapped movement to 8456, E and Q to 7 and 9, etc. I've kept everything default in the in-game key bindings, except Toggle Always Run. I changed that to Z instead of CapsLock so I wasn't always putting my keyboard in CAPSLOCK mode.

IMPORTANT: I've had to add a space between the : and the 'd' in the mapping for Numpad6 so the forum doesn't convert it to a smiley. Take out the extra space before you save your file.

I've also mapped for both NumLock on and NumLock off states, but you don't have to do that if you always keep NumLock turned on.

You can change the mapping to whatever you like using the format shown. I like to use the down arrow for Jump and the right arrow for Crouch, because that's where my thumb rests. That may be a problem down the road for settlement building if it depends on using the arrow keys. Dialogue uses the arrows, but you can also click with the mouse, so that hasn't been an issue for me.

EDIT: The settlements crafting menu does indeed need the arrow keys, so remapping them with AHK is no good. They can, however, be mapped in-game without impacting the crafting menu, so I've done that and taken them out of my script. Also, NumpadEnter can be mapped in-game, so I've taken that out of my script too. I still use it for Sprint, but now I can hopefully also use it when an interaction wants me to press Enter.

Once you're done, save the file, and run it before playing (double-click it, or right-click and select Run Script). You may need to run it as administrator. I just leave it on my desktop near the Fallout 4 shortcut so I don't forget about it. You can right-click the AHK icon in the taskbar and exit to end the script after you finish playing.

Anyway, here's the text for my remapped keys:

;Movement
Numpad8::w
NumpadUp::w
Numpad4::a
NumpadLeft::a
Numpad5::s
NumpadClear::s
Numpad6:: d
NumpadRight:: d

;take the space out before the d--stupid auto-smileys

;Run
NumpadDot::c
NumpadDel::c

;ToggleAlwaysRun-I remapped in game from capslock to Z

;this means I have a key handy for the menus that call for Z
Numpad3::z
NumpadPgDn::z

;AutoMove
NumpadDiv::x

;Bash
NumpadAdd::LAlt

;PIPboy
Numpad0::tab
NumpadIns::tab

;Interact
Numpad7::e
NumpadHome::e

;VATS
Numpad9::q
NumpadPgUp::q

;Reload
Numpad1::r
NumpadEnd::r

;Favorites
Numpad2::f
NumpadDown::f

;Menu functions
NumpadMult::t
NumpadSub::v

EDIT:

Since this may be more of a long-term fix than I had hoped, I've added a few things to streamline my process. I've added the following lines to my script after the initial lines that autogenerate when you create a new script:

#MaxHotkeysPerInterval 10000
#UseHook

These may or may not help with performance if you're having any issues with Auto Hotkey.

Run, C:\Games\Steam\steamapps\common\Fallout 4\Fallout4.exe
#IfWinActive, ahk_class Fallout4

This causes the script to launch Fallout 4 when I run it, and it also only functions when Fallout 4 is running. I've put a shortcut to the script file on the desktop, and changed the shortcut icon to the Fallout 4 icon. Now, I just use that shortcut instead of the Steam-generated one, and launch my AHK script and the game together.

Obviously, adjust the path as necessary to point to wherever you have the game installed.

User avatar
Ria dell
 
Posts: 3430
Joined: Sun Jun 25, 2006 4:03 pm

Post » Fri Nov 27, 2015 12:20 am

I did something similar (different keys, though) but there still remains a problem --- the game ~displays~ the key they originally 'hardwired' for a function, so I have to remember that when the screen shows A and D, for example, I have to press Num4 and Num6, ~my~ version of left / right.

I noticed that other keys like E, R, Z, Q and I think C pop up occasionally and I guess I'll just have to get used to remembering what I've called them instead. The game has no problem letting me map, for example, Numpad-Div (division symbol at the top of the pad) and even Numpad-Mult but Numnpad-Subtract it won't let me remap.

Not only do we need to be able to remap any key but the game needs to SHOW the new remapped key. VERY disappointed in my first few hours, having to move my fingers off my movement keys and scramble to reach over to "E" every time I wanted to loot a container, e.g. (had not yet remapped their hard-coded "E" to another key).

User avatar
Sammykins
 
Posts: 3330
Joined: Fri Jun 23, 2006 10:48 am

Post » Fri Nov 27, 2015 3:33 am

Yeah, the game not showing the new mapping in on-screen prompts is the one downside to using AHK. I find there are few enough key binds that I don't have trouble remembering what I've mapped, so it hasn't troubled me so far. I expect that this is just a temporary measure, anyway. In a day or two, people will have figured out how to unpack the new data format, and once we have access to the controlmap file, we can fix it more directly like with Skyrim (although, I seem to recall the onscreen prompts showing the hexadecimal code for the remapped keys with the original keybind fix mod). Hopefully BGS will eventually patch in proper keybinding like they did with Skyrim.

User avatar
T. tacks Rims
 
Posts: 3447
Joined: Wed Oct 10, 2007 10:35 am

Post » Thu Nov 26, 2015 11:20 pm

Thanks for helping out, lefty666. Unfortunately I don't quite understand this scripting stuff..

For instance, I like to use keypad / (above the 8 key) for reloading weapons, the 0 key (below 2) for jumping, and the , key (below 3) for sneaking. Can you explain how to bind them?

User avatar
Laura-Jayne Lee
 
Posts: 3474
Joined: Sun Jul 02, 2006 4:35 pm

Post » Fri Nov 27, 2015 2:05 am

The syntax is basically "what you will press"::"what the game will see". Lines that start with ; are just comment lines that the script ignores. I put them in for clarity, to make it easier to edit the script.

So, in your case, you want lines that say:

NumpadDiv::r

Numpad0::space

NumpadIns::space

NumpadDot::LCtrl

NumpadDel::LCtrl

Make sure you remove any mapping from my original binds that relate to the same keys, of course. Again, I've given double mappings to cover both states of Numlock so your binds still work if you hit the Numlock key (for instance, Numpad0 and NumpadIns are the same key).

User avatar
Leilene Nessel
 
Posts: 3428
Joined: Sun Apr 15, 2007 2:11 am

Post » Fri Nov 27, 2015 3:28 am

Thanks a lot, will try this out asap.

User avatar
Nikki Morse
 
Posts: 3494
Joined: Fri Aug 25, 2006 12:08 pm

Post » Thu Nov 26, 2015 2:25 pm

does this make the controls go wacky at all? I mean other people have reported switching a key to something else ends up interacting multiple ways like moving in a dicrection but also forced to pick up objects because the controls are now the same.

User avatar
Solina971
 
Posts: 3421
Joined: Thu Mar 29, 2007 6:40 am

Post » Thu Nov 26, 2015 6:28 pm

Lefty666, can you tell me what the * (star) and - (minus sign) on the keypad is called in the script, in case I want to use them for hotkeys?

User avatar
Floor Punch
 
Posts: 3568
Joined: Tue May 29, 2007 7:18 am

Post » Thu Nov 26, 2015 4:27 pm

I'd be interested to know what the "reserved" numpad keys are intended to be used for.... if they're reserved and unable to be bound to another function then surely they must have some function? What IS it? If they are controls for playing the mini-games on holo-tape then I may just lose my [censored] because that's no reason to restrict us using those keys for actually playing the ~main game~.

When I get home tonight from work ( ::shakes fist at work:: ) then I'm going to see about setting up AutoHotkey binds for everything like E and R and Z which show up in many places (apparently hard-coded to some functions). I can spoof the keyboard into telling the game that when I press the Numpad Subtract key, for example, that I am "really" pushing the TAB button.... of course the screen will still say "Press Tab, duuur!" and I just have to remember which key I've mapped Tab TO.

Filed a Support ticket on beth's site but the automated Email I got seemed to pretty much say they weren't going to answer my question and I should just read their FAQ for all my answers. :brokencomputer:

User avatar
Isabell Hoffmann
 
Posts: 3463
Joined: Wed Apr 18, 2007 11:34 pm

Post » Thu Nov 26, 2015 5:32 pm

Auto Hotkey works well. I played for a couple hours with this script and had no issues. I tried another program (G-Hotkey) but it was giving me an 8 before a string of W's, so if I had hotkeys assigned, I would constantly be switching weapons while I moved around.

People who move with ESDF are having trouble due to hardcoded keys (mainly E). The game allows you to remap Activate to something other than E, and then to map forward movement to E. The problem is, some actions like looting don't use the new assignment for the Activate key, they still use E. So, you're moving forward by pressing E, and the game takes that input and applies it to looting or grabbing physics objects.

By using AHK, you can get around this by leaving the in-game keybinds as default and remapping the E key to be seen as W, and something else to be seen as E.

Here's a link to the http://autohotkey.com/docs/KeyList.htm. Those are NumpadMult and NumpadSub.

I believe the numpad keys are reserved for hotkeys (the same as the number keys across the top of the keyboard). I guess they figure people might like to take their right hand off the mouse to press their hotkeys rather than taking their left hand off WASD.

User avatar
MISS KEEP UR
 
Posts: 3384
Joined: Sat Aug 26, 2006 6:26 am

Post » Thu Nov 26, 2015 8:55 pm

lefty666, thank you so much for helping me out! Now I can play the game, and the numpad works perfectly.

You da man :)

User avatar
JAY
 
Posts: 3433
Joined: Fri Sep 14, 2007 6:17 am

Post » Thu Nov 26, 2015 5:51 pm

If the numpad is reserved to, essentially, duplicate the 0 - 9 keys across the top of the keyboard then I won't miss anything by remapping them and "losing" the ability to tell the game I have pressed Num6, or whatever.

Still going to take some training to remember that when the game tells me to hit "E", I should actually hit Num7 or whatever.

That makes me wonder.... if you see an item out in the world, you can hit Activate (END, in my case) and pick it up... but if it's inside a container, you HAVE to hit "E".... what if I map my Activate key to "E" (assuming it will let me) and then use AutoHotKey to tell the game that when I press END it's actually "E"? Would that mean I only had to hit ~one~ button (END, in my case, telling the computer to think I hit "E") to loot?

EDIT: Just realized, there may be one potential danger ---- some feature (like a mini-game) may ask me to press Activate ~or~ E and if I have them mapped to the same key (and then re-mapped through AutoHotKey to something else again) then it may bogart the game.

Speaking of loot, seems like containers had "E" for looting individual items (I guess you could mouse over or directional-arrow-key to pick individual items) and "R" for Transfer, which lets you place things ~into~ the container (and presumably take them out of it).... but is there a Take All button? I've just been spamming "E" to loot each item individually. Find out tonight, I guess, as I imagine I'll spend all evening just figuring out a control scheme to force the game to recognize.

User avatar
Ricky Meehan
 
Posts: 3364
Joined: Wed Jun 27, 2007 5:42 pm

Post » Fri Nov 27, 2015 3:41 am

First of all, thanks for posting your script. I can't play the game without remapping the numpad, so this will be great.
Last night when I discovered I could not rebind those keys I had a flashback from Skyrim. Unlike Skyrim, though, there doesn't appear to be a controlmap file in the interface bsa (ba2) file. I looked in several ba2 files with no luck. There's a 'customControlmap.txt' in the user folder but it's not a real text file that you can edit with notepad. You have to look at it with a hex editor and I haven't been able to figure it out yet. Then again, there's no guarantee that editing it would make the numpad usable for anything other than hotkeys.
There's a ba2 extraction tool on the Nexus already and the F4SE team made a command line version.
User avatar
CHangohh BOyy
 
Posts: 3462
Joined: Mon Aug 20, 2007 12:12 pm

Post » Thu Nov 26, 2015 8:53 pm

Yeah, since the game already expects Activate and E to be the same key, there's never a conflict there. Remapping your Activate key to equal E through AHK works just fine, and gets rid of the annoying problem of having to use E for some things instead of Activate.

I was planning on digging into the BA2 files tonight, but I've heard from more than one person that there's no controlmap file in there. I don't think the customcontrolmap file would have the hardcoded stuff in it, but rather just the in-game remapping. I just redownloaded the Skyrim mod to review how the mapping was done (and to get the hexadecimal codes for the numpad keys). If I could get the right controlmap file, I could fix it in a few minutes.

User avatar
Elisha KIng
 
Posts: 3285
Joined: Sat Aug 18, 2007 12:18 am

Post » Fri Nov 27, 2015 4:06 am

I have not been able to find a full controlmap (even Skyrim didn't have a *full* one, but it had less hardcoded keys). DragonBoon was looking into the SWF files last night.

Remapping E (and WASD) kind of works, but breaks typing text (like a character name or renaming a weapon). I had that problem with Skyrim, never could backspace through text.

Also, the arrow keys are hardcoded in some menus, so using them for movement has already resulted in screwed up or canceled conversations.

It's not just that they wrote off all non-WASD players, it's that they did it silently, and none of the reviewers (that I can see) have mentioned it. I don't know why we need them for anything.

User avatar
luke trodden
 
Posts: 3445
Joined: Sun Jun 24, 2007 12:48 am

Post » Fri Nov 27, 2015 12:55 am

I can't seem to figure out what key is used to litf/manipulate objects without taking them, as in previous games. Or is this just gone now?!

User avatar
W E I R D
 
Posts: 3496
Joined: Tue Mar 20, 2007 10:08 am

Post » Thu Nov 26, 2015 3:24 pm

Press and hold E. It's hardcoded, so it won't move with your remapped Activate key, but it will if you've remapped with AHK. Some objects/bodies can't be manipulated in the early part of the game (before exiting the the Vault).

User avatar
Jade
 
Posts: 3520
Joined: Mon Jul 10, 2006 6:42 am

Post » Fri Nov 27, 2015 2:21 am

I eventually got an AHK script going that kind of worked. The keys were to be in event mode and run it as administrator, and the latest Nvidia drivers helped resolve a couple of issues, like the mouse zone being 22mm away from the pointer.

Previously, I could only run AHK in fullscreen mode but the mouse didn't work properly.

The interface is still obnoxious, but I can move around now and interact, mostly.

User avatar
Alexis Estrada
 
Posts: 3507
Joined: Tue Aug 29, 2006 6:22 pm

Post » Thu Nov 26, 2015 7:39 pm

Since this may be more of a long-term fix than I had hoped, I've added a few things to streamline my process. I've added the following lines to my script after the initial lines that autogenerate when you create a new script:

#MaxHotkeysPerInterval 10000
#UseHook

These may or may not help with performance if you're having any issues with Auto Hotkey.

Run, C:\Games\Steam\steamapps\common\Fallout 4\Fallout4.exe
#IfWinActive, ahk_class Fallout4

This causes the script to launch Fallout 4 when I run it, and it also only functions when Fallout 4 is running. I've put a shortcut to the script file on the desktop, and changed the shortcut icon to the Fallout 4 icon. Now, I just use that shortcut instead of the Steam-generated one, and launch my AHK script and the game together.

Obviously, adjust the path as necessary to point to wherever you have the game installed.

I've added this to the original post. I hope it helps.

User avatar
Eoh
 
Posts: 3378
Joined: Sun Mar 18, 2007 6:03 pm

Post » Thu Nov 26, 2015 11:13 pm

Hi Lefty666.

I tried to add the lines as you suggested, but Fallout 4 won't start when I run the script. I have adjusted the path to point to my executable.

I've pasted my script below. Can you see anything wrong?

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#MaxHotkeysPerInterval 10000
#UseHook
;Movement
Numpad8::w
NumpadUp::w
Numpad4::a
NumpadLeft::a
Numpad2::s
NumpadDown::s
Numpad6::D
NumpadRight::D
;Quick Stats
;NumpadMin::k
;Jump
Numpad0::Space
NumpadIns::Space
;Crouch
NumpadDot::LCtrl
NumpadDel::LCtrl
;Sprint
;NumpadEnter::LShift
;Run
;NumpadDot::c
;NumpadDel::c
;ToggleAlwaysRun-I remapped in game from capslock to z
;Numpad3::z
;NumpadPgDn::z
;Bash
Numpad7::LAlt
NumpadHome::LAlt
;PIPboy
;Numpad0::tab
;NumpadIns::tab
;Interact
;Numpad7::e
;NumpadHome::e
NumpadEnter::e
;VATS
NumpadAdd::q
;NumpadPgUp::q
;Reload
NumpadDiv::r
Run,E:\SteamLibrary\steamapps\common\Fallout 4\Fallout4.exe
#IfWinActive, ahk_class Fallout4
User avatar
Leah
 
Posts: 3358
Joined: Wed Nov 01, 2006 3:11 pm

Post » Thu Nov 26, 2015 8:29 pm

I think you just need a space after the comma in the Run line (Run, E:\...). Other than that, it looks fine. I put those two lines near the top of my own script (after #UseHook) instead of at the end, but I don't think that would make a difference.

Sorry for not replying sooner, the PC forum is moving quickly and I didn't see your question. Hope that works for you! :)

User avatar
Chris Johnston
 
Posts: 3392
Joined: Fri Jul 07, 2006 12:40 pm

Post » Thu Nov 26, 2015 3:41 pm

It worked perfectly, thank you very much :)

User avatar
Ian White
 
Posts: 3476
Joined: Thu Jul 19, 2007 8:08 pm


Return to Fallout 4