Script for separate vehicle forward and reverse keys Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Evil-e
Posts: 262
Joined: 04 Sep 2018, 11:09

Script for separate vehicle forward and reverse keys  Topic is solved

11 Mar 2019, 12:08

I have several different scripts to enable two different commands with one key, but unable to adapt them for this purpose

Most driving games use the "Brake" &"Reverse" key as one. This game requires a secondary key for reverse. Since muscle memory is
hard to forget, using a key for reverse OTHER than the brake key, can be frustrating :(

I would like some input on how to modify the following script:
----------------------------------------------------------------------
This is currently what I am using:

Code: Select all

#IfWinActive MX Vs ATV REFLEX ahk_class MX VS ATV
WinWait, MX Vs ATV REFLEX ahk_class MX VS ATV
WinWaitClose, MX Vs ATV REFLEX ahk_class MX VS ATV
ExitApp
return
$F12::ExitApp
return 
e::w
d::s                                          ;this key ONLY stops vehicle
s::a
f::d
a::x                                          ;this key ONLY backs up
Return
----------------------------------------------------------------------
I won't bore you all with variations with keywait or button up scrips I tried. Simply put, the duration of time necessary to brake before
the vehicle comes to a stop always varies. For this reason, sleep commands won't work.

Something like: hold "D" key until the vehicle stops (might be 1 or maybe 7 seconds). Then, maybe... double-tap? and automatically change to
"X" key for reverse to back up. Release "D" hit "E" and accelerate again to win race [slaps own face to wake from dreaming] :shock:
I am looking to avoid using ANY key other than "D" to engage reverse and back up 8-)

Peace, :morebeard:

Edited with the following:
-----------------------------------------------------------------

SOLUTION:

Well.... not 5 minutes after the above post, I came up with an answer. I NEVER see it coming, but swear that a solution to a question,
finds me shortly after I ask it the majority of the time... I have gotten used to it :mrgreen:
-------------------------------------------------------------------------

Code: Select all

#IfWinActive MX Vs ATV REFLEX ahk_class MX VS ATV
WinWait, MX Vs ATV REFLEX ahk_class MX VS ATV
WinWaitClose, MX Vs ATV REFLEX ahk_class MX VS ATV
ExitApp
return
d::                            ;should be obvious, but is "Brake"
{
     send {s down}             ;can hold as short or long as necessary to slow down or stop completely
     sleep, 100
     keywait, d
     send {s up}               ;when "D" is released, so is the brake
     sleep, 100
     send {x down}             ;once brake is release, reverse is automated and vehicle goes backward indefinitely 
     sleep, 100
}
return
e::
{
     send {x up}{w down}       ;hit the forward "E" key and reverse key is released and vehicle goes forward
     keywait, e
     send {w up}
}
return
-----------------------------------------------------------------------

I only need to let go of the brake for vehicle to begin backing up. As I started thinking about it, in ALL of my driving games, this is exactly what my muscle memory already does. The difference is, I would normally just re-press the "D" key to begin backing up. In this case, since the vehicle begins to back up as soon as "D" is released, my natural instinct is to move forward when I have traveled in reverse far enough. No matter what the circumstance, when accelerate or "E" key is used, the script is reset and transition is seemless :thumbup:

I have always deleted threads I resolved prior to any community input (3 or 4 times), but think I am going to leave this one. It is pretty tricky and may come in handy for a future search on this specific issue :cool:

Peace, :morebeard:
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask :)

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: Shoobis and 116 guests