Hey, pepes
I am currently playing MX vs ATV: Reflex game (vehicles are motorcycles, UTV's, ATV's and Sport Trucks). In this game, there are keys to "Lean Forward" & "Lean Backward" that are used while airborne. Unfortunately, the "Lean Forward" key on 4-wheeled vehicles is the exact opposite and they want to attempt a back-flip Why the game works this way is a mystery, but may suddenly swap between any given vehicle between different races.
I can run two AKH.exe files and reverse the script of these two particular keys. So, if a race starts and the required vehicle goes from a motorcycle to a UTV, can I map "F1" to exchange between these AHK.exe files?
This would really help, as game gives VERY little time to react and muscle memory creates issues
hot-swap between 2 AHK.exe files Topic is solved
hot-swap between 2 AHK.exe files
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask
Re: hot-swap between 2 AHK.exe files
There's no point in using two AHK scripts, use one AHK script and add a toggle to switch between two mappings using an #if block
Code: Select all
Atv :-= 0
return
F12::Atv := !Atv ; Toggle mappings with F12
#if atv ; ATV mappings
a::b
c::d
#if !atv ; Non-ATV mappings
a::c
c::e
#if
Re: hot-swap between 2 AHK.exe files Topic is solved
EDIT: I just now posted this and evilC contributed during the time it took me to write this and pause to make breakfast
evilC, I thank you... and have also perfectly illustrated an example of what is in the second to last sentence in THIS post below.
I look at your post and my brain is just mush right now You can give me a broken anything and I will figure out how to fix it
or design and manufacture a part to get it working again. Everyone on this site has been very helpful and usually offered more
than one solution to the questions I have posed. It is just that much of it is just over my head.... and I am OK with that
end of edit
---------------------------------------------------------------------------------------------------------------------------------
HAHAAAAAA.... female canines
I figured it out.... look VERY closely at the two following scripts:
THIS one launches, along with game executable, via batch file: Default for Motorcycles & ATV's:
--------------------------------------------------------------------------------
Motorcycle / ATV script:
-------------------------------------------------------------------------------
NOW... when a race with Sport Truck or Buggy is entered, I hit the "2" key.
Since the Motorcycle or ATV script is currently running, it will open the following AHK.exe file and close itself (100% silently in background)
IF... I get confused and ALREADY running this script, pressing "2" key will do nothing at all and this script will continue to run
------------------------------------------------------------------------------
Sport Truck / Buggy script:
------------------------------------------------------------------------------------
NOTE: "Up" key is mapped to "Lean Forward" & "Down" key is mapped to "Lean Backward"
So.... I re-enter a motorcycle / ATV race, I hit the "1" key to open the necessary AHK.exe file and close this one (again....silently in background)
It's set up so only one AHK.exe file will be running at a time (actually, both for 1 second) and can hot-swap between them in the middle of
a race. I realize there must be other ways to do this and that many of you would find a simpler way. But honestly, I am damned-freakin'
proud of myself having figured this out, when the vast majority of AHK code makes my head turn in circles (HS grad and a born mechanic)
This is the last issue I had with this game, first world problems... eh?, and will now go back to playing it.
evilC, I thank you... and have also perfectly illustrated an example of what is in the second to last sentence in THIS post below.
I look at your post and my brain is just mush right now You can give me a broken anything and I will figure out how to fix it
or design and manufacture a part to get it working again. Everyone on this site has been very helpful and usually offered more
than one solution to the questions I have posed. It is just that much of it is just over my head.... and I am OK with that
end of edit
---------------------------------------------------------------------------------------------------------------------------------
HAHAAAAAA.... female canines
I figured it out.... look VERY closely at the two following scripts:
THIS one launches, along with game executable, via batch file: Default for Motorcycles & ATV's:
--------------------------------------------------------------------------------
Motorcycle / ATV script:
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
2::
{
Run, "D:\Games\MX vs ATV\Reflex\Keymapping_MX_vs_ATV_Reflex_B.exe
sleep, 1000
Process, Close, Keymapping_MX_vs_ATV_Reflex_A.exe
sleep, 500
}
return
RButton::down
LButton::
{
send {up down}{LButton down}{LButton up}
keywait, LButton
send {up up}
}
Return
NOW... when a race with Sport Truck or Buggy is entered, I hit the "2" key.
Since the Motorcycle or ATV script is currently running, it will open the following AHK.exe file and close itself (100% silently in background)
IF... I get confused and ALREADY running this script, pressing "2" key will do nothing at all and this script will continue to run
------------------------------------------------------------------------------
Sport Truck / Buggy script:
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
1::
{
Run, "D:\Games\MX vs ATV\Reflex\Keymapping_MX_vs_ATV_Reflex_A.exe
sleep, 1000
Process, Close, Keymapping_MX_vs_ATV_Reflex_B.exe
sleep, 500
}
return
RButton::up
LButton::
{
send {down down}{LButton down}{LButton up}
keywait, LButton
send {down up}
}
Return
NOTE: "Up" key is mapped to "Lean Forward" & "Down" key is mapped to "Lean Backward"
So.... I re-enter a motorcycle / ATV race, I hit the "1" key to open the necessary AHK.exe file and close this one (again....silently in background)
It's set up so only one AHK.exe file will be running at a time (actually, both for 1 second) and can hot-swap between them in the middle of
a race. I realize there must be other ways to do this and that many of you would find a simpler way. But honestly, I am damned-freakin'
proud of myself having figured this out, when the vast majority of AHK code makes my head turn in circles (HS grad and a born mechanic)
This is the last issue I had with this game, first world problems... eh?, and will now go back to playing it.
Last edited by Evil-e on 11 Mar 2019, 10:29, edited 7 times in total.
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask
Re: hot-swap between 2 AHK.exe files
Evil-e + evilC
Code: Select all
MsgBox, % (var := "Evil-e")
MsgBox, % RegExReplace(var, "(....)..", "$L1C")
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: hot-swap between 2 AHK.exe files
OK.... there will be NO "sitting in a tree"
I have a bit of experience opening and sending commands to game console and CMD.exe... just ask
Who is online
Users browsing this forum: No registered users and 83 guests