integer mychannel = -8888; integer particle_chan = -270510; string listenfor; string response; string detach; key masterid; key handle; key them = NULL_KEY; string URL = ""; key RequestID; default { state_entry() { masterid = llGetOwner(); handle = llGetKey(); listenfor = (string)masterid + "handle"; response = (string)masterid + "handle ok"; detach = (string)masterid + "handle detached"; llListen(mychannel, "", NULL_KEY, listenfor); llSay(mychannel, response); } attach(key id) { if (NULL_KEY == id) llSay(mychannel, detach); } listen(integer channel, string name, key id, string message) { llSay(mychannel, response); llSay(particle_chan, handle + "#" + masterid); if (NULL_KEY == them) them = llGetOwnerKey(id); } dataserver(key id, string data) { list input = llParseStringKeepNulls(data, ["|"], []); string domain = llList2String(input, 0); if ("URL" == domain) { list l = llGetObjectDetails(id, [OBJECT_OWNER]); URL = llList2String(input, 1); llOwnerSay(llKey2Name(id) + ", owned by " + llKey2Name(llList2Key(l, 0)) + ", tells me their new URL is " + URL); } } http_response(key id, integer status, list metaData, string body) { if (id == RequestID) { RequestID = NULL_KEY; if (status != 200) llOwnerSay("HTTP error code " + status + "\n" + body); } else if (id == NULL_KEY) llOwnerSay("Too many HTTP requests too fast!"); } on_rez(integer param) { llResetScript(); } touch_start(integer total_number) { llSay(particle_chan, handle + "#" + masterid); } changed(integer change) { if ("" != URL) { string message = llGetRegionName() + "|" + (string) llGetPos(); // llSleep(1.0); if (NULL_KEY != them) { if (change & CHANGED_REGION) { RequestID = llHTTPRequest(URL, [HTTP_METHOD, "POST", HTTP_VERBOSE_THROTTLE, FALSE, HTTP_BODY_MAXLENGTH, 16384], llEscapeURL("REGION|" + message)); llOwnerSay("Changed region to " + llGetRegionName() + " - " + (string)llGetPos() + "\n Requesting that " + osKey2Name(them) + " join me."); } else if (change & CHANGED_TELEPORT) { RequestID = llHTTPRequest(URL, [HTTP_METHOD, "POST", HTTP_VERBOSE_THROTTLE, FALSE, HTTP_BODY_MAXLENGTH, 16384], llEscapeURL("TELEPORT|" + message)); llOwnerSay("Teleported to " + llGetRegionName() + " - " + (string)llGetPos() + "\n Requesting that " + osKey2Name(them) + " join me."); } } } } }