Checks the Second Life Grid Status every five minutes to see if there are any new issues. If there are it will IM you.

 

 

Drop this script onto any prim that is currently not expected to do something else (e.g. a wall or floor etc) and let it run. If it is in an attachment it will work fine but, only while you are logged in. The script will maintain the name of the prim (or object if in a root) but when sending an update will use a special name set by you.

// V20 //
 
string feed_url = "http://status.secondlifegrid.net/feed/"; // From where we draw our updates.
 
string alert_name = "Grid Status Update"; // What we call the object while it messages us.
 
string my_proper_name; // Used to store the memory of the name of the object when dormant.
 
key owner; // Used to store the owners UUID.
 
string last; // Used to store the last update so we can tell if the latest is new.
 
key iq; // Used to verify the source of the HTTPRequest.
 
list exchange = [" [...]","...",
                 "”","\"",
                 "“","\"",
                 "’","'",
                 ">",">",
                 "&","&",
                 ">",">",
                 "&","&"];
 
string MultiStringReplace(string src, list thisnthats)
{
    integer index = 0;
    integer lc = 0;
    integer ll = llGetListLength(thisnthats);
    string this;
    do
    {
        this = llList2String(thisnthats, lc);
        ++lc;
        while((index = llSubStringIndex(src, this)) != -1)
        src = llInsertString(llDeleteSubString(src, index, (index + (llStringLength(this) - 1))), index, llList2String(thisnthats, lc));
    }
    while((++lc) < ll);
    return src;
}
 
default
{
    on_rez(integer param)
    {
        llResetScript();
    }
    state_entry()
    {
        my_proper_name = llGetObjectName();
        owner = llGetOwner();
        llSetTimerEvent(300.0);
        iq = llHTTPRequest(feed_url, [], "");
    }
    timer()
    {
        iq = llHTTPRequest(feed_url, [], "");
    }
    http_response(key q, integer status, list meta, string body)
    {
        if(q == iq)
        {
            if(status == 200)
            {
                body = llGetSubString(body, (llSubStringIndex(body, "") + 6), -1);
                string latest = llStringTrim(llGetSubString(body, (llSubStringIndex(body, "") - 1)), STRING_TRIM);
                if(latest != last)
                {
                    last = latest;
                    string dnt = llGetSubString(body, (llSubStringIndex(body, "") + 9), (llSubStringIndex(body, "") - 10));
                    llSetObjectName(alert_name);
                    llInstantMessage(owner, "/me \n\nISSUE --> " + MultiStringReplace(llGetSubString(body, (llSubStringIndex(body, "") + 7),
                                                                                     (llSubStringIndex(body, "") - 1)), exchange) + 
                                            "\n\nTIME --> " + llGetSubString(dnt, -5, -1) + ", " + (llGetSubString(dnt, 0, -7) + " (UTC)") +
                                            "\n\nLATEST --> " + MultiStringReplace(latest, exchange) +
                                            "\n\nVISIT --> " + llGetSubString(feed_url, 0, -6));
                    llSetObjectName(my_proper_name);
                }
            }
            else
            {
                llSleep(30.0);
                iq = llHTTPRequest(feed_url, [], "");
            }
        }
    }
}