I would like to use AHK to ensure that Star Citizen remains connected even while other windows are active and receiving focus.
Here is an example walkthrough of the manual steps that happen:
1. Start the RSI Launcher application
2. In that window, select Launch Game then Acknowledge
3. Then the main menu of Star Citizen launches
4. Select Persistent Universe then Enter Star Citizen Universe
5. Wait for the loading screen, then the character wakes up
It would be great to have a script to take care of 1.-4., although right now the main interest is in avoiding being idle from causing disconnects after the character wakes up in the verse. The main focus here is after step 5. in the above process.
As I understand it, anything can be done from within the verse with the character to ensure that it does not go idle. It could simply open the mobiglas (a wristwatch type device), wait a couple minutes, close it, wait a couple minutes, open it again, and loop it. Both open and close for that mobiglas device are done with the F1 key. The character could also jump in place (space bar) or walk around (wasd keys), basically anything will probably be okay.
How would I make my character remain active while the Star Citizen window is in the background and I am actively using other windows?
I looked up some possibilities and found mentions of options like something called "DetectHiddenWindows, On", "WinGet", "WinWait", using "Loop" options, however they were from several years ago. I also found this, from a fear years ago in this forum, but it uses a web browser instead:
Code: Select all
DetectHiddenWindows, On
SetTitleMatchMode, 2
WinGetClass, WinClass, Mozilla Firefox
loop {
SetTimer, GetFocus, 200 ; Makes the browser gain focus every 200 ms
}
return
GetFocus:
ControlFocus,, Mozilla Firefox
Return
F3::
loop 5
{
Controlsend,, {Down down}, ahk_class %WinClass%
Sleep 200
Controlsend,, {Down up}, ahk_class %WinClass%
}
Code: Select all
DetectHiddenWindows, On
SetTitleMatchMode, 2
WinGetClass, WinClass, Star Citizen
loop {
SetTimer, GetFocus, 300000 ; Makes Star Citizen gain focus every 5 minutes
}
return
GetFocus:
ControlFocus,, Star Citizen
Return
F1::
loop 1
{
Controlsend,, {F1 down}, ahk_class %WinClass%
Sleep 100
Controlsend,, {F1 up}, ahk_class %WinClass%
}
It looks like the example above might put Star Citizen in the foreground, but the intention is for it to remain in the background, without interrupting tasks in other windows.
The tinkering around with the above example is probably messing it all up.
Are there any example scripts and specific sections of documentation that would help achieve this?