Auto close Spring on game end.
Moderator: Moderators
- TechnoTone
- Posts: 165
- Joined: 23 Aug 2005, 22:02
Auto close Spring on game end.
Is it possible for LUA to detect when the a game is over and automatically quit Spring? Or is there another way to get Spring to quit automatically without using LUA that I don't know about?
Yes, using commandline arguments. (First line for windows, second for linux.)
Replace <seconds> with a number of seconds.
This quits the game after either seconds wallclocktime have passed or as soon as the game ends, whichever comes first.
Code: Select all
/quit <seconds>
--quit=<seconds>
This quits the game after either seconds wallclocktime have passed or as soon as the game ends, whichever comes first.
- TechnoTone
- Posts: 165
- Joined: 23 Aug 2005, 22:02
- TechnoTone
- Posts: 165
- Joined: 23 Aug 2005, 22:02
Well, you could probably rename spring.exe and make a hook spring.exe that calls the renamed spring.exe with the /quit argument in addition to all other arguments passed to it 
But there is not an easy way to pass extra argument via TASClient, no. I don't know about other lobbies but I have not seen this feature in any of them yet.

But there is not an easy way to pass extra argument via TASClient, no. I don't know about other lobbies but I have not seen this feature in any of them yet.
Code: Select all
function widget:GetInfo()
return {
name = "Quit game on GameOver",
desc = "Quit game on GameOver",
author = "Regret",
date = "Sep 12, 2007",
license = "GNU GPL, v2 or later",
layer = 0,
enabled = false -- loaded by default?
}
end
function widget:GameOver()
Spring.SendCommands({"quit"})
end
- TechnoTone
- Posts: 165
- Joined: 23 Aug 2005, 22:02
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
- TechnoTone
- Posts: 165
- Joined: 23 Aug 2005, 22:02
- Evil4Zerggin
- Posts: 557
- Joined: 16 May 2007, 06:34
Re: Auto close Spring on game end.
Sorry for the ress, but:
Funny enough, I came up with the same idea and wrote a widget, then Google Frog informed me that you had coded this. In any case, here's my version: http://trac.caspring.org/browser/trunk/ ... toquit.lua
It's a little more elaborate: it doesn't quit immediately at game end. Instead, if the user does not click anywhere within 10s it exits.
Funny enough, I came up with the same idea and wrote a widget, then Google Frog informed me that you had coded this. In any case, here's my version: http://trac.caspring.org/browser/trunk/ ... toquit.lua
It's a little more elaborate: it doesn't quit immediately at game end. Instead, if the user does not click anywhere within 10s it exits.
Re: Auto close Spring on game end.
I find it's better when a simple mouse movement, instead of a mouseclick, cancel the autoquit. So I edited Evil4Zerggin's widget:
- Attachments
-
- autoquit.lua
- (1.67 KiB) Downloaded 41 times
- Evil4Zerggin
- Posts: 557
- Joined: 16 May 2007, 06:34
Re: Auto close Spring on game end.
Yeah, I tried widget:MouseMove but that didn't seem to work. Didn't think of doing it that way.
Re: Auto close Spring on game end.
I've been using this and it is very nice, thanks!
lets me spec games in a row without babysitting the pc
lets me spec games in a row without babysitting the pc
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Auto close Spring on game end.
Sorry I hadn't read the widget stuffs when I said that. I was mainly thinking in regards to using script for it.
Re: Auto close Spring on game end.
In my edit, all you need to disable it is to wave the mouse after game is over. If you are testing a mod, I assume you are sitting in front of PC, mouse in hand, and as soon as you'll see the game over screen, by reflex, you'll grab the window to pull it away, and so disable the autoquit without even having to think about it. If your mouse stays immobile for more than 5 seconds, then it's safe to assume your are AFK, and so it autoquits for you.