Skip to content

Instantly share code, notes, and snippets.

@antonyfairport
Created August 31, 2011 11:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antonyfairport/1183371 to your computer and use it in GitHub Desktop.
Save antonyfairport/1183371 to your computer and use it in GitHub Desktop.
Simple script that notifies you when (via IM) a region has restarted/
//////////////////////////////////////////////////////////////////////
// Sim Restart Notifier -- By Antony Fairport
//
// IMs you when the sim it is located on restarts. Handy during
// rolling restarts when you've had to run away and want to be told
// as soon as it's back up.
//
// Revision history:
// ------------------------------------------------------------
//
// 2011-05-31
// First version.
string g_sLastRestart = "";
//////////////////////////////////////////////////////////////////////
// Format a llGetTimestamp()
string FormatTime( string sTime )
{
list l = llParseString2List( sTime, [ "T", "." ], [] );
return llList2String( l, 0 ) + " " + llList2String( l, 1 ) + " UTC";
}
//////////////////////////////////////////////////////////////////////
// Sim Restart Notifier -- Antony Fairport
default
{
//////////////////////////////////////////////////////////////////
// React to a touch.
touch_start( integer num_detected )
{
// If we don't have a last restart time...
if ( g_sLastRestart == "" )
{
// ...so say.
llWhisper( 0, "No restart has been recorded yet." );
}
else
{
// Otherwise say what the last recorded restart time is.
llWhisper( 0, "Last restart was " + g_sLastRestart );
}
}
//////////////////////////////////////////////////////////////////
// React to changes.
changed( integer change )
{
// If the region has started...
if ( change & CHANGED_REGION_START )
{
// ...IM me to let me know it's back.
llInstantMessage( llGetOwner(), llGetRegionName() + " has restarted." );
g_sLastRestart = FormatTime( llGetTimestamp() );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment