PenUltima Online Forum Index Official Core: 096.7
Official Core: 097 2008-02-26
Donate towards the POL web hosting bill!
 POL Home   FAQ   Search    Memberlist   Usergroups    Register    Profile   Log in to check your private messages   Log in
detect crashes

 
Post new topic   Reply to topic    PenUltima Online Forum Index -> Development Discussion 097
Display posts from previous:   

Author Message
phao



Joined: 31 Aug 2007
Posts: 34

PostPosted: Sun Mar 30, 2008 12:25 pm    Post subject: detect crashes Reply with quote

how can I detect a crash in start script? to see if the last pol close was made by a crash or by ctrl-C ??

and, saveworldstate() function save every prop in datafiles?

Author Message
ncrsn



Joined: 10 Feb 2006
Posts: 168

PostPosted: Sun Mar 30, 2008 12:52 pm    Post subject: Reply with quote

You could save a global property just before calling Shutdown(). Then, in start.src that property is read, and if it returns error (unset property), you know POL crashed. If property exists, you have to erase it.

As far as I know, CTRL+C is reserved command and thus you cannot manipulate its actions. You could however create a script shutdownalias.src into scripts/console/, add a command, say, CTRL+X, and use that instead of hardcoded shutdown.

Scriptwise the whole setting would look like this.

A new line to /config/console.cfg
Code:

CMD ^X shutdownalias Forces shutdown.


/scripts/console/shutdownalias.src
Code:

use uo;

program shutdownalias( )
   
    SetGlobalProperty("CleanShutdown", 1);
    Shutdown();
   
endprogram


A new line to /scripts/start.src
Code:

// Inside the program block...
if (GetGlobalProperty("CleanShutdown"))
    Print("POL did not crash.");
    EraseGlobalProperty("CleanShutdown");
else
    Print("POL crashed!");
endif


And before every other Shutdown() function call..
Code:

SetGlobalProperty("CleanShutdown", 1);


I do not use this myself, and thus cannot guarantee that it would work for sure. Anyhow this should give you an idea.

Author Message
phao



Joined: 31 Aug 2007
Posts: 34

PostPosted: Sun Mar 30, 2008 2:11 pm    Post subject: Reply with quote

lol, take a look on that:
console.cfg
Code:
Commands
{
   CMD w exitpol POL safe exit
   CMD u [unlock]
   CMD l [lock]
}


console output:
Code:
Console is locked.  Press 'u' to unlock.
Console is now unlocked.
Console is locked.  Press 'u' to unlock.
Console is now unlocked.


every "Console is locked. Press 'u' to unlock." message is an 'w' keypress I am doing.

Post new topic   Reply to topic    PenUltima Online Forum Index -> Development Discussion 097 All times are GMT - 4 Hours
Page 1 of 1

 




Powered by phpBB © 2001, 2005 phpBB Group :: Theme & Graphics by GHS & Scott E. Royalty