Login

russian armor

help with auto hotkey

22 Jun 2018, 20:18 PM
#1
avatar of Songofournam

Posts: 8

So I downloaded ahk a few weeks ago, and I have tried to do some research on it. and there are changes that I want to make but don't know how. like:

1: protect my chat

2: how to click one button to shoot out a sentence within the chat.

3: cycle through idle units using the mouse wheel (partially because I don't know how to do that in the first place).

a big thanks for any help. its much appreciated!


#IfWinActive, Company Of Heroes 2

w::up

s::down

a::left

d::right

q::numpad0

+q::q

+w::w

+e::e

+r::r
22 Jun 2018, 21:07 PM
#2
avatar of YRon²y

Posts: 222

hey,

if you wanne say things with the click of one button (actually 2 to open chat :P)
you have to do this
->
Numpad1:: send, Hey, hf
(for some reasson he can't just say what he has to say but the >send< should be on the >:<) (like w::r no space left between) (i hope you know what i mean)

everything after 'send,' will normally be said it doesn't matter if you put a ',' you'll have to figure out what works and what doesn't.

you can change numpad or the text behind it to whatever you want. this is just what i think i use :P.

for the mousewheel, you just have to switch the button for 'iddle units'(just go above the button and normally it will show what you need to press, if it has a hotkey) to the key of ahk for mousewheels (could be named xbuttonmiddle for instance) (for the buttons on the side of your mouse it is xbutton1,2... and so on. that i know for sure)
for instance, lets say 'switch to iddle units' is button 'x' for coh2, and mousewheel is button 'xbuttonm' for ahk
->
x::xbuttonm

you can do things like making it so that you only use it when capslock is on and so on...
just go look a bit up on ahk and you'll find it. it isn't much work if you really want it.

btw i don't know what you mean by 'protect my chat'

anyways gl! :)

22 Jun 2018, 22:11 PM
#3
avatar of d0ggY
Senior Caster Badge

Posts: 823 | Subs: 3

So I downloaded ahk a few weeks ago, and I have tried to do some research on it. and there are changes that I want to make but don't know how. like:

1: protect my chat

2: how to click one button to shoot out a sentence within the chat.

3: cycle through idle units using the mouse wheel (partially because I don't know how to do that in the first place).

a big thanks for any help. its much appreciated!


#IfWinActive, Company Of Heroes 2

w::up

s::down

a::left

d::right

q::numpad0

+q::q

+w::w

+e::e

+r::r



A small hint, you could put q::u , thats how you can move back your tanks easily. This was one of the best changes i did for myself imo!
23 Jun 2018, 01:27 AM
#4
avatar of Songofournam

Posts: 8

jump backJump back to quoted post22 Jun 2018, 21:07 PMYRon²y
hey,

if you wanne say things with the click of one button (actually 2 to open chat :P)
you have to do this
->
Numpad1:: send, Hey, hf
(for some reasson he can't just say what he has to say but the >send< should be on the >:<) (like w::r no space left between) (i hope you know what i mean)

everything after 'send,' will normally be said it doesn't matter if you put a ',' you'll have to figure out what works and what doesn't.

you can change numpad or the text behind it to whatever you want. this is just what i think i use :P.

for the mousewheel, you just have to switch the button for 'iddle units'(just go above the button and normally it will show what you need to press, if it has a hotkey) to the key of ahk for mousewheels (could be named xbuttonmiddle for instance) (for the buttons on the side of your mouse it is xbutton1,2... and so on. that i know for sure)
for instance, lets say 'switch to iddle units' is button 'x' for coh2, and mousewheel is button 'xbuttonm' for ahk
->
x::xbuttonm

you can do things like making it so that you only use it when capslock is on and so on...
just go look a bit up on ahk and you'll find it. it isn't much work if you really want it.

btw i don't know what you mean by 'protect my chat'

anyways gl! :)

23 Jun 2018, 01:29 AM
#5
avatar of Songofournam

Posts: 8

by protect my chat I mean when I'm in game and I have to type the keys I use to move. i.e., wasd it wont type for me at all so I cant really get my message out. that's what I mean. guess I shouldn't of been so vague lol but thankyou
23 Jun 2018, 02:24 AM
#6
avatar of d0ggY
Senior Caster Badge

Posts: 823 | Subs: 3

Do you know the Program Celo? It can create a full autohotkey script for you! Company of Elo on Google, you should find a link to this website where it's linked.

it must be

UP::w
DOWN::s
LEFT::a
RIGHT:d

then you need to use those replacements to write!


When i used AHK you could deactivate the script, but doing that ingame is too much time, so i would just get used to use up as w etc.
23 Jun 2018, 13:42 PM
#7
avatar of Songofournam

Posts: 8

jump backJump back to quoted post23 Jun 2018, 02:24 AMd0ggY
Do you know the Program Celo? It can create a full autohotkey script for you! Company of Elo on Google, you should find a link to this website where it's linked.

it must be

UP::w
DOWN::s
LEFT::a
RIGHT:d

then you need to use those replacements to write!


When i used AHK you could deactivate the script, but doing that ingame is too much time, so i would just get used to use up as w etc.
23 Jun 2018, 13:46 PM
#8
avatar of Songofournam

Posts: 8

Im have the worst time trying to find where the program is executable from.. Im sorry im not tech savy. Do happen to know what im looking for. I thought maybe a short cut. But then the only thing i could think of was the actual fire desination is but thats not it ether. Nothing has been moned so its standard setup as far as location. Do you know where to look?
23 Jun 2018, 13:59 PM
#9
avatar of d0ggY
Senior Caster Badge

Posts: 823 | Subs: 3

Im have the worst time trying to find where the program is executable from.. Im sorry im not tech savy. Do happen to know what im looking for. I thought maybe a short cut. But then the only thing i could think of was the actual fire desination is but thats not it ether. Nothing has been moned so its standard setup as far as location. Do you know where to look?


Which Program do you mean? AHK or Celo?

https://www.coh2.org/topic/18454/celo-company-of-elo --> The download link in this thread! Then you can create a AHK script with it. It's how i did it !


23 Jun 2018, 15:08 PM
#10
avatar of Songofournam

Posts: 8

jump backJump back to quoted post23 Jun 2018, 13:59 PMd0ggY


Which Program do you mean? AHK or Celo?

https://www.coh2.org/topic/18454/celo-company-of-elo --> The download link in this thread! Then you can create a AHK script with it. It's how i did it !


im talking about celo, I have the program but in the "essential settings" (the first time you use it) I cant find where the program is executable. figure im looking for an exe. file but its no where to be found. I feel really dumbfounded. I looked in all the coh2 folders tried steam. I just don't understand.
23 Jun 2018, 15:11 PM
#11
avatar of ferwiner
Donator 11

Posts: 2885

jump backJump back to quoted post23 Jun 2018, 02:24 AMd0ggY
Do you know the Program Celo? It can create a full autohotkey script for you! Company of Elo on Google, you should find a link to this website where it's linked.

it must be

UP::w
DOWN::s
LEFT::a
RIGHT:d

then you need to use those replacements to write!


When i used AHK you could deactivate the script, but doing that ingame is too much time, so i would just get used to use up as w etc.


You should be able to use a variable in your script to disable key bindings between one press of enter key and another.
23 Jun 2018, 15:14 PM
#12
avatar of d0ggY
Senior Caster Badge

Posts: 823 | Subs: 3

im talking about celo, I have the program but in the "essential settings" (the first time you use it) I cant find where the program is executable. figure im looking for an exe. file but its no where to be found. I feel really dumbfounded. I looked in all the coh2 folders tried steam. I just don't understand.


Seems like an issue i cant help you out with either , im sorry!
23 Jun 2018, 15:14 PM
#13
avatar of d0ggY
Senior Caster Badge

Posts: 823 | Subs: 3



You should be able to use a variable in your script to disable key bindings between one press of enter key and another.


Then explain it to OP! Because i got no Idea how to! :)
A_E
23 Jun 2018, 15:19 PM
#14
avatar of A_E
Lead Caster Badge
Donator 11

Posts: 2439 | Subs: 6

23 Jun 2018, 15:56 PM
#15
avatar of ferwiner
Donator 11

Posts: 2885

jump backJump back to quoted post23 Jun 2018, 15:14 PMd0ggY


Then explain it to OP! Because i got no Idea how to! :)


Sure thing. Here is a simple example showing how to replace a with b, that should not be active during in-game chat:


#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.

#ifWinActive Company Of Heroes 2

Enter::
chatMode := !chatMode
Send {Enter}
Return

Numpad9:: ;Just so you can change the state if it goes wrong
chatMode := !chatMode
Return

$a::
if(chatMode) {
Send a
} else {
Send b
}
Return


@OP I used numpad9 as additional switch in case it starts to work the other way round, couse enter always opens a chat window. It might be needed if you hide the chat window with some other key like escape.
23 Jun 2018, 16:26 PM
#16
avatar of Songofournam

Posts: 8

thankyou guys. sorry for the confusion. much appreciated help
23 Jun 2018, 21:46 PM
#17
avatar of YRon²y

Posts: 222

by protect my chat I mean when I'm in game and I have to type the keys I use to move. i.e., wasd it wont type for me at all so I cant really get my message out. that's what I mean. guess I shouldn't of been so vague lol but thankyou


as i said, using caps could be your solution. i use it aswel, just caps on when i play caps of when i type. this is my solution to that.

type this under coh2myactive shiet
~CapsLock::Suspend, % GetKeyState("CapsLock","t") ? "Off" : "On"

nvm i read things from ferwiner and it's way better :P i never took so much time in to ahk that i found that :P thx aswel ferwiner
23 Jun 2018, 22:13 PM
#18
avatar of ferwiner
Donator 11

Posts: 2885

jump backJump back to quoted post23 Jun 2018, 21:46 PMYRon²y


as i said, using caps could be your solution. i use it aswel, just caps on when i play caps of when i type. this is my solution to that.

type this under coh2myactive shiet
~CapsLock::Suspend, % GetKeyState("CapsLock","t") ? "Off" : "On"

nvm i read things from ferwiner and it's way better :P i never took so much time in to ahk that i found that :P thx aswel ferwiner


I'm glad to help :D

Btw, the CapsLock solution has the advantage of giving a clear indicator showing whether your key bindings are on or off. To get the best of both worlds, while keeping the ability to write caps, use ScrollLock for state instead of a variable and either SetScrollLockState or Send {ScrollLock} under the Enter binding to change the state when you enter the chat. I prefer scroll lock over caps lock becouse it doesn't have a function in coh2.

Something like this:

#ifWinActive Company Of Heroes 2
;#this should run only once when you run the whole script
;#the state of "first" variable is reversed, but I didn't come up with a better name
if(!first){
SetScrollLockState, On
first := !first
}

Enter::
Send {Enter}
Send {ScrollLock}
Return

$a::
if(GetKeyState("ScrollLock", "T")) {
Send b
} else {
Send a
}
Return


Now you can see that hotkeys are on when the light is on. You can also spare the numpad9 button for something else couse you can switch the wrong state with the scroll lock button.
24 Jun 2018, 11:20 AM
#19
avatar of YRon²y

Posts: 222



I'm glad to help :D

Btw, the CapsLock solution has the advantage of giving a clear indicator showing whether your key bindings are on or off. To get the best of both worlds, while keeping the ability to write caps, use ScrollLock for state instead of a variable and either SetScrollLockState or Send {ScrollLock} under the Enter binding to change the state when you enter the chat. I prefer scroll lock over caps lock becouse it doesn't have a function in coh2.

Something like this:

#ifWinActive Company Of Heroes 2
;#this should run only once when you run the whole script
;#the state of "first" variable is reverted, but I didn't come up with a better name
if(!first){
SetScrollLockState, On
first := !first
}

Enter::
Send {Enter}
Send {ScrollLock}
Return

$a::
if(GetKeyState("ScrollLock", "T")) {
Send b
} else {
Send a
}
Return


Now you can see that hotkeys are on when the light is on. You can also spare the numpad9 button for something else couse you can switch the wrong state with the scroll lock button.


damn i should've donne it that way with the scrolllock, never thought of it. thx again ferwiner!
i have one question tho, is it possible to make a hotkey so it opens chat and directly types '/L' to leave? like would it be like -> numpad2::enter send, /l
i have no idea :P


EDIT: i have found a way to do it, but if you have a better way, then tell me. this is my way ->
numpad3::
send {enter 1}
send, /l
send {enter 1}
24 Jun 2018, 15:31 PM
#20
avatar of JibberJabberJobber

Posts: 1614 | Subs: 3

Try this for your mousewheel:

$Wheeldown::
SendInput {LAlt down}
BlockInput MouseMove
SendInput {.}
SendInput {LAlt up}
BlockInput MouseMoveoff
return


Also, instead of rebinding WASD, you could do something like this:

Space & w::Up
Space & a::Left
Space & s:: Down (without space, chat turns it into smiley)
Space & d::Right


This means WASD functions as arrow keys as long as you hold SPACE
1 user is browsing this thread: 1 guest

SHOUT IT OUT!

No ProfanityNumber of ShoutsRefresh Shout Box
Osinyagov: Suddenly, coh2 is slowly dying, but you can play it, playerbase still big enough
09 Apr 2025, 17:00 PM
Osinyagov: Wow, i remember you from zansi and vali videos, good old memories
09 Apr 2025, 16:58 PM
Beinhard: o7 miss this game and zansi
09 Apr 2025, 14:09 PM
Lady Xenarra: @Willy Pete The lack of April Fools this year is odd lol
02 Apr 2025, 01:34 AM
Willy Pete: @Rosbone not dead yet. when that happens the font will switch to Papyrus :*(
02 Apr 2025, 00:16 AM
dasheepeh: it was an honor guys :guyokay:
01 Apr 2025, 20:34 PM
aerafield: yeah I already prepared my "Can't believe there's comic mode for the 10 daily visitors even on this April 1st" :guyokay:
01 Apr 2025, 20:29 PM
Rosbone: @dasheepeh I guess that means this site is officially dead :guyokay:
01 Apr 2025, 20:19 PM
dasheepeh: no comic sans font for april 1st this year?
01 Apr 2025, 19:56 PM
Willy Pete: @Lady Xenarra this you? https://i.imgflip.com/3e4thi.jpg
01 Apr 2025, 02:53 AM
Lady Xenarra: Does anyone else think that USF needs buffs? It feels like they’re on life support sometimes
01 Apr 2025, 02:36 AM
Willy Pete: @Rosbone Ahh I missed that memo. I still think its a bad decision though. Adds frustration for players and isnt gonna make them that much money
27 Mar 2025, 15:46 PM
Rosbone: It is also good they left it free until after the free to play weekend. Points for that.
27 Mar 2025, 09:34 AM
Rosbone: But I agree, the cost to get a full decent Coh game pushing $115 US is not the best idea. Especially when it needs so much more work for casuals.
27 Mar 2025, 09:32 AM
Rosbone: To be fair, it was a thank you to early fans right? They said it was not free for long and it would become a pay DLC at some point.
27 Mar 2025, 09:30 AM
Willy Pete: Re-releasing free DLC so they can charge new players money for it. Brilliant marketing strategy :clap:
27 Mar 2025, 04:31 AM
Soheil: Coh2 still broken server ?
25 Mar 2025, 18:27 PM
Rosbone: Congrats to Relic. Looks like Coh3 has finally usurped Coh2 s the popular Coh. You smell terrific. :snfQuinn:.
24 Mar 2025, 02:46 AM

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

379 users are online: 379 guests
1 post in the last 24h
5 posts in the last week
39 posts in the last month
Registered members: 53793
Welcome our newest member, bk88cash
Most online: 2043 users on 29 Oct 2023, 01:04 AM