JoeViking245 Posted Sunday at 11:55 PM Share Posted Sunday at 11:55 PM 1 hour ago, Muggins said: Hi folks, I launch RPCS3 Lightgun games via AHK scripts so no emulator is selected in Launchbox. I can exit the games using a button on the Lightgun (When offscreen) and pressing escape on the keyboard but would also like them to exit and the script terminate in the same way when pressing Buttons 12 + 1 on my cabinet as do my other games. Currently when I press Buttons 12 + 1 the emulator closes but the script does not complete / terminate, leaving AHK and the Lightgun software running. Would anyone know of a method to get Launchbox to send the escape key using this method please? Can you share what your script(s) looks like? Also, is Button 12+1 what you have mapped in LaunchBox to Exit Game (in Tools - Options - Game Controllers - Mappings)? 1 Quote Link to comment Share on other sites More sharing options...
Muggins Posted Monday at 05:30 AM Share Posted Monday at 05:30 AM 5 hours ago, JoeViking245 said: Can you share what your script(s) looks like? Also, is Button 12+1 what you have mapped in LaunchBox to Exit Game (in Tools - Options - Game Controllers - Mappings)? Hi, yes it says Button 12 + Button 1 in the Exit Game button mapping. This is the script... #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. #SingleInstance Force SetWorkingDir C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun Process, Exist, Lightgun.exe If (!ErrorLevel = 0) { Process,Close,Lightgun.exe sleep, 1000 } Run, C:\Utils\Sinden Lightguns\Mouse Mode - RPCS3\Lightgun.exe Run, C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun_2Player\rpcs3.exe C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun_2Player\games\BCES01070\PS3_GAME\USRDIR\timecrisis4.self --config "C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun_2Player\config\custom_configs\config_BCES01070_tc4_2p.yml" sleep, 1000 Run, C:\Utils\NoMousy\NoMousy.exe /hide ;Hides mouse cursor with NoMousy ;Start Button $MButton:: send {LButton down} sleep, 60 send {MButton down} sleep, 20 send {MButton up} sleep, 60 send {LButton up} Return $Esc:: Process,Close,Lightgun.exe Process,Close,rpcs3.exe Run,taskkill /im "rpcs3.exe" /F Run, C:\Utils\NoMousy\NoMousy.exe ;Restores mouse cursor sleep, 500 ExitApp Return Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted Monday at 12:06 PM Share Posted Monday at 12:06 PM 6 hours ago, Muggins said: Hi, yes it says Button 12 + Button 1 in the Exit Game button mapping. When you press the button combo 12+1, you need to press (and hold) 12 then 1. You can still do it real fast, it just needs to be "done in order". If it's more ergonomic to do 1 then 12, swap Joy1 and Joy12 (keeping "1" in front of the first "joy" as shown). Not tested, but looks really good 'on paper'. #SingleInstance Force SetWorkingDir C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun Process, Exist, Lightgun.exe If (!ErrorLevel = 0) { Process,Close,Lightgun.exe Sleep, 1000 } Run, C:\Utils\Sinden Lightguns\Mouse Mode - RPCS3\Lightgun.exe Run, C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun_2Player\rpcs3.exe C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun_2Player\games\BCES01070\PS3_GAME\USRDIR\timecrisis4.self --config "C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun_2Player\config\custom_configs\config_BCES01070_tc4_2p.yml" Sleep, 1000 Run, C:\Utils\NoMousy\NoMousy.exe /hide ;Hides mouse cursor with NoMousy ;Start Button $MButton:: { send {LButton down} sleep, 60 send {MButton down} sleep, 20 send {MButton up} sleep, 60 send {LButton up} } ;Press Joy12 then Joy1 1Joy1:: { If GetKeyState("Joy12") ExitRoutine() } $Esc::ExitRoutine() ExitRoutine() { Process,Close,Lightgun.exe Process,Close,rpcs3.exe Run,taskkill /im "rpcs3.exe" /F Run, C:\Utils\NoMousy\NoMousy.exe ;Restores mouse cursor Sleep, 500 ExitApp } 1 Quote Link to comment Share on other sites More sharing options...
Muggins Posted Monday at 04:00 PM Share Posted Monday at 04:00 PM 3 hours ago, JoeViking245 said: When you press the button combo 12+1, you need to press (and hold) 12 then 1. You can still do it real fast, it just needs to be "done in order". If it's more ergonomic to do 1 then 12, swap Joy1 and Joy12 (keeping "1" in front of the first "joy" as shown). Not tested, but looks really good 'on paper'. #SingleInstance Force SetWorkingDir C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun Process, Exist, Lightgun.exe If (!ErrorLevel = 0) { Process,Close,Lightgun.exe Sleep, 1000 } Run, C:\Utils\Sinden Lightguns\Mouse Mode - RPCS3\Lightgun.exe Run, C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun_2Player\rpcs3.exe C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun_2Player\games\BCES01070\PS3_GAME\USRDIR\timecrisis4.self --config "C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun_2Player\config\custom_configs\config_BCES01070_tc4_2p.yml" Sleep, 1000 Run, C:\Utils\NoMousy\NoMousy.exe /hide ;Hides mouse cursor with NoMousy ;Start Button $MButton:: { send {LButton down} sleep, 60 send {MButton down} sleep, 20 send {MButton up} sleep, 60 send {LButton up} } ;Press Joy12 then Joy1 1Joy1:: { If GetKeyState("Joy12") ExitRoutine() } $Esc::ExitRoutine() ExitRoutine() { Process,Close,Lightgun.exe Process,Close,rpcs3.exe Run,taskkill /im "rpcs3.exe" /F Run, C:\Utils\NoMousy\NoMousy.exe ;Restores mouse cursor Sleep, 500 ExitApp } Tried that thanks but it doesn't seem to do anything different to the previous one, is there a way to see what is going on with the script? Quote Link to comment Share on other sites More sharing options...
JoeViking245 Posted Monday at 06:04 PM Share Posted Monday at 06:04 PM 1 hour ago, Muggins said: Tried that thanks but it doesn't seem to do anything different to the previous one, is there a way to see what is going on with the script? Because of how AHK reads one button and then the other, LaunchBox's Exit Game might intercept the combo-press 1st. You said the script and the Lightgun software are still running when pressing the [LB] button combo (and I assume the mouse wasn't restored also), but not when shooting offscreen or pressing Escape. I assume the latter are triggering the escape hotkey sequence (and those 2 methods still worked with the 'new' code that uses the ExitRoutine() method). Take 2: Essentially what's happening, if the emulator is closed via the Exit Game button combo, the script (still running) will 'see' that the emulator isn't running [any more] and jump to ExitRoutine(). Hopefully resolving the issue. #SingleInstance Force SetWorkingDir C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun Process, Exist, Lightgun.exe If (!ErrorLevel = 0) { Process,Close,Lightgun.exe Sleep, 1000 } Run, C:\Utils\Sinden Lightguns\Mouse Mode - RPCS3\Lightgun.exe Run, C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun_2Player\rpcs3.exe C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun_2Player\games\BCES01070\PS3_GAME\USRDIR\timecrisis4.self --config "C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun_2Player\config\custom_configs\config_BCES01070_tc4_2p.yml" Sleep, 1000 Run, C:\Utils\NoMousy\NoMousy.exe /hide ;Hides mouse cursor with NoMousy Process, WaitClose, rpcs3.exe ExitRoutine() ;Start Button $MButton:: { send {LButton down} sleep, 60 send {MButton down} sleep, 20 send {MButton up} sleep, 60 send {LButton up} } $Esc::ExitRoutine() ExitRoutine() { Process,Close,Lightgun.exe Process,Close,rpcs3.exe Run,taskkill /im "rpcs3.exe" /F Run, C:\Utils\NoMousy\NoMousy.exe ;Restores mouse cursor Sleep, 500 ExitApp } 1 Quote Link to comment Share on other sites More sharing options...
Muggins Posted Monday at 07:47 PM Share Posted Monday at 07:47 PM 1 hour ago, JoeViking245 said: Because of how AHK reads one button and then the other, LaunchBox's Exit Game might intercept the combo-press 1st. You said the script and the Lightgun software are still running when pressing the [LB] button combo (and I assume the mouse wasn't restored also), but not when shooting offscreen or pressing Escape. I assume the latter are triggering the escape hotkey sequence (and those 2 methods still worked with the 'new' code that uses the ExitRoutine() method). Take 2: Essentially what's happening, if the emulator is closed via the Exit Game button combo, the script (still running) will 'see' that the emulator isn't running [any more] and jump to ExitRoutine(). Hopefully resolving the issue. #SingleInstance Force SetWorkingDir C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun Process, Exist, Lightgun.exe If (!ErrorLevel = 0) { Process,Close,Lightgun.exe Sleep, 1000 } Run, C:\Utils\Sinden Lightguns\Mouse Mode - RPCS3\Lightgun.exe Run, C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun_2Player\rpcs3.exe C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun_2Player\games\BCES01070\PS3_GAME\USRDIR\timecrisis4.self --config "C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun_2Player\config\custom_configs\config_BCES01070_tc4_2p.yml" Sleep, 1000 Run, C:\Utils\NoMousy\NoMousy.exe /hide ;Hides mouse cursor with NoMousy Process, WaitClose, rpcs3.exe ExitRoutine() ;Start Button $MButton:: { send {LButton down} sleep, 60 send {MButton down} sleep, 20 send {MButton up} sleep, 60 send {LButton up} } $Esc::ExitRoutine() ExitRoutine() { Process,Close,Lightgun.exe Process,Close,rpcs3.exe Run,taskkill /im "rpcs3.exe" /F Run, C:\Utils\NoMousy\NoMousy.exe ;Restores mouse cursor Sleep, 500 ExitApp } Tried that thanks, now when I press the front left on my Sinden light gun the whole thing closes as if I had pressed the escape key, that button is mapped as the middle mouse button in the Sinden software. Sorry, I am being a pain! Quote Link to comment Share on other sites More sharing options...
skizzosjt Posted Monday at 08:25 PM Share Posted Monday at 08:25 PM 4 hours ago, Muggins said: is there a way to see what is going on with the script? when any AHK script is running there should be a tray icon visible. double click on it to bring up a window, it will default to showing all the most recent lines executed by the script. it's very useful for troubleshooting. 33 minutes ago, Muggins said: Tried that thanks, now when I press the front left on my Sinden light gun the whole thing closes as if I had pressed the escape key, that button is mapped as the middle mouse button in the Sinden software. Sorry, I am being a pain! Seems the Return got removed so it is triggering the Esc hotkey / ExitRoutine when you execute the MButton hotkey. So change it to this, just adding Return after all of it ;Start Button $MButton:: { send {LButton down} sleep, 60 send {MButton down} sleep, 20 send {MButton up} sleep, 60 send {LButton up} } Return 1 Quote Link to comment Share on other sites More sharing options...
Muggins Posted Monday at 08:54 PM Share Posted Monday at 08:54 PM 25 minutes ago, skizzosjt said: when any AHK script is running there should be a tray icon visible. double click on it to bring up a window, it will default to showing all the most recent lines executed by the script. it's very useful for troubleshooting. Seems the Return got removed so it is triggering the Esc hotkey / ExitRoutine when you execute the MButton hotkey. So change it to this, just adding Return after all of it ;Start Button $MButton:: { send {LButton down} sleep, 60 send {MButton down} sleep, 20 send {MButton up} sleep, 60 send {LButton up} } Return That now works great thank you both! I can exit and close the script using either the Button 12 + 1 combo or offscreen right on the dpad. Here is the working script just in case it helps anyone else... #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. #SingleInstance Force SetWorkingDir C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun Process, Exist, Lightgun.exe If (!ErrorLevel = 0) { Process,Close,Lightgun.exe sleep, 1000 } Run, C:\Utils\Sinden Lightguns\Mouse Mode - RPCS3\Lightgun.exe Run, C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun\rpcs3.exe C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun\games\BCES01070\PS3_GAME\USRDIR\razingstorm.self --config "C:\Utils\LaunchBox\Emulators\RPCS3_Lightgun\config\custom_configs\config_BCES01070_tcrs.yml", ,Hide sleep, 1000 Run, C:\Utils\NoMousy\NoMousy.exe /hide ;Hides mouse cursor with NoMousy Process, WaitClose, rpcs3.exe ExitRoutine() ;Start Button $MButton:: { send {LButton down} sleep, 60 send {MButton down} sleep, 20 send {MButton up} sleep, 60 send {LButton up} } Return $Esc::ExitRoutine() ExitRoutine() { Process,Close,Lightgun.exe Process,Close,rpcs3.exe Run,taskkill /im "rpcs3.exe" /F Run, C:\Utils\NoMousy\NoMousy.exe ;Restores mouse cursor Sleep, 500 ExitApp } 1 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.