Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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.
- #IfWinActive, Sigrogana ; Makes sure the script is only active when a window with "Sigrogana" in the name is the active window
- outputKeys := {-1: {-1: "NumpadHome", 0: "NumpadLeft", 1: "NumpadEnd"}
- , 0: {-1: "NumpadUp", 0:"", 1: "NumpadDown"}
- , 1: {-1: "NumpadPgUp", 0: "NumpadRight", 1: "NumpadPgDn"}}
- f12:: ; this key suspends/unsuspends the script
- Suspend,Toggle
- return
- w::
- ProcessKeys("y", -1)
- return
- s::
- ProcessKeys("y", 1)
- return
- w up::
- s up::
- ProcessKeys("y", 0)
- return
- a::
- ProcessKeys("x", -1)
- return
- d::
- ProcessKeys("x", 1)
- return
- a up::
- d up::
- ProcessKeys("x", 0)
- return
- ^Esc::
- ExitApp
- ProcessKeys(axis, vector){
- static keyVectors := {x: 0, y: 0}
- static otherAxes := {x: "y", y: "x"}
- global outputKeys
- otherAxis := otherAxes[axis]
- newVectors := {}
- newVectors[axis] := vector
- newVectors[otherAxis] := keyVectors[otherAxis]
- oldKey := outputKeys[keyVectors.x, keyVectors.y]
- newKey := outputKeys[newVectors.x, newVectors.y]
- if (newKey != oldKey){
- if (oldKey != ""){
- str := "{Blind}{" oldKey " up}"
- Send % str
- ;~ ToolTip % str
- }
- if (newKey != ""){
- str := "{Blind}{" newKey " down}"
- Send % str
- ;~ ToolTip % str
- }
- keyVectors[axis] := vector
- }
- }
- #IfWinActive ; changes wasd back to wasd when Sig isn't active/when any window other than Sig is active
- w::w
- s::s
- a::a
- d::d
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement