////////////////////////////////////////////////////////// // WaS (c) grimore.org - 2012, License: GPLv3 // // Please see: http://www.gnu.org/licenses/gpl.html // // for legal details, rights of fair usage and // // the disclaimer and warranty conditions. // ////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////// // CONFIGURATION // ////////////////////////////////////////////////////////// // Set this URL to point to the simStatus.php script // on the webserver hosting the PHP script: string llURL = "http://grimore.org/SIM/simStatus.php"; // Set this to the password in the PHP script. // Please see the PHP script headers for documentation. string apiKey = "bbd16d2772593ea5f890973c027dbc7f4a096164"; /////////////////////////////////////////////////////////////////////////// // END CONFIGURATION // /////////////////////////////////////////////////////////////////////////// default { state_entry() { llRequestURL(); llSetTimerEvent(5); } timer() { llSetTimerEvent(0); if(llURL == "") { llRequestURL(); llSetTimerEvent(5); return; } } http_request(key id, string method, string body) { if (method == URL_REQUEST_GRANTED) { llHTTPRequest(llURL + "?url=" + llEscapeURL(body) + "&key="+apiKey, [], ""); llURL = body; return; } } http_response(key request_id, integer status, list metadata, string body) { if(status == 200) { state catch; } } } state catch { http_request(key id, string method, string body) { if (method == "GET") { llURL = id; state finally; return; } } changed(integer change) { llResetScript(); } } state finally { state_entry() { llMessageLinked(LINK_THIS, 0, "SYN", ""); } link_message(integer sender_num, integer num, string str, key id) { if(id != "ACK") return; list xData = llParseString2List(llDumpList2String(llCSV2List(str), "|"), ["|", " - ", "[ ", " ]", " ˉ|ˉ"], []); str = ""; @tag; id = llList2String(xData, 0); xData = llDeleteSubList(xData, 0, 0); if((string)id == "up" || (string)id == "down" || (string)id == "starting" || (string)id == "stopping" || (string)id == "crashed" || (string)id == "unknown") { str += "" + (string)id + ""; jump tag; } if(~llSubStringIndex((string)id, ":")) { str += "" + (string)id + ""; jump tag; } if((string)id != "") { str += "" + (string)id + ""; jump tag; } llHTTPResponse(llURL, 200, str+""); state catch; } }