// OpenSim Destination Guide Terminal v0.3 by djphil (CC-BY-NC-SA 4.0)
// Edited by paela argus for Osgrid in August 2018.
// For help please contact PAELA ARGUS.
// This script is full permisson. Please do not change this.
// PLEASE USE THIS BOX ON OSGRID ONLY !
// IF YOU WANT SIMILAR SYSTEM FOR YOUR GRID PLEASE GO TO
https://github.com/djphil/osguide Free to use for all and will make
dj phil happy :-) Cordially paela argus,
string targetUrl = "http://destination.osgrid.org/"; // WARNING Any change of this url will break this script WARNING !!
string terminal_name = "Terminal 1.1.5 Gaming"; // other name is not allowed and auto removed by osgrid server !!
string categorie_name = "Gaming"; // Use the choises 3-14 below, other names are auto removed !!
float update_rate = 200.0; // Don't use timer lower than 200 or Ip server might be banned in osgrid. Thanks you !!!
integer display_debug = FALSE; // show a debug txt
integer display_guide = TRUE; // show in guide FALSE = will only show in viewer destination guide !!
integer display_text = FALSE; // make a floating text above your box
integer face = ALL_SIDES; // change at your owner risk !!
// 1 Official location //disabled for user level 0
// 3 Arts and culture = events and art
// 4 Business
// 5 Educational
// 6 Gaming
// 7 Hangout
// 8 Newcomer friendly
// 9 Parks and Nature
// 10 Residential
// 11 Shopping
// 13 Other
// 14 Rental
// AFTER THIS LINE DONT TOUCH THIS SCRIPT THANKS YOU !! ANY CHANGE ARE
AT YOUR OWN RISK AND CAN BAN YOUR SERVER ACCESS IN THE DESTINATION GRID
!!!
string server_uuid;
string region_name;
string owner_name;
string owner_uuid;
string script_name;
key http_request_id;
key tiny_request_id;
key serv_request_id;
key ping_request_id;
terminal_fullbright_flash()
{
llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_FULLBRIGHT, face, TRUE]);
llSleep(0.25);
llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_FULLBRIGHT, face, FALSE]);
}
key addRegionToDestinationGuideID;
addRegionToDestinationGuide(string url)
{
integer scope = AGENT_LIST_PARCEL_OWNER|
AGENT_LIST_EXCLUDENPC;//dont change this line or server ip banned in
osgrid thanks you !!
list agents_list = llGetAgentList(scope, []);
integer agents_online = llGetListLength(agents_list);
addRegionToDestinationGuideID = llHTTPRequest(targetUrl + "inc/terminal.php",
[HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded", HTTP_BODY_MAXLENGTH, 16384],
"terminal=register" +
"&categorie_name=" + llEscapeURL(categorie_name) +
"&http_server_url=" + llStringToBase64(http_server_url) +
"&agents_online=" + agents_online +
"&agents_list=" + llStringToBase64(llList2CSV(agents_list))
);
}
string http_server_url;
request_http_server_url()
{
llReleaseURL(http_server_url);
http_server_url = "";
llRequestURL();
}
verify_region_parcel_owner()
{
list parcel_details = llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_NAME, PARCEL_DETAILS_OWNER]);
string parcel_name = llList2String(parcel_details, 0);
key parcel_owner_uuid = llList2Key(parcel_details, 1);
if (owner_uuid != parcel_owner_uuid)
{
llOwnerSay("\nD sol " + owner_uuid + ", la parcelle " + parcel_name + " ne t'appartient pas ...");
llInstantMessage(parcel_owner_uuid,
"\nUn object nom \"" + llGetObjectName() + "\"" +
" contenant un script nom \"" + script_name + "\"" +
" t rezzer par " + owner_name +
" sur la parcelle " + parcel_name +
" de la r gion " + region_name +
"\n[OBJET UUID] " + llGetKey() +
"\n[OWNER UUID] " + owner_uuid
);
llDie();
}
}
default
{
state_entry()
{
llOwnerSay("Initialisation ...");
owner_uuid = llGetOwner();
region_name = llGetRegionName();
script_name = llGetScriptName();
verify_region_parcel_owner();
llSetObjectName(script_name);
llSetObjectDesc("Digital Concepts (CC-BY-NC-SA 4.0) edit paela");
if (display_text) llSetText("[? TERMINAL ?]\n" + region_name + "\n(" + owner_name + ")", <1.0, 1.0, 1.0>, 1.0);
else llSetText("", <1.0, 1.0, 1.0>, 1.0);
llSetTexture(osGetMapTexture(), face);
llSetTimerEvent(0.1);
}
touch_start(integer n)
{
key toucher_uuid = llDetectedKey(0);
if (toucher_uuid == owner_uuid) llSetTimerEvent(0.1);
else llRegionSayTo(toucher_uuid, PUBLIC_CHANNEL, "Onwer only " + " ...");
}
http_request(key id, string method, string body)
{
if (method == URL_REQUEST_GRANTED)
{
http_server_url = body;
addRegionToDestinationGuide(http_server_url);
tiny_request_id = llHTTPRequest("http://tinyurl.com/api-create.php?url=" + targetUrl, [], "");
serv_request_id = llHTTPRequest("http://tinyurl.com/api-create.php?url=" + body, [], "");
ping_request_id = llHTTPRequest(body, [], "");
}
else if (method == URL_REQUEST_DENIED)
{
llSay(PUBLIC_CHANNEL, "Something went wrong, no url. " + body);
}
else if (method == "GET")
{
llHTTPResponse(id, 200, "Terminal Http Server for " + terminal_name + " is ready to use ...\n");
}
else if (method == "POST")
{
llHTTPResponse(id, 200, "OK");
addRegionToDestinationGuide(http_server_url);
terminal_fullbright_flash();
}
else {llHTTPResponse(id, 405, "Unsupported Method"); llOwnerSay("[ERROR] Unsupported Method ...");}
}
http_response(key id, integer status, list metadata, string body)
{
if (id)
{
if (status != 200)
{
llOwnerSay("[POST RECIEVED] " + status);
return;
}
}
else if (id == NULL_KEY)
{
llOwnerSay("[POST NULL & STATUS] " + status);
return;
}
body = llStringTrim(body, STRING_TRIM);
// if (id == tiny_request_id && display_guide)
// llSay(PUBLIC_CHANNEL, "Guide @ " + body);
// if (id == serv_request_id && display_debug)
// llOwnerSay("Server @ " + body);
if (id == addRegionToDestinationGuideID && display_debug)
{
string text = "\n============================";
text += "\n" + body;
text += "\n============================";
llOwnerSay(text);
}
if (id == ping_request_id && display_debug)
{
string text = "\n============================";
text += "\n" + body;
text += "\n============================";
llOwnerSay(text);
}
if (body == "HOST_RESTRICTION")
{
body = "\n* Your \"host\" Are not allowed to use this box
any question contact paela argus inworld or in mail:
[email protected] ...";
body += "\n* the region \"" + region_name + "\" are not added ...";
llOwnerSay("[WARNING] " + owner_name + body);
}
if (body == "UUID_RESTRICTION")
{
body = "\n* categorie \"" + categorie_name + "\" are not allowed ...";
body += "\n* region \"" + region_name + "\" not added ...";
llOwnerSay("[WARNING] " + owner_name + body);
}
}
timer()
{
llSetTimerEvent(update_rate);
request_http_server_url();
terminal_fullbright_flash();
}
on_rez(integer n)
{
llSetTimerEvent(0.0);
verify_region_parcel_owner();
}
changed(integer change)
{
if (change & CHANGED_INVENTORY) {llResetScript();}
if (change & CHANGED_OWNER) {llResetScript();}
if (change & CHANGED_REGION) {llResetScript();}
if (change & CHANGED_REGION_START) {llResetScript();}
}
}