Detect When QuittingExiting Game?

Post » Mon Nov 19, 2012 7:04 am

Hello, does anyone know if there is a way to detect when the player is about the quit or exit the game? There doesn't seem to be any Events for this, but perhaps someone has a creative idea on how to detect it? Perhaps detecting the messagebox that asks if you want to save before quitting?
User avatar
Janine Rose
 
Posts: 3428
Joined: Wed Feb 14, 2007 6:59 pm

Post » Mon Nov 19, 2012 10:20 am

Considering someone can type "qqq" in console and immediatly quit, bypassing all menus and warnings, I would say there is no reliable way. For that matter, they could kill the process with task manager or unplug their computer. You maybe able to forge a menu facade with flash (see SkyUI), but it would be a lot of work and not bullet proof. I dont know what you are trying to do, but your time would probably be better spent designing a solution around detecting when a game is loaded and putting in some initialization/recovery code.
User avatar
SamanthaLove
 
Posts: 3565
Joined: Mon Dec 11, 2006 3:54 am

Post » Mon Nov 19, 2012 2:01 am

May I ask what this is for? If there even was a way (Which I don't believe there is) it probably wouldn't fire until the player clicked exit, or 'yes', and then it's too late to do anything anyway. :tongue:
User avatar
Zoe Ratcliffe
 
Posts: 3370
Joined: Mon Feb 19, 2007 12:45 am

Post » Mon Nov 19, 2012 3:10 am

As said above, no not really.

You can make some guesses, but not reliably enough for anything to work 100% I would imagine.

http://www.creationkit.com/OnUnload_-_ObjectReference
http://www.creationkit.com/OnCellDetach_-_ObjectReference

They are as good as it gets (and happen way more often than just exiting the game)
User avatar
Kirsty Wood
 
Posts: 3461
Joined: Tue Aug 15, 2006 10:41 am

Post » Mon Nov 19, 2012 8:19 am

Thanks for the input guys. I'm trying to get the game to autosave on exit (yes, I know the game prompts you to save before exiting, but I'll be disabling that). I think what I will do is just detect when the player is in menumode and RequestAutosave() every so often.
User avatar
Auguste Bartholdi
 
Posts: 3521
Joined: Tue Jun 13, 2006 11:20 am


Return to V - Skyrim