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: 221

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: 221

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: 221



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

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

245 users are online: 1 member and 244 guests
M3g4s34n
2 posts in the last 24h
12 posts in the last week
37 posts in the last month
Registered members: 50185
Welcome our newest member, Deski780
Most online: 2043 users on 29 Oct 2023, 01:04 AM