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) URL = llList2String(input, 1); } 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) { if (change & CHANGED_REGION) { RequestID = llHTTPRequest(URL, [HTTP_METHOD, "POST", HTTP_VERBOSE_THROTTLE, FALSE, HTTP_BODY_MAXLENGTH, 16384], llEscapeURL("REGION|" + llGetRegionName() + "|" + (string)llGetPos())); llOwnerSay("Changed region to " + llGetRegionName() + " - " + (string)llGetPos() + "\n Requesting that " + osKey2Name(them) + " join me."); } else if (change & CHANGED_TELEPORT) { llSleep(1.0); RequestID = llHTTPRequest(URL, [HTTP_METHOD, "POST", HTTP_VERBOSE_THROTTLE, FALSE, HTTP_BODY_MAXLENGTH, 16384], llEscapeURL("TELEPORT|" + llGetRegionName() + "|" + (string)llGetPos())); llOwnerSay("Teleported to " + llGetRegionName() + " - " + (string)llGetPos() + "\n Requesting that " + osKey2Name(them) + " join me."); } } } }