Explore GameReplays...

Company of Heroes Online

GridKeys 3.0

Reply to this topic Start new topic
# 41d4m1ty Feb 1 2011, 18:49 PM
yep, thats the right ratio Vi.. Will work on both the new ratio and those 16:9 bugs.

wtf is an azerty kb?

This post has been edited by d4m: Feb 1 2011, 19:18 PM

Posts: 2,769

Game: Company of Heroes


+
# 42rocqua Feb 1 2011, 20:25 PM
ctrl S doesnt give the tactical map for me.

Posts: 94

Game: Company of Heroes


+
# 43d4m1ty Feb 2 2011, 00:19 AM
It should. Its just is a retrigger for NumPad0. I checked the script to be sure.

Alright, new versions up, fixed placement of command abilities, added 16:10.

Posts: 2,769

Game: Company of Heroes


+
# 44Shrillo Feb 2 2011, 13:54 PM
QUOTE(d4m @ Feb 1 2011, 18:49 PM) *

yep, thats the right ratio Vi.. Will work on both the new ratio and those 16:9 bugs.

wtf is an azerty kb?


lol

almost the same but

some characters are in a different order

Posts: 34

Game: Company of Heroes


+
# 45Goat of Death Feb 2 2011, 18:44 PM
QUOTE(d4m @ Feb 2 2011, 00:19 AM) *

It should. Its just is a retrigger for NumPad0. I checked the script to be sure.

Alright, new versions up, fixed placement of command abilities, added 16:10.


I'm having the same issue where the Ctrl+S does not work. Any chance you could post the source again. I've made some ahk stuff before but nothing this advanced and I'd love to see how it's done. Also it'd be great to be able to tweak a few keys.

Posts: 26

Game: Company of Heroes


+
# 46d4m1ty Feb 2 2011, 19:56 PM
Found the ctrl S issue, was created by fixing shift queuing, had to just reorganize the hotkey order.

Don't want to release the code because Ill be getting 10 different questions on how to change it. As to keychanging, just lemme finish ironing positions and keys not working because I'm already planning on a .ini route where you just pick your grid keys so you can have any setup you want.

Posts: 2,769

Game: Company of Heroes


+
# 47d4m1ty Feb 3 2011, 05:10 AM
Fixed ctrl S issue, added .ini customization.

Posts: 2,769

Game: Company of Heroes


+
# 48Mindlog Feb 3 2011, 19:27 PM
This should work for 5:4 (1280x1024)
X_1 := 0.805
X_2 := 0.858
X_3 := 0.911
X_4 := 0.964
X_5 := 0.805
X_6 := 0.858
X_7 := 0.911
X_8 := 0.964
X_9 := 0.805
X_10 := 0.858
X_11 := 0.911
X_12 := 0.964
X_13 := 0.750
X_14 := 0.750
X_15 := 0.750
X_16 := 0.708
X_17 := 0.381
X_18 := 0.369
X_19 := 0.416
X_20 := 0.463
X_21 := 0.509

Y_1 := 0.823
Y_2 := 0.823
Y_3 := 0.823
Y_4 := 0.823
Y_5 := 0.894
Y_6 := 0.894
Y_7 := 0.894
Y_8 := 0.894
Y_9 := 0.965
Y_10 := 0.965
Y_11 := 0.965
Y_12 := 0.965
Y_13 := 0.860
Y_14 := 0.914
Y_15 := 0.968
Y_16 := 0.833
Y_17 := 0.780
Y_18 := 0.780
Y_19 := 0.780
Y_20 := 0.780
Y_21 := 0.780

I can't test it because my setup is acting up. I normally stick to raw ahk files.
Also, WASD camera does have a modifier (XButton1)tongue.gif Grid keys should work as normal when XButton 1 is not active.

Edit 1: I am a dunce. I am using Company of Heroes and I forgot to edit both Company of Heroes Online references. I can now confirm these values work for 5:4.

This post has been edited by Mindlog: Feb 3 2011, 19:54 PM

Posts: 836

Game: None


+
# 49d4m1ty Feb 3 2011, 19:52 PM
Not everyone has an XButton1. Alt would be the better modifier key since its already tied to camera rotation, but I'll leave that up to the user to decide, ill just make camera movement a key you can set in the .ini.

Later tonight (roughly 6-8 hrs from this edit) I'll post up new version with 5:4 added, button positions added in the ini so you can move click positions if you find something is off and new map scroll keys assigned to alt-W A S D which can be changed as well, id just suggest leaving the modifier key to be alt (!). If you find you don't like the map to rotate/angle at the same time your map scrolling since your holding down alt, remove the ~ infront of the camera movement keys. The ~ allows the key to still be seen by your front program, otherwise the key is blocked when you enter in the hotkey.

This post has been edited by d4m: Feb 3 2011, 20:26 PM

Posts: 2,769

Game: Company of Heroes


+
# 50Goat of Death Feb 3 2011, 22:40 PM
Hi d4m,

Was very excited to see the addition of the ini file. However, when I first tried using it nothing worked. Then I loaded COHO vs. vCOH and it started working. I've been using this as a great solution for GridKeys in both games. Would love to have it support both games or better yet, have a setting in the ini where you can add names of games you want it to support.

This is a great general utility grid key solution. And with your planned additions of x and y coordinates to the ini, I'd love to be able to create inis to make it work with DOW & DOWII as well if it doesn't already. This approach seems like a much cleaner solution to the other methods of getting grid keys working in a lot of these games.

Also, would suggest making Ctrl+S for map and the suspend script key settable by the ini as well.

Thanks for this awesome utility. GridKeys have been a much wanted change for me.

Posts: 26

Game: Company of Heroes


+
# 51Mindlog Feb 3 2011, 23:23 PM
Sounds great! Yeah, it might be a good idea to keep grid keys at some core functionality and then just add other stuff separately to keep it as widely compatible as possible.

About the vCoH and CoH functionality. An 'or' seems like it could be shoehorned into the Winactive check.

I'm going to be futzing with the old CoH gridkeys for a while.

Thanks for all the info d4m.

Posts: 836

Game: None


+
# 52d4m1ty Feb 4 2011, 01:48 AM
I've been learning a ton as I go. Supporting both games ended up being simple. Just tell the script to do a partial match, so any game that has Company Of Heroes in it now will trigger the script. Also, a lot changed now that the program defines hotkeys dynamically, rather than set.

In the end, this is going to be the perfect button click game tool. Not just CoH, my final vision is a tool that you set the mouse to a point, hit a key storage hotkeyu combo and it stores it for you on that hotkey then you can save a .cfg file so you can have different profiles for each game. Every iteration I make of gridkeys is to that end.

The main suspend stuff I believe needs to be set at runtime, but an alternative could be set via ini. Dynamic hotkeys take some spaghetti to get working sometimes from what Ive found.

And with that, posted is the next interation. 5:4 added. x,y settings settable by .ini, camera scroll added to alt-w a s d.

There isn't a ton of error checking, so if you dupe a hotkey, it may act strange.


EDIT: coho is gone... NO... NO!!!! thankfully I set this up to work in coh. If any mod wants to move this to the coh area, pls feel free.

This post has been edited by d4m: Feb 4 2011, 03:14 AM

Posts: 2,769

Game: Company of Heroes


+
# 53DrJason Feb 4 2011, 03:14 AM
Thanks a lot d4m. Really appreciate you gave so much time.
May i ask to for other ahk? like you make them for me as i want to change? if its time consuming then its ok.

Posts: 2,738

Game: Company of Heroes


+
# 54Goat of Death Feb 7 2011, 19:35 PM
d4m,

This is really awesome. Thanks for all the fast turn around updates and providing such a valuable addition to the game. Grid Keys are great. You've made the company of heroes experience much improved.

Thanks again.

Posts: 26

Game: Company of Heroes


+
# 55d4m1ty Feb 10 2011, 17:12 PM
Since no one has complained of any more bugs, Im going to assume its working spot on and since I'm going to be focusing on the next iteration of this mouse grid key to be fully user programmed, here is the code for anyone who wanted to see how I did this script. It is not fully optimized yet with templates, so there is some redundant codes areas which could be better written using a loop, but that for the next program.

CODE

#SingleInstance, force
Gui, Add, DropDownList, x12 y14 w140 h210 Choose1 vResChoice, Select Monitor Ratio|4:3|5:4|16:9|16:10
Gui, Add, Button, x172 y11 w90 h30 , Submit
Gui, Add, Picture, x12 y50 w250 h130 , a.jpg
Gui, Show, x161 y202 h211 w279, GridKeys 3.1
Gui, Add, StatusBar,, State:  OFF

Suspend
Return

GuiClose:
ExitApp

ButtonSubmit:
    Gui,Submit, NoHide

;;global for screen dimensions
    width := 0
    height := 0

;;Mouse pixel position Vars
    oldX := 0
    oldY := 0

    newX := 0
    newY := 0
;;================END GLOBALS===================

;;===============ini load key layout

    Loop, 12
    {
        IniRead, Key%A_Index%, keys.ini, MainGrid, Key%A_Index%
    }
        IniRead, Key13, keys.ini, Upgrades, Key13
        IniRead, Key14, keys.ini, Upgrades, Key14
        IniRead, Key15, keys.ini, Upgrades, Key15
        IniRead, Key16, keys.ini, Reinforce, Key16
        IniRead, Key17, keys.ini, CommanderAbils, Key17
        IniRead, Key18, keys.ini, CommanderAbils, Key18
        IniRead, Key19, keys.ini, CommanderAbils, Key19
        IniRead, Key20, keys.ini, CommanderAbils, Key20
        IniRead, Key21, keys.ini, CommanderAbils, Key21
        
        IniRead, KeyUp, keys.ini, CameraMovement, KeyUp
        IniRead, KeyDown, keys.ini, CameraMovement, KeyDown
        IniRead, KeyLeft, keys.ini, CameraMovement, KeyLeft
        IniRead, KeyRight, keys.ini, CameraMovement, KeyRight
        
    ;msgbox %KeyLeft%
        
    ;;msgbox %KeyUp%
        
;;create callback # for each key to speed up
;;button location later when hotkey is hit
    loop, 21
    {
            key:=Key%A_Index%
            if (SubStr(key, 1, 1) = "^")
            {        
                key:= SubStr(key,0)
                grid_c%key% := A_Index
            }
            else
            {
                grid_%key% := A_Index
            }
    }
        
    ;;msgbox %Key1%

;;==================end ini load

;;MsgBox , "%ResChoice%"
    ;; END BUTTON LOCATIONS

        if (ResChoice = "Select Monitor Ratio")
        {
            Msgbox, "ERROR: You didn't choose a Monitor Ratio."
            return
        }

;;read in keys from keys.ini
    loop, 21
        {
            IniRead, X_%A_Index%, keys.ini, %ResChoice%, X_%A_Index%
            IniRead, Y_%A_Index%, keys.ini, %ResChoice%, Y_%A_Index%
        }
                
    if (X_1="ERROR")
    {
        Msgbox, "ERROR: " %ResChoice% " is not supported at this time or there is a problem with your .ini ."
        return
    }
                
;;Acrtivate the script
    SoundPlay *-1
    Suspend, Off
    SB_SetText(A_IsSuspended>0 ? "State: OFF" : "State: ON")


;;Set up hotkeys
    SetTitleMatchMode 1
    Hotkey, IfWinActive, Company Of Heroes
;;setup camera movement keys
    Hotkey, %KeyUp%, kup
    Hotkey, %KeyDown%, kdown
    Hotkey, %KeyLeft%, kleft
    Hotkey, %KeyRight%, kright
    
    Loop, 5
    {
        index:=A_Index+16
        key:=Key%index%
    ;key:=key
        Hotkey, %key%, PressButton
    }

    loop, 16
    {
        key:=Key%A_Index%
        key:="*" key
        Hotkey, %key%, PressButton
    }
    
return
;;end GUI Submit Button

;;Functions
;;Plays a single beep when the script is activated
;;Plays 2 beeps when deactivated
PlayActivationTone()
{
    if not (A_IsSuspended)
    {
        SoundPlay *-1
    }    
        else
    {
        SoundPlay *-1
        sleep 200
        SoundPlay *-1
    }
}
return


;;label jumps for dynamic hotkey definitions
kleft:
;;Send {left}
    Send {Left Down}
    Loop
    {
        if not GetKeyState(substr(KeyLeft,0), "P")
            break
        sleep 50
    }
    Send {Left Up}
return

kright:
    Send {Right Down}
    Loop
    {
        if not GetKeyState(substr(KeyRight,0), "P")
            break
        sleep 50
    }
    Send {Right Up}
return

kup:
    Send {Up Down}
    Loop
    {
        if not GetKeyState(substr(KeyUp,0), "P")
            break
        sleep 50
    }
    Send {Up Up}
return

kdown:
    Send {Down Down}
    Loop
    {
        if not GetKeyState(substr(KeyDown,0), "P")
            break
        sleep 50
    }
    Send {Down Up}
return

PressButton:
    if GetKeyState("Alt")
    {
        return
    }
    if not GetKeyState("Control")
    {
        key:=Substr(A_ThisHotkey, 0)
        keynum := grid_%key%
    }
    else
    {
        key:=Substr(A_ThisHotkey, 0)
        keynum := grid_c%key%
    }
        
;MsgBox %A_ThisHotKey%  %keynum%
;KeyPressed := SubStr(A_ThisHotkey, 0)
    newX := X_%keynum% * A_ScreenWidth
    newY := Y_%keynum% * A_ScreenHeight

    MouseGetPos, oldX, oldY
    MouseMove, newX, newY, 0
    Send {Lbutton}
    MouseMove, oldX, oldY, 0
return

;;HOTKEY ACTIVATIONS
;activate with ctrl-alt-a
;1 ping = ON
;2 pings = OFF
^!a:: ;ctrl-alt a
Suspend, Toggle
SB_SetText(A_IsSuspended>0 ? "State: OFF" : "State: ON")
PlayActivationTone()
return


;;Hotkey Assignments Activators
#IfWinActive, Company Of Heroes
{
;;for ingame chat
    ~*Enter::
    Suspend, Toggle
    SB_SetText(A_IsSuspended>0 ? "State: OFF" : "State: ON")
    PlayActivationTone()
    return
    
;;Hokey Assignments
    ^s::send {Numpad0}
    
;path paint
    $MButton::
    Send {Shift Down}
    Loop
    {
        if not GetKeyState("MButton", "P")
            break
        Send {Rbutton};
        sleep 50
    }
    Send {Shift Up}
    return
        
}

Posts: 2,769

Game: Company of Heroes


+
# 56Beina Jun 22 2011, 16:02 PM
I love this,

I am looking for a way to edit,

T for retreat is not practical, i like the gridkey lay out but this breaks it,. i need to make retreat what it should be, which is R...

Also i need to make tac map 'CapsLock' Not ctrl-s which is a pain in the ass.

Can you or anyone Help?

Posts: 615

Game: Battlefield 1943


+
# 57Doomdark Jul 4 2011, 05:15 AM
I am also trying to edit the source file posted. I want to redefine two keys. One to reinforce and one for the start of game (as British). I added them in the section Hotkey Assignements but am having a problem.

QUOTE
;;Hokey Assignments
^s::send {Numpad0}

m::send r

j::send {F1}l.


j tells the game to select the HQ truck, build a Lt and select the next (only) infantry unit so I can then click to send it somewhere. It works fine.
The m key has been redefined to reinforce - this was done as a test and a button on my mouse is set to emulate m so I can reinforce with my mouse.

The problem is that pressing m reinforces but then also triggers the j hotkey, selecting the HQ truck and trying to train an Lt

Anyone know why I am getting this run on and how to stop it?

Posts: 548

Game: Company of Heroes


+
# 58johan19 Aug 7 2011, 17:09 PM
Hi,
I know this thread has been "offline" for a while...
but I seriously need some help getting this gridkeys up and running.
My main problem is that I do not know how to install the gridkeys.

Thanks already.

Posts: 31

Game: Company of Heroes


+
# 59clavelle Aug 21 2011, 23:06 PM
I'll try and answer some of the last few questions since I played around with this today. This is just an autohotkey script. So you must download autohotkey. Type it in Google. After that the following will work to add things to it and create your own version if you want to change more than the .ini file is capable of....Like for me I have a 5 button mouse and I can't live without mapping keys to the extra buttons....

You could swap keys for r and t in the .ini file in the following section

[MainGrid]
Key4=t
[Reinforce]
Key16=r

Using his format of an .exe it's hard to map additional keys, like numpad 0 to something other than Ctl-S. I have a 5 button mouse, and map Tac Map to a mouse button, also retreat is another I map. Things I want quickly.

I've attached a .zip with all 3 files needed to make your own version, so you don't have to download the OP's. But all I did was use the OP's and make some changes....
So if you download his zip contains 3 files and extract it somewhere. Then make your own version in a different directory or in my case I did it on my desktop so if I forget to load it...it's quicker to tab out of game and load it. You need to copy 2 of his files out to where you want it to live, a.jpg and keys.ini (MUST be in same directory as your script). Then create your own autohotkey script and save it as a .ahk file. It's easier to edit and at the bottom I'll attach the file I played around with. Open it in Notepad and search on CJL and that is where to add your additional mappings. You'll notice it's his exact same script above just where I added the CJL ADD/END section.

http://www.autohotkey.com/docs/KeyList.htm is a good site to get the format for keys like capsLock and all the possibilities.

I started with the script file he posted above and then added some of my own stuff like the following. Mouse buttons mentioned above and played around with say a US opening and a Wehr opening so that I hit PageUp and it starts the first ENG, selects the other ENG and all I have to do is click on the map where I want to the RAX built.

QUOTE

;; CJL ADD Section to play with
; xtra mouse buttons on 5 button mouse
XButton1::t ; retreat on the mouse
XButton2::Numpad0 ; tactical on the mouse

; Wehr Opening
PgDn::
{
Send {F1} ; -> this selects Main base building
Send {p} ; -> this starts building 1 Pio squad
Send {,} ; -> this selects the idle Pio squad by your base
Send {v} ; -> this selects the build-a-building menu for Pios (!)
Send {w} ; -> this selects Wehrmacht Quarters
}
return

; US Opening
PgUp::
{
Send {F1} ; -> this selects Main base building
Send {e} ; -> this starts building 1 ENG squad
Send {,} ; -> this selects the idle ENG squad by your base
Send {v} ; -> this selects the build-a-building menu for Pios (!)
Send {b} ; -> this selects Barracks
}
return
;; CJL ADD END


If you wanted to replace Ctl S with capslock, just comment out his line and replace with the following:
; Indicates a comment and won't apply
; ^s::send {Numpad0}
; replace to capslock would be
CapsLock::send {Numpad0}

You can search the forums and there have been some serious conversations on some of the things possible with an autohotkey script. But this is a version that uses it to map to gridkeys (which is something done differently as well).

Download the zip, extract the 3 files somewhere. Open the .ahk file in notepad and make your additions where the CJL-ADD section is and obviously feel free to delete my additions.... The OP did all the heavy lifting with figuring out the screen coordinates for all of the different aspect ratios.

This post has been edited by clavelle: Aug 21 2011, 23:14 PM


Attached File(s)
Attached File COH_GK2_CJL.zip
Size: 21.03k
Number of downloads: 118
Player Name Side Team

Posts: 247

Game: Company of Heroes


+
# 60johan19 Nov 3 2011, 17:49 PM
I dont know all those names

CLJ and so on


....

Posts: 31

Game: Company of Heroes


+



 Enable email notification of replies |  Enable Smilies |  Enable Signature

   
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)