Prevent Star Citizen from disconnecting while idle Topic is solved
- DuckingQuack
- Posts: 219
- Joined: 20 Jan 2023, 18:20
Re: Prevent Star Citizen from disconnecting while idle
v2 uses #HotIf WinActive(MyWindowTitle)
Edit: Sorry, but I just noticed the "merged" script you posted uses both v1 and v2 syntax which is not allowed. I'm guessing you're converting the whole thing to v2 now?
Edit: Sorry, but I just noticed the "merged" script you posted uses both v1 and v2 syntax which is not allowed. I'm guessing you're converting the whole thing to v2 now?
Best of Luck,
The Duck
The Duck
Re: Prevent Star Citizen from disconnecting while idle
Yeah I'd like to be uniform with all of it, might as well go v2 for everything. Hopefully the rest of the alt-w and alt-f sections work, I'm going to update the WinActive lines to what you mentioned. Thanks!
Edit-
Okay I tried using:
that is working. I checked the docs and the syntax looks different but if it isn't broken like the line above, nothing to fix.
The program did have an error with this:
Error message:
Edit-
Okay I tried using:
Code: Select all
#HotIf WinActive(Star Citizen)
The program did have an error with this:
Code: Select all
Text: Loop, { Send, {w down} sleep 100 { keywait, w break } }
Going to check the docs see what might be different.Error: Function calls require a space or "(". Use comma only between parameters.
Re: Prevent Star Citizen from disconnecting while idle
Looking at this other script, curious why the WinMove is used. I don't know if Star Citizen is capable of being moved, it's using the fullscreen windowed mode, which is like a window but not a normal one, it's still full screen. However, I can minimize it.off wrote: ↑27 Feb 2023, 21:05Code: Select all
game=Star Citizen ; change this if not same as the window title Shift & ~`:: ; use Shift + ` to toggle script on and off (remove if you want this script auto run) toggle:=!toggle If (toggle) { SetTimer, AntiKick, 60000 ; 1 minute, set to 600000 for 10 minutes } Else { SetTimer, AntiKick, Off WinActivate, %game% WinSet, Enable,, %game% WinMove, %game%,, 0, 0 ; moving the game back to x0 y0 pos from x1000 and y1000 WinSet, Bottom,, %game% WinMinimize, %game% } return AntiKick: BlockInput, On WinActivate, %game% WinMove, %game%,, 1000, 1000 ; this move the window to x1000 and y1000, make no flickering window from maximize and minimizing the game WinSet, Disable,, %game% ; disabling input from mouse to the game WinSet, Bottom,, %game% ; activating the game in the most bottom from window stack Send, {F1 2} ; send F1 twice as it open and close immediatly. WinMinimize, %game% WinSet, Enable,, %game% ; enabling back mouse input BlockInput, Off return ^\::ExitApp ; terminate script with Ctrl + \
Re: Prevent Star Citizen from disconnecting while idle
I use WinMove to move the window far from screen, so when the window activated, it will not appear on the screen (incase you doing something else, but not wanted your screen showing a window maximized and minimized)
My Creations
IMG2HotString - Send image file easily with your hotstring!
CtrlSend - A small solution for sending keys to window in background that doesn't accept ControlSend's key
ControlProcess
IMG2HotString - Send image file easily with your hotstring!
CtrlSend - A small solution for sending keys to window in background that doesn't accept ControlSend's key
- DuckingQuack
- Posts: 219
- Joined: 20 Jan 2023, 18:20
Re: Prevent Star Citizen from disconnecting while idle
This is the example directly from the v2 page: https://www.autohotkey.com/docs/v2/lib/_HotIf.htm#howto
#HotIf WinActive("ahk_class Notepad") or WinActive(MyWindowTitle)
It gives two examples at the same time which is probably confusing. All I did was remove the bits of the first one and leave just the second one in my earlier post.
As far as this little piece that you provided: Text: Loop, { Send, {w down} sleep 100 { keywait, w break } }
The error message simply states that the comma (,) after Loop and Send and KeyWait are incorrect and that you should use parentheses ( ). But I'm not wholly confident that line of commands would work with just those edits. I would format it more along the lines of the following, but if you have another way, go for it.
I hope this was helpful.
#HotIf WinActive("ahk_class Notepad") or WinActive(MyWindowTitle)
It gives two examples at the same time which is probably confusing. All I did was remove the bits of the first one and leave just the second one in my earlier post.
As far as this little piece that you provided: Text: Loop, { Send, {w down} sleep 100 { keywait, w break } }
The error message simply states that the comma (,) after Loop and Send and KeyWait are incorrect and that you should use parentheses ( ). But I'm not wholly confident that line of commands would work with just those edits. I would format it more along the lines of the following, but if you have another way, go for it.
Code: Select all
Loop {
Send("{w down}")
Sleep 100
KeyWait "w"
Break
}
Best of Luck,
The Duck
The Duck
Re: Prevent Star Citizen from disconnecting while idle
That is a great idea, thank you! I didn't initially understand the advantage in that, I appreciate the explanation. After I try making the updates to the other version of the script, I'd like to revisit this and look in to adding the WinMove feature to it. As long as we are unable to use ControlSend or some way of keeping Star Citizen minimized, if we can temporarily move it off screen so it does not disrupt our activities in other windows, that would be wonderful.
Interesting about the syntax - in both cases, with the WinActive and the comma/parentheses usages - thank you again for the clarification. I'm excited to see the progress with this, looking forward to getting it into a working state. I'm going to give that update a try, then I'd like to revisit the idea of WinMove described above.DuckingQuack wrote: ↑28 Feb 2023, 21:37The error message simply states that the comma (,) after Loop and Send and KeyWait are incorrect and that you should use parentheses ( ). But I'm not wholly confident that line of commands would work with just those edits. I would format it more along the lines of the following, but if you have another way, go for it.
I do hope still, however, that there might be some way to keep Star Citizen minimized, but I'd first like to get the script working with the restore/minimize approach. Maybe that ControlSend usage with a key down and up will work, but if it's a matter of ControlSend not working at all with Star Citizen then that would be a total bummer.
Actually, I recently found out that I don't even have to press the F1 key to make Star Citizen stop being idle. All it takes is clicking the mouse button on the screen, although I don't know if it's possible to actually mimic mouse movement and clicking within that. Either way, it is okay to just press the F1 key, or even the F10 key, that is currently set in my Star Citizen key binds to toggle the chat on and off, which should still register as activity if otherwise all it needs is a mouse click.
Re: Prevent Star Citizen from disconnecting while idle
Here's an update, I had to make adjustments based on multiple error messages that popped up specifying lines and issues with some of them, mainly some different ones than the ones we most recently covered.
Here's the current draft, it didn't return any errors, and the last part of it I had to change, attempting the ControlSend with keypress down and up:
I'm about to test it out, if the ControlSend still doesn't work, then I'm going to revisit some other options.
Here's the current draft, it didn't return any errors, and the last part of it I had to change, attempting the ControlSend with keypress down and up:
Code: Select all
#Requires AutoHotkey v2.0
; Star Citizen script to simplify some tasks (this is just a messy draft, a work in progress)
; Includes: auto-walk, auto-hold interaction, no idle
; Auto-Walk, use alt w to start, w to stop
#HotIf WinActive("Star Citizen")
#SingleInstance Force
!w:: {
Loop {
Send("{w down}")
Sleep 100
KeyWait "w"
Break
}
}
; Auto-Hold Interact, use alt f to start, f to stop:
!f:: {
Loop {
Send("{f down}")
Sleep 100
KeyWait "f"
Break
}
}
; No Idle, for use while in other windows, use alt ` to start and stop:
!`:: {
Static on := False
SetTimer(Fn1, 900000 * on := !on)
}
Fn1() {
ControlSend "{F1 down}",, "Star Citizen"
Sleep 100
ControlSend "{F1 up}",, "Star Citizen"
}
- DuckingQuack
- Posts: 219
- Joined: 20 Jan 2023, 18:20
Re: Prevent Star Citizen from disconnecting while idle
I think the winmove idea is going to be your winning strategy. It will require windowed mode (not borderless window). If it puts the window where it’s off screen, then, as Off stated, you will not have a flicker of the window popping up and minimizing. If you’re interested in using the mouse click idea, then a simple click command will be the ticket.
ControlSend won’t start sending info to a game because you sent a form and then up, the reason it won’t work is because it sends info to the game that the game either intentionally ignores because it’s minimized, or it sends it through an API method that the game doesn’t use.
On the new draft you posted, without a blank #HotIf before your anti-afk timer, this won’t run at all unless the window is active because of the #HotIf WinActive at the top. The blank one cancels out previous ones.
ControlSend won’t start sending info to a game because you sent a form and then up, the reason it won’t work is because it sends info to the game that the game either intentionally ignores because it’s minimized, or it sends it through an API method that the game doesn’t use.
On the new draft you posted, without a blank #HotIf before your anti-afk timer, this won’t run at all unless the window is active because of the #HotIf WinActive at the top. The blank one cancels out previous ones.
Best of Luck,
The Duck
The Duck
Re: Prevent Star Citizen from disconnecting while idle
Good news and bad news. Bad news first, the "no idle" part of the script (at the bottom), from the recent draft, doesn't work, so you guessed that one right. Good news is that the earlier parts of the scripts, auto-walk and the hold-interaction mode things, they are working great with the v2 update.
It would be better to be in the borderless windowed or full screen modes with Star Citizen, although if necessary I could temporarily change to windowed mode when I know I'll be focusing on other tasks alt-tabbed out for more than 15 minutes, and can always change it back afterward. I wonder if I could make AHK change Star Citizen between those modes, that may be too much work, it's a setting that requires an escape-key menu and clicking on settings with the mouse. Speaking of which, it would be cool to set up Star Citizen with AHK to do everything from the start, launch from menu into it, but that can wait for later.
It really is a bummer that ControlSend won't work with Star Citizen, unless I'm still missing some fine detail about how it works (other than my previous misuse of the key press down and up combined with it). Oh wait, you mentioned the #HotIf, oops yeah I forgot that I removed that, I'll add it back in and give it another try. Nevermind, it won't work anyway.
The winmove idea is going to be next on my to do for this, avoid the flickering screen. I can go ahead and change the F1 key press approach to just a mouse click if that's simple enough.
(quick edit, fixed typo)
It would be better to be in the borderless windowed or full screen modes with Star Citizen, although if necessary I could temporarily change to windowed mode when I know I'll be focusing on other tasks alt-tabbed out for more than 15 minutes, and can always change it back afterward. I wonder if I could make AHK change Star Citizen between those modes, that may be too much work, it's a setting that requires an escape-key menu and clicking on settings with the mouse. Speaking of which, it would be cool to set up Star Citizen with AHK to do everything from the start, launch from menu into it, but that can wait for later.
It really is a bummer that ControlSend won't work with Star Citizen, unless I'm still missing some fine detail about how it works (other than my previous misuse of the key press down and up combined with it). Oh wait, you mentioned the #HotIf, oops yeah I forgot that I removed that, I'll add it back in and give it another try. Nevermind, it won't work anyway.
The winmove idea is going to be next on my to do for this, avoid the flickering screen. I can go ahead and change the F1 key press approach to just a mouse click if that's simple enough.
(quick edit, fixed typo)
Last edited by xvz on 02 Mar 2023, 21:40, edited 2 times in total.
Re: Prevent Star Citizen from disconnecting while idle
Hello again @xvz
glad you understand my bad english explanation for the WinMove XD
here ill give a little explanation why ControlSend not accepted by some applications:
1. Not like other games, Roblox, Minecraft, or even this Star Citizen game will freeze all the game state if you tabbed out from it, or just freezing all keyboard and mouse input while tabbed out.
2. They made game work like that to remove "unfair advantage" from automating things without you interacting with. For minecraft for example, while in minimized or even tabbed out state, the game it self still running (if multiplayer), but it will not receive any action from keyboard and mouse, until the game maximized or active again. Though some mods developer found how to create mod that bypass the system, which is not all people can make the mod.
3. Some application using this method to improving CPU performance while you not using it.
i hope you understand my english, see you! (oh about borderless window and fullscreen, the game should have keybind for it, idk, i dont play it, perhaps F11? some games use it.)
glad you understand my bad english explanation for the WinMove XD
here ill give a little explanation why ControlSend not accepted by some applications:
1. Not like other games, Roblox, Minecraft, or even this Star Citizen game will freeze all the game state if you tabbed out from it, or just freezing all keyboard and mouse input while tabbed out.
2. They made game work like that to remove "unfair advantage" from automating things without you interacting with. For minecraft for example, while in minimized or even tabbed out state, the game it self still running (if multiplayer), but it will not receive any action from keyboard and mouse, until the game maximized or active again. Though some mods developer found how to create mod that bypass the system, which is not all people can make the mod.
3. Some application using this method to improving CPU performance while you not using it.
i hope you understand my english, see you! (oh about borderless window and fullscreen, the game should have keybind for it, idk, i dont play it, perhaps F11? some games use it.)
My Creations
IMG2HotString - Send image file easily with your hotstring!
CtrlSend - A small solution for sending keys to window in background that doesn't accept ControlSend's key
ControlProcess
IMG2HotString - Send image file easily with your hotstring!
CtrlSend - A small solution for sending keys to window in background that doesn't accept ControlSend's key
Re: Prevent Star Citizen from disconnecting while idle
Thank you for those explanations.
Okay I attempted to make revisions to the script, and I used a combination of the ideas shared from both of you, @DuckingQuack and @off. There is a pretty good chance that I made mistakes with this draft. I loaded the script multiple times, each time I received errors, and I did not even have to test it to find out there were errors, so I made changes one error at a time. After making changes, I received no more errors from the program, but I don't know if this is going to work. Before I test this, I am hoping to find out if anything may still be incorrect.
Here is the updated draft:
Okay I attempted to make revisions to the script, and I used a combination of the ideas shared from both of you, @DuckingQuack and @off. There is a pretty good chance that I made mistakes with this draft. I loaded the script multiple times, each time I received errors, and I did not even have to test it to find out there were errors, so I made changes one error at a time. After making changes, I received no more errors from the program, but I don't know if this is going to work. Before I test this, I am hoping to find out if anything may still be incorrect.
Here is the updated draft:
Code: Select all
; Star Citizen AHK for XVZ (work in progress)
; Features in this script:
; Auto-Walk - make the character walk without having to hold the key down
; Auto-Hold Interact - enable interaction mode without having to hold the key down
; No Idle - prevent Star Citizen from idle disconnects, allowing activities in other windows
#Requires AutoHotkey v2.0
#SingleInstance Force
; Auto-Walk
; Press alt w to start, w to stop
#HotIf WinActive("Star Citizen")
!w:: {
Loop {
Send("{w down}")
Sleep 100
KeyWait "w"
Break
}
}
; Auto-Hold Interact
; Press alt f to start, f to stop
#HotIf WinActive("Star Citizen")
!f:: {
Loop {
Send("{f down}")
Sleep 100
KeyWait "f"
Break
}
}
; No Idle
; Press alt ` to start and stop
!`:: {
toggle := !toggle
If (toggle)
{
SetTimer(Fn1, 15000 * on := !on) ; 15 seconds for testing, set to 900000 (15 minutes) when script is ready
}
Else
{
WinActivate("Star Citizen")
WinMove 0, 0
WinMinimize("Star Citizen")
}
}
Fn1() {
WinActivate("Star Citizen")
WinMove 1000, 1000
Send "{F1 2}"
WinMinimize("Star Citizen")
}
- DuckingQuack
- Posts: 219
- Joined: 20 Jan 2023, 18:20
Re: Prevent Star Citizen from disconnecting while idle
I’ve mentioned this a couple times but I guess I wasn’t making sense. With your hotif at the top, you do not need a second hotif specifying the same thing twice. It’s like hitting an ON button twice… it’s already on. But you do need to turn it off.
You need the hotif above this section if you don’t want it affected by the previous hotif… alternatively: make the anti-idle section the first section and place a single hotif winactive under it so the rest of the script is active only when the window is active and there is no need to turn off the hotif… will save you some lines of code and simplify things a bit.
Code: Select all
; Press alt ` to start and stop
#HotIf
!`:: {
toggle := !toggle
If (toggle)
https://www.autohotkey.com/docs/v2/lib/_HotIf.htm#howto wrote:
The #HotIf directive is positional: it affects all hotkeys and hotstrings physically beneath it in the script, until the next #HotIf directive.
Note: Unlike if statements, braces have no effect with the #HotIf directive.
To turn off context sensitivity, specify #HotIf without any expression. For example:
#HotIf
Best of Luck,
The Duck
The Duck
- DuckingQuack
- Posts: 219
- Joined: 20 Jan 2023, 18:20
Re: Prevent Star Citizen from disconnecting while idle
This toggle will not function as intended for multiple reasons. The most obvious you will find when you press !`, and you will get an error: unset variables. You’re using Toggle and On and they are not equivalent.
Also, you could explore using A_ScreenWidth and A_ScreenHeight in your winmove instead of 1000.
WinMove A_ScreenWidth, A_ScreenHeight
I typed all this on my phone, so be sure to test and verify everything is correct.
I suggest setting up the toggle like this:xvz wrote: ↑02 Mar 2023, 22:32Code: Select all
; No Idle ; Press alt ` to start and stop !`:: { toggle := !toggle If (toggle) { SetTimer(Fn1, 15000 * on := !on) ; 15 seconds for testing, set to 900000 (15 minutes) when script is ready } Else { WinActivate("Star Citizen") WinMove 0, 0 WinMinimize("Star Citizen") } }
Code: Select all
!`:: {
Static on := false
if on := !on {
SetTimer(Fn1, 15000)
} Else {
SetTimer(Fn1, 0)
WinActivate("Star Citizen") ; I’m not sure why you’re interacting with the window here.
WinMove 0, 0
WinMinimize("Star Citizen")
}
}
WinMove A_ScreenWidth, A_ScreenHeight
I typed all this on my phone, so be sure to test and verify everything is correct.
Best of Luck,
The Duck
The Duck
Re: Prevent Star Citizen from disconnecting while idle
Okay the hotif makes sense, my bad for misunderstanding. I think I understand this now, so use it once for the same type of commands, and there's no need to use it again until there's a different type of commands. I like the idea of putting the anti-idle part first, going to give that a try. I'll probably butcher the script again but hopefully it's getting closer.
I didn't fully understand the need for the use of:
I believe it may have been in a previous example in this thread. My guess was that the window may need to be activated again before the automatic F1 key press was sent, although I could also be getting the flow backwards.
The spacing is interesting, I've seen different numbers of spaces (not tabs) for lines, I generally default to 2 or 4, haven't seen 3 spaces or multiples of 3 used before, or 5 spaces, but then again it appears the spacing doesn't matter for these scripts. The same idea with the use of an open brace at the end of a line or by itself on the next line for a section. I'm guessing that if someone wanted they could probably put an entire script in 1 long line. I am new to all of this though so could be mistaken.
Regarding the mouse click possibility, to prevent idle disconnects, I looked at the docs for that, then wondered if it would be viable to use it if the window has to be covering the monitor display at the time of the mouse click, which would defeat the purpose in putting the window off screen or so far into a corner that it wouldn't cause a screen flicker. However, the next guess is that if the window can be quickly restored off screen, then maybe the mouse could be told to have the mouse pointer off screen also to then click, before the window is minimized again.
The WinMove A_ScreenWidth, A_ScreenHeight is interesting! I'll check out the docs on that.
Just for the fun of it, I went ahead and made a quick revision to the script draft, here it is:
Hopefully I didn't butcher that too bad. I'm going to explore that other WinMove option.
I didn't fully understand the need for the use of:
Code: Select all
WinActivate("Star Citizen")
The spacing is interesting, I've seen different numbers of spaces (not tabs) for lines, I generally default to 2 or 4, haven't seen 3 spaces or multiples of 3 used before, or 5 spaces, but then again it appears the spacing doesn't matter for these scripts. The same idea with the use of an open brace at the end of a line or by itself on the next line for a section. I'm guessing that if someone wanted they could probably put an entire script in 1 long line. I am new to all of this though so could be mistaken.
Regarding the mouse click possibility, to prevent idle disconnects, I looked at the docs for that, then wondered if it would be viable to use it if the window has to be covering the monitor display at the time of the mouse click, which would defeat the purpose in putting the window off screen or so far into a corner that it wouldn't cause a screen flicker. However, the next guess is that if the window can be quickly restored off screen, then maybe the mouse could be told to have the mouse pointer off screen also to then click, before the window is minimized again.
The WinMove A_ScreenWidth, A_ScreenHeight is interesting! I'll check out the docs on that.
Just for the fun of it, I went ahead and made a quick revision to the script draft, here it is:
Code: Select all
; Star Citizen AHK for XVZ (work in progress)
; Features in this script:
; Stay Online - prevent Star Citizen idle disconnects
; Auto-Walk - make the character walk without having to hold the key down
; Auto-Hold Interact - enable interaction mode without having to hold the key down
#Requires AutoHotkey v2.0
#SingleInstance Force
; Stay Online
; Press alt ` to start and stop
!`:: {
Static on := false
if on := !on {
SetTimer(Fn1, 15000) ; 15 seconds for testing, set to 900000 (15 minutes) when script is ready
} Else {
SetTimer(Fn1, 0)
WinMove 0, 0
WinMinimize("Star Citizen")
}
}
Fn1() {
WinActivate("Star Citizen")
WinMove 1000, 1000
Send "{F1 2}"
WinMinimize("Star Citizen")
}
; Auto-Walk
; Press alt w to start, w to stop
#HotIf WinActive("Star Citizen")
!w:: {
Loop {
Send("{w down}")
Sleep 100
KeyWait "w"
Break
}
}
; Auto-Hold Interact
; Press alt f to start, f to stop
!f:: {
Loop {
Send("{f down}")
Sleep 100
KeyWait "f"
Break
}
}
- DuckingQuack
- Posts: 219
- Joined: 20 Jan 2023, 18:20
Re: Prevent Star Citizen from disconnecting while idle
Unfortunately, nothing in your script would work as it was when I tested it.
I did some debugging of your idle section since we have chatted about it enough for me to know what to do with it despite not having access to the game.
I do not know enough about your auto-walk and auto-hold interact sections to properly debug them if they aren't working. Since I can't use them in-game, they could be working just fine. So I'm posting the whole script with the debugged idle section and unmodified auto-sections. If you don't want the audible warning, then delete it, I mostly had it in there for testing purposes. If you don't want it to "talk", then you can change it to a beep, possibly one before and one after so you know when it finishes, although it is pretty quick.
I did some debugging of your idle section since we have chatted about it enough for me to know what to do with it despite not having access to the game.
I do not know enough about your auto-walk and auto-hold interact sections to properly debug them if they aren't working. Since I can't use them in-game, they could be working just fine. So I'm posting the whole script with the debugged idle section and unmodified auto-sections. If you don't want the audible warning, then delete it, I mostly had it in there for testing purposes. If you don't want it to "talk", then you can change it to a beep, possibly one before and one after so you know when it finishes, although it is pretty quick.
Code: Select all
#Requires AutoHotkey v2.0
#SingleInstance Force
DetectHiddenWindows 1 ; added this line in case star citizen tries to use hidden windows
Esc:: ExitApp
!`:: {
Static on := false
if on := !on {
SetTimer(Fn1, 15000) ; 15 seconds for testing, set to 900000 (15 minutes) when script is ready
WinActivate "Star Citizen" ; Activates the window to prep for movement
WinMove A_ScreenWidth, A_ScreenHeight, , , "Star Citizen" ; moves window to bottom right most corner of your screen, but completely off screen
WinMinimize "Star Citizen" ; minimizes the window and should let you begin working elsewhere
} Else {
SetTimer(Fn1, 0) ; stops the idle function
WinActivate "Star Citizen" ; activates the window
WinMaximize "Star Citizen" ; brings the window onto the main screen maximized
}
}
Fn1() {
ComObject("SAPI.SpVoice").Speak("Sending") ; Gives you an audible warning that the anti-idle action will start when the speech ends
WinActivate "Star Citizen" ; activates the window but it is still off screen
Send "{F1}" ; Sends a single F1 because the fewer tings we do in this section, the faster it will be done and not bothering your work
WinMinimize "Star Citizen" ; Minimizes the window so you can return to work
}
; Nothing below this line was altered:
; Auto-Walk
; Press alt w to start, w to stop
#HotIf WinActive("Star Citizen")
!w:: {
Loop {
Send("{w down}")
Sleep 100
KeyWait "w"
Break
}
} ;
; Auto-Hold Interact
; Press alt f to start, f to stop
!f:: {
Loop {
Send("{f down}")
Sleep 100
KeyWait "f"
Break
}
}
Last edited by DuckingQuack on 04 Mar 2023, 14:52, edited 2 times in total.
Best of Luck,
The Duck
The Duck
Re: Prevent Star Citizen from disconnecting while idle
I tested the update that you provided and nothing worked unfortunately, then I tried uncommenting the auto-walk and auto-hold interaction mode section and those worked but still not the Stay Online section. I made sure to change Star Citizen to windowed mode before pressing the toggle key combo for the stay-online part of the script, although it would be cool if the script could make the window change between windowed fullscreen and windowed modes.
The comments in the lines explaining what's going on are very helpful. I like the idea of the speak sending part, I would like to keep that in even when done testing, it will be a nice indicator to confirm the stay online part is running. Maybe even have it say sending when toggled on and something else when toggled off.
You make a good point about only using F1 one time per cycle, and it really only needs to be used once each time. The mobiGlas (Star Citizen's fancy futuristic wristwatch for our characters) can remain open with one press of F1 for 15 minutes, and it can remain closed with 1 press of F1 for 15 minutes after that, and that can be looped.
I may need to change the alt key to something else, sometimes in the past I would use the old AHK commands and then press F4 (for camera view changes in Star Citizen) and it would alt F4 and quit out of the entire program. I may also need to remove the escape key escape line from the script, that key is used in Star Citizen for menu options and settings, and I have an external basic shutdown type script that shuts down all things being used with Star Citizen when I'm done with it.
I may also need to change the ` in the alt ` to something else. If I press ` it opens a console in Star Citizen and F1 won't work, and I don't know if alt ` will override just the effect of the ` by itself.
Those toggle key combinations may actually be why there are issues with this. I tried replacing alt with shift, but that key is also used, and then with control, and that's also used, and while technically either could be used the general behavior of the response in Star Citizen is not preferred.
Maybe the tab key could be used in place of the alt key. The tab key isn't used for anything in Star Citizen that I'm aware of, so tab w for auto walk and tab f for auto interact would work great, and the tab key is on my gaming keypad so it would be comfortable to use it. I looked up how to use tab in a key combination and it mentioned using `t but that didn't work.
These might work well within the context of things, and I might as well turn the auto walk auto interact to toggles:
tab q to toggle the stay-online section
tab w to toggle auto-walk
tab f to toggle auto-hold interact mode
After sorting out the tab key combination option and getting back to the stay-online part of it, if it's still not working, then one of the earlier versions of the anti-kick lines that was mentioned earlier in this thread did work, but it was disruptive to other activities due to the flickering screen:
I wonder if maybe that could be revised to align with AHK v2 and the other updates that have gone in since then but maybe while retaining the same functionality, even if with flickering screen, then perhaps updated again to use the different WinMove approach to avoid flickering screen.
The comments in the lines explaining what's going on are very helpful. I like the idea of the speak sending part, I would like to keep that in even when done testing, it will be a nice indicator to confirm the stay online part is running. Maybe even have it say sending when toggled on and something else when toggled off.
You make a good point about only using F1 one time per cycle, and it really only needs to be used once each time. The mobiGlas (Star Citizen's fancy futuristic wristwatch for our characters) can remain open with one press of F1 for 15 minutes, and it can remain closed with 1 press of F1 for 15 minutes after that, and that can be looped.
I may need to change the alt key to something else, sometimes in the past I would use the old AHK commands and then press F4 (for camera view changes in Star Citizen) and it would alt F4 and quit out of the entire program. I may also need to remove the escape key escape line from the script, that key is used in Star Citizen for menu options and settings, and I have an external basic shutdown type script that shuts down all things being used with Star Citizen when I'm done with it.
I may also need to change the ` in the alt ` to something else. If I press ` it opens a console in Star Citizen and F1 won't work, and I don't know if alt ` will override just the effect of the ` by itself.
Those toggle key combinations may actually be why there are issues with this. I tried replacing alt with shift, but that key is also used, and then with control, and that's also used, and while technically either could be used the general behavior of the response in Star Citizen is not preferred.
Maybe the tab key could be used in place of the alt key. The tab key isn't used for anything in Star Citizen that I'm aware of, so tab w for auto walk and tab f for auto interact would work great, and the tab key is on my gaming keypad so it would be comfortable to use it. I looked up how to use tab in a key combination and it mentioned using `t but that didn't work.
These might work well within the context of things, and I might as well turn the auto walk auto interact to toggles:
tab q to toggle the stay-online section
tab w to toggle auto-walk
tab f to toggle auto-hold interact mode
After sorting out the tab key combination option and getting back to the stay-online part of it, if it's still not working, then one of the earlier versions of the anti-kick lines that was mentioned earlier in this thread did work, but it was disruptive to other activities due to the flickering screen:
Code: Select all
F12:: ; use F12 to toggle script on and off (remove if you want this script auto run)
toggle:=!toggle
If (toggle)
{
SetTimer, AntiKickF1, 60000 ; 1 minute set to 600000 for 10 minutes
; change AntiKickF1 to AntiKickMove to choose your desired Anti Kick
}
Else
{
SetTimer, AntiKickF1, Off
SetTimer, AntiKickMove, Off
}
return
AntiKickF1:
WinActivate, Star Citizen ; change this if not same as the window title
Send, {F1 2} ; send F1 twice as it open and close immediatly.
WinMinimize, Star Citizen
return
AntiKickMove:
WinActivate, Star Citizen ; change this if not same as the window title
Send, {a}{d} ; make the character move left and right
WinMinimize, Star Citizen
return
Esc::ExitApp ; terminate script with Esc
- DuckingQuack
- Posts: 219
- Joined: 20 Jan 2023, 18:20
Re: Prevent Star Citizen from disconnecting while idle
This is unfortunate, seeing as how I thoroughly tested this in chrome before posting it. It seems we have reached another impasse as I am unable to assist since I do not have the means to test the codes in your game.
OOPS! Good catch, I totally forgot I had commented out the #HotIf line so I could test it in chrome, but technically that line being commented would NOT have prevented those sections from working in the game, nor outside of the game. It's purpose is to make those sections ONLY work while the game is the active window.
Did you compare their anti-kick function to the one I posted? They're practically identical. The only difference is the v1 and v2 syntax.xvz wrote: ↑04 Mar 2023, 10:56I wonder if maybe that could be revised to align with AHK v2 and the other updates that have gone in since then but maybe while retaining the same functionality, even if with flickering screen, then perhaps updated again to use the different WinMove approach to avoid flickering screen.
Code: Select all
AntiKickF1:
WinActivate, Star Citizen
Send, {F1 2}
WinMinimize, Star Citizen
return
Code: Select all
Fn1() {
WinActivate "Star Citizen"
Send "{F1}"
WinMinimize "Star Citizen"
}
Best of Luck,
The Duck
The Duck
Re: Prevent Star Citizen from disconnecting while idle
That's right, they are nearly identical, the activate/send/minimize lines, just one is v1 and the other is v2.
Any idea by chance how to use the tab key instead of the alt key?
The tab key has no other use in Star Citizen, so it won't conflict with anything, and it has always been kind of a bad choice on my part to use the alt key, considering it has occasionally resulted in me accidentally pressing alt f4 out of Star Citizen.
Also, I think that the no-idle part of the script may not be working because I'm using the ` key. I don't think it is overriding the normal use of the ` key in Star Citizen, thus preventing that section of the script from working.
So in essence I'm hoping to update these lines:
The commented lines describe the updated intention, and the current lines that they reference are still using the alt key instead of tab. I looked up how to use tab and tried it, it was `t but that didn't work.
I'm thinking that with those updates the entire script might work. It'll be worth a try anyway.
Any idea by chance how to use the tab key instead of the alt key?
The tab key has no other use in Star Citizen, so it won't conflict with anything, and it has always been kind of a bad choice on my part to use the alt key, considering it has occasionally resulted in me accidentally pressing alt f4 out of Star Citizen.
Also, I think that the no-idle part of the script may not be working because I'm using the ` key. I don't think it is overriding the normal use of the ` key in Star Citizen, thus preventing that section of the script from working.
So in essence I'm hoping to update these lines:
Code: Select all
; Stay Online
; Press tab q to toggle
!q:: {
Code: Select all
; Auto-Walk
; Press tab w to toggle
#HotIf WinActive("Star Citizen")
!w:: {
Code: Select all
; Auto-Hold Interact
; Press tab f to toggle
!f:: {
I'm thinking that with those updates the entire script might work. It'll be worth a try anyway.
Re: Prevent Star Citizen from disconnecting while idle
Hello @xvz!
Looks like you want to use Tab as modifier key, try this:
You can first try if my script work by testing this:
If it does work, you can use that as a modifier key.
(I already test it, work perfectly.)
Looks like you want to use Tab as modifier key, try this:
Code: Select all
Tab & q::
Tab & w::
Tab & f::
Code: Select all
Tab & 1::MsgBox, You pressed Tab and 1
(I already test it, work perfectly.)
My Creations
IMG2HotString - Send image file easily with your hotstring!
CtrlSend - A small solution for sending keys to window in background that doesn't accept ControlSend's key
ControlProcess
IMG2HotString - Send image file easily with your hotstring!
CtrlSend - A small solution for sending keys to window in background that doesn't accept ControlSend's key
Re: Prevent Star Citizen from disconnecting while idle
Uh oh! I updated the script, the syntax checker did not complain, but when I started it, the normal tab key functionality stopped working, so I was unable to alt-tab out of any windows or even use the tab key for any normal purposes. It looks like I may need to use a different key combination. I'm going to try the shift key, or the ^ with those other keys.
Quick edit - okay, shift key is a bad idea, I forgot that it is being used with other purposes in Star Citizen. The tab key is also, I forgot about that. The alt key works for auto-walk and auto-hold interaction mode, I would just have to be careful to not press the f4 key if I use alt with the other key combinations. I wonder if the caps-lock key could be used instead, I looked that up and it appears to use "CapsLock &", I will try that.
Quick edit - okay, shift key is a bad idea, I forgot that it is being used with other purposes in Star Citizen. The tab key is also, I forgot about that. The alt key works for auto-walk and auto-hold interaction mode, I would just have to be careful to not press the f4 key if I use alt with the other key combinations. I wonder if the caps-lock key could be used instead, I looked that up and it appears to use "CapsLock &", I will try that.