Page 1 of 2
Auto close Spring on game end.
Posted: 11 Sep 2007, 12:09
by TechnoTone
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?
Posted: 11 Sep 2007, 12:41
by Tobi
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.
Posted: 11 Sep 2007, 14:36
by TechnoTone
Thanks, but where do I use this argument. I've tried it with TASClient.exe but it made no difference. If it's for Spring.exe then how do I get the lobby client to include it?
Posted: 11 Sep 2007, 15:18
by Licho
Lol I didn't know, and went to some bumpy road with autohost to achieve just that :)
Posted: 11 Sep 2007, 18:50
by Dragon45
those lines should be integrated into settings.exe tbh (perhaps with a timeout period so that it only autoquits after like, 7 seconds or so, to give people a chance to view endgame stats)
Posted: 11 Sep 2007, 19:16
by Tobi
No, if anything this should be integrated into the startscript.
This setting belongs semantically to one game, not to the settings of the entire engine.
Posted: 12 Sep 2007, 00:41
by TechnoTone
So am I to understand that there's no way I can do this at the moment without LUA?
Posted: 12 Sep 2007, 09:27
by Tobi
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.
Posted: 12 Sep 2007, 10:07
by Regret
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
Place it in a new .lua file, put to your widgets directory, activate.
Posted: 12 Sep 2007, 13:12
by TechnoTone
Thanks Regret!
Thanks too to everyone else for your input.
Posted: 03 Oct 2007, 15:42
by Smiff
is it possible to put in a delay between game end and quit please? say 60 seconds, so you've time to read the scoreboard. i don't know any Lua, but this widget is a great idea if you've got kids who are too (something) to close their games.
Posted: 03 Oct 2007, 20:36
by Forboding Angel
This would play absolute havoc with modders doing offline testing...
Posted: 03 Oct 2007, 21:20
by FLOZi
Forboding Angel wrote:This would play absolute havoc with modders doing offline testing...
...which is why they would disable it.
Posted: 03 Oct 2007, 21:20
by TechnoTone
What are you talking about FA? If you don't want it to auto-quit then you disable the widget!
Smiff, yes, that should be pretty straight forward. When I get some time I'll add a (configurable) delay.
Re: Auto close Spring on game end.
Posted: 26 Dec 2008, 03:42
by Evil4Zerggin
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.
Re: Auto close Spring on game end.
Posted: 17 Jan 2009, 21:46
by zwzsg
I find it's better when a simple mouse movement, instead of a mouseclick, cancel the autoquit. So I edited Evil4Zerggin's widget:
Re: Auto close Spring on game end.
Posted: 17 Jan 2009, 22:05
by Evil4Zerggin
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.
Posted: 18 Jan 2009, 23:48
by BaNa
I've been using this and it is very nice, thanks!
lets me spec games in a row without babysitting the pc
Re: Auto close Spring on game end.
Posted: 19 Jan 2009, 02:28
by Forboding Angel
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.
Posted: 19 Jan 2009, 03:17
by zwzsg
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.