One possible astuce is:
- modify your Debug command to look something like:
CODE
LinkMessage( string message )
{
llMessageLinked( LINK_SET, 0, message, "" );
}
Debug( string message )
{
llWhisper( 0, llGetScriptName() + ": " + message );
LinkMessage( "LASTCOMMAND-=-" + message );
}
Sprinkle Debug statements liberally throughout your program ("function blah >>>", "function blah <<<", etc).
Now, add the following script to your object:
CODE
string sMyScriptName = "PutYourScriptNameHere";
integer bScriptState = TRUE;
string sLastCommand = "";
default
{
state_entry()
{
llSay(0, "Hello, Avatar!");
bScriptState = TRUE;
llSetTimerEvent( 1.0 );
}
timer()
{
integer bNewScriptState = llGetScriptState( sMyScriptName );
if( bNewScriptState != bScriptState )
{
if( !bNewScriptState )
{
llInstantMessage( llGetOwner(), "Scanner " + llGetObjectName() + " script crashed at " + (string)llGetWallclock() + " last command: " + sLastCommand );
}
else
{
llInstantMessage( llGetOwner(), "Scanner " + llGetObjectName() + " script restarted at " + (string)llGetWallclock() );
}
bScriptState = bNewScriptState;
}
}
link_message( integer sendernum, integer num, string message, key id )
{
list arguments = llParseString2List( message, ["-=-"], [] );
if( llList2String( arguments, 0 ) == "LASTCOMMAND" )
{
sLastCommand = llList2String( arguments, 1 );
}
}
}
When the script crashes, you'll receive an IM with the last debug message before the crash.
Azelda