Login

russian armor

ahk script not working

26 Dec 2020, 19:14 PM
#1
avatar of blade141

Posts: 15

Hey Guys,

I'm using ahk scripts to change my hotkeys, but mine stopped working somehow.
It's disabling as soon as I tab into CoH2.

Heres the content:

#IfWinActive, Company Of Heroes 2
{

;;;;;;;;;;;;; return enables normal chat
Return::
Suspend

if ( A_IsSuspended ){
Send {Enter}
}

if ( !A_IsSuspended ){
Send {Enter}
}
return

;;;;;;;;;;;;; shift + return enables normal chat
+Return::
Suspend

if ( A_IsSuspended ) {
Send +{Enter}
}

if ( !A_IsSuspended ) {
Send +{Enter}
}
return

;;;;;;;;;;;;; alt for tactical map
Lctrl::Numpad0

;;;;;;;;;;;;; disables "jump to newest event", adds release of wasd keys to "catch" camera when camera keys are stuck
Space::Send {Up up}{Down up}{Left up}{Right up}

;;;;;;;;;;;;; prevention of camera movement being stuck and lifting wasd keys also stop camera keys (WIP: key lose normal functionality)
;w up::Send {Up up}
;s up::Send {Down up}
;a up::Send {Left up}
;d up::Send {Right up}

;;;;;;;;;;;;; normal function
#if !GetKeyState("LCtrl", "P&quot")
{

w::Up
s::Down
a::Left
d::Right
}

}


I hope somebody can help me out!
Greetings!
26 Dec 2020, 21:43 PM
#2
avatar of JibberJabberJobber

Posts: 1614 | Subs: 3

No idea why it bugs out for you, but you can make some parts of your script simpler, below is what I use.

Re-enable chat:
Code
; Suspend script when opening chat and reenable script when sending message
*~Enter::Suspend

Multi-functional WASD keys that don't get stuck (order is important):
Code
; Disable Control Key except as modifier key
*LCtrl::return

; Set Space to Control
*Space::LCtrl

; Following 3 sections: WASD functions as arrow keys if Control is held down and as WASD if not.

w Up::Send {up Up}{w Up}
a Up::Send {left Up}{a Up}
s Up::Send {down Up}{s Up}
d Up::Send {right Up}{d Up}

#if GetKeyState("LCtrl", "P")
w::up
a::left
s::down
d::right

#if !GetKeyState("LCtrl", "P")
w::w
a::a
s::s
d::d
28 Dec 2020, 13:17 PM
#3
avatar of Mithiriath
Director of Social Media Badge

Posts: 830 | Subs: 3

@JibberJabberJobber out of curiosity why mapping LCtrl to Space key and not use directly space key ?

(You can use the bbcode [code] to avoid smiley detection. ^^)

30 Dec 2020, 01:22 AM
#4
avatar of JibberJabberJobber

Posts: 1614 | Subs: 3

@JibberJabberJobber out of curiosity why mapping LCtrl to Space key and not use directly space key ?


It's kinda deceiving, GetKeyState("LCtrl", "P") looks at the original LCtrl key, not the input LCtrl.

(You can use the bbcode [code] to avoid smiley detection. ^^)


Thanks, I was looking for something like that.
1 user is browsing this thread: 1 guest

Ladders Top 10

  • #
    Steam Alias
    W
    L
    %
    Streak
Data provided by Relic Relic Entertainment

Replay highlight

VS
  • U.S. Forces flag cblanco ★
  • The British Forces flag 보드카 중대
  • Oberkommando West flag VonManteuffel
  • Ostheer flag Heartless Jäger
uploaded by XXxxHeartlessxxXX

Board Info

616 users are online: 616 guests
2 posts in the last 24h
8 posts in the last week
40 posts in the last month
Registered members: 49065
Welcome our newest member, Huhmpal01
Most online: 2043 users on 29 Oct 2023, 01:04 AM