Error with Numpad7

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Flameboy99

Error with Numpad7

18 Jan 2014, 11:46

I'm quite new to AHK, and I've been trying to write a script for me to use my Numpad9, 6, and 3 keys to emulate the Numpad1, 2, 4, 5, 7, and 8 keys, since they've broken, and they're important in many roguelike games. It's a fairly simple script, but when I run it, it returns the error:
"Error at line 6.
Line text: Numpad7
Error: This line does not contain a recognized action.
This program will exit"
As you can likely tell, I have no idea how to fix this problem. Checking the documentation, everything seems to be correct. Of course, knowing my skill with this kind of thing, it's probably something painfully obvious. Here's the code I'm using:

#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.
NumpadMult::SetNumLockState AlwaysOn
NumpadEnter & Numpad9::Numpad7
NumpadEnter & Numpad6::Numpad4
NumpadEnter & Numpad3::Numpad1
NumpadAdd & Numpad9::Numpad8
NumpadAdd & Numpad6::Numpad5
NumpadAdd & Numpad3::Numpad2
timeFlies
Posts: 146
Joined: 22 Oct 2013, 20:54
Location: Somewhere in the northern hemisphere.

Re: Error with Numpad7

18 Jan 2014, 16:59

(Don't like our code boxes?)

Hmm... I wonder why it doesn't work. It seems that combination hotkeys (using &) don't work that way. Instead, you have to use Send, like this:

Code: Select all

NumpadMult::SetNumLockState AlwaysOn
NumpadEnter & Numpad9::Send {Numpad7}
NumpadEnter & Numpad6::Send {Numpad4}
NumpadEnter & Numpad3::Send {Numpad1}
NumpadAdd & Numpad9::Send {Numpad8}
NumpadAdd & Numpad6::Send {Numpad5}
NumpadAdd & Numpad3::Send {Numpad2}
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Error with Numpad7

18 Jan 2014, 17:55

The syntax for the built-in remapping feature is OriginKey::DestinationKey.
Source: Remapping Keys and Buttons
Not OriginKey1 & OriginKey2::DestinationKey. Custom combinations are not supported.
Flameboy99

Re: Error with Numpad7

18 Jan 2014, 18:15

Thanks, Chaz. Also, I didn't realize these forums had code boxes, though in hind sight, that should have been obvious :lol:
kon as guest

Re: Error with Numpad7

18 Jan 2014, 19:19

[code]Guests are not allowed to use BBCode tags[/code]
Source: I'm posting as a guest.
timeFlies
Posts: 146
Joined: 22 Oct 2013, 20:54
Location: Somewhere in the northern hemisphere.

Re: Error with Numpad7

19 Jan 2014, 20:17

kon as guest wrote:

Code: Select all

Guests are not allowed to use BBCode tags
Source: I'm posting as a guest.
I didn't know that. Might I ask why that is? I didn't even know we could post as a guest.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Anput, Google [Bot], mcd, mikeyww, Nerafius and 129 guests