Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Autohotkey script for WASD controls

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> The Operational Art of War IV >> Autohotkey script for WASD controls Page: [1]
Login
Message << Older Topic   Newer Topic >>
Autohotkey script for WASD controls - 11/17/2017 5:55:31 PM   
Shadrach


Posts: 546
Joined: 10/16/2001
From: Oslo, Norway
Status: offline
Hey,
so I've been digging into using Autohotkey to override the game's keys for WASD controls. Shouldn't be a big deal right, except I'm new to AHK and the language is to say the least, obtuse. Plenty documentation but not always easily understandable and *VERY* techy even for me.

EDIT: This is what I've got working at the moment, file attached. In case anyone searching finds this thread.

Pastebin: https://pastebin.com/dKREVpZA



Attachment (1)

< Message edited by Shadrach -- 1/10/2018 6:29:47 PM >
Post #: 1
RE: Autohotkey script for WASD controls (need help) - 11/17/2017 6:33:26 PM   
Redmarkus5


Posts: 4360
Joined: 12/1/2007
From: 0.00
Status: offline
Can we get a Hotkey for Repair Rail please? I'm not seeing it on the list I have.

(in reply to Shadrach)
Post #: 2
RE: Autohotkey script for WASD controls (need help) - 11/17/2017 6:43:55 PM   
BigDuke66


Posts: 1917
Joined: 2/1/2001
From: Terra
Status: offline
Not helpful at all but I advise to join the board of autohotkey:
https://autohotkey.com/boards/
There is enough traffic and almost 20k members so I'm sure they can help you.

Personally I use the software only for HPS/JTS games and there I use single key stroke only, what you try here is to hold the key to continue the map movement and that surely needs some fine tuning so it runs smooth.
Sorry again for not being helpful.

_____________________________


(in reply to Shadrach)
Post #: 3
RE: Autohotkey script for WASD controls (need help) - 11/17/2017 7:18:07 PM   
Shadrach


Posts: 546
Joined: 10/16/2001
From: Oslo, Norway
Status: offline
Ok thanks Duke, I might as well do that - there are plenty of WASD scripts I found with a bit of Google but it appears TOAW has something about it making things difficult.

@redmarkus4 - you can't override a hotkey unless a key binding already exists in the game. You *might* be able to do it, AHK can automate almost everything, moving the mouse, right-clicking etc, but that's waaay beyond my skills with this at the moment.

(in reply to BigDuke66)
Post #: 4
RE: Autohotkey script for WASD controls (need help) - 11/18/2017 6:03:04 AM   
76mm


Posts: 3742
Joined: 5/2/2004
From: Washington, DC
Status: offline
I've used AutoHotKey a lot for JTS games and like it a lot. I don't have TOAW IV yet, so am not sure that I understand what you are trying to do...it sounds like the WASD keys are already assigned? If so, I was not aware that you can override them, I've never done that.

I've successfully assigned hotkeys to the arrow keys using this format:
Down::Send !ct{Enter} ; Down Arrow - Bottom of Stack

(in reply to Shadrach)
Post #: 5
RE: Autohotkey script for WASD controls (need help) - 11/18/2017 9:29:37 AM   
Shadrach


Posts: 546
Joined: 10/16/2001
From: Oslo, Norway
Status: offline
Hey 76,
I'm a total newb to AHK but I think you're supposed to be able to override keys, otherwise there would be little point to it right?

When looking at some examples I found I saw the same syntax you use, but according to the official tutorial, there needs to be at least a comma after the Send, but maybe it's not strictly required?
https://autohotkey.com/docs/Tutorial.htm#s12
https://autohotkey.com/docs/commands/Send.htm

And I think there should be a Return after each command block, at least for when there are several lines? Basically like a function.

But it works like above now, and I think probably only the devs can answer if TOAW has some special code for keyboard input.

Or if someone's experienced it before that simply using "Send, key" doesn't work for AHK to emulate a held down key? I mean, it worked in other applications before I added the IfWinActive directive, holding down A would send 'aaaaaaaaaaaaaaaaaaa'.



(in reply to 76mm)
Post #: 6
RE: Autohotkey script for WASD controls (need help) - 11/18/2017 10:43:11 AM   
76mm


Posts: 3742
Joined: 5/2/2004
From: Washington, DC
Status: offline
quote:

ORIGINAL: Shadrach
I'm a total newb to AHK but I think you're supposed to be able to override keys, otherwise there would be little point to it right?

Not really--the main point to AHK as far as I am concerned is to add hotkeys, not replace existing ones. You might be able to replace hotkeys, but I have never done it.

The arrow key line I posted works with a JTS game (without any comma), but I should point out that it "sends" a menu command rather than a movement order, so you will need to tweak it somehow.

(in reply to Shadrach)
Post #: 7
RE: Autohotkey script for WASD controls (need help) - 11/18/2017 3:37:58 PM   
Shadrach


Posts: 546
Joined: 10/16/2001
From: Oslo, Norway
Status: offline
So apparently, there is a built-in shortcut for remapping keys, which does a lot of the magic behind-the-scenes. So that explains why the examples I've found uses a shorter syntax.
https://autohotkey.com/docs/misc/Remap.htm

Problem with the remap method is that I also had to map Shift+W, Ctrl+A, Ctrl+D to make the replacement commands work.
But fair enough, the code is at least cleaner and you have more control I guess.

AutoHotkey script for WASD override in TOAW4 below.
Remapped keys in addition (also had to replace Shift+A for some reason):
Shift+W: Weather overlay
Ctrl+A: Air Unit Report
Shift+A: Air Briefing
Shift+D: Dig In

#IfWinActive The Operational Art of War

w::Up
a::Left
s::Down
d::Right
+w::w
^a::a
+a::+a
+d::d

#IfWinActive

(in reply to 76mm)
Post #: 8
RE: Autohotkey script for WASD controls (need help) - 11/18/2017 4:52:08 PM   
76mm


Posts: 3742
Joined: 5/2/2004
From: Washington, DC
Status: offline
Interesting, thanks for this, will take a look when/if I buy the game!

(in reply to Shadrach)
Post #: 9
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> The Operational Art of War IV >> Autohotkey script for WASD controls Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.127