GizmoEclipse

Main_Server.lsl

Oct 1st, 2019
553
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. integer current_node;
  2. integer total_nodes;
  3. send_email(string address,string subject,string message){
  4.     current_node = (current_node+1)%total_nodes;
  5.     llMessageLinked(-1,current_node,subject+"###email###"+message,address);
  6. }
  7. send_im(key i,string message){
  8.     current_node = (current_node+1)%total_nodes;
  9.     llMessageLinked(-1,current_node,message+"###instant_message",i);
  10. }
  11. mass_action_email(string send){
  12.     integer x = 0;
  13.     integer s = llGetListLength(servers);
  14.     for(;x<s;++x){
  15.         send_email(llList2String(servers,x),"ACTION",send);
  16.         llSleep(.1);
  17.     }
  18. }
  19. mass_details_email(string send){
  20.     integer x = 0;
  21.     integer s = llGetListLength(servers);
  22.     for(;x<s;++x){
  23.         send_email(llList2String(servers,x),"PARCEL_DETAILS",send);
  24.         llSleep(.1);
  25.     }
  26. }
  27. mass_agent_email(string send){
  28.     integer x = 0;
  29.     integer s = llGetListLength(servers);
  30.     for(;x<s;++x){
  31.         send_email(llList2String(servers,x),"AGENTS",send);
  32.         llSleep(.1);
  33.     }
  34. }
  35. text_update(string i){
  36.     llMessageLinked(-1,-55565,"Sub-Server(s): "+(string)llGetListLength(servers),i);
  37. }
  38. parcel_parse(string toHandle){
  39.     //d_1 = region name
  40.     //d_2 = local region pos
  41.     //d_3 = requester id
  42.     //d_4 = parcel name
  43.     //d_5 = parcel owner
  44.     //d_6 = parcel group
  45.     //d_7 = DUMP for d2
  46.     //d2_0 = prims used
  47.     //d2_1 = parcel size
  48.     //d2_2 = parcel description
  49.    
  50.     list d = llParseString2List(toHandle,["Object-Name: ","Region: ","Local-Position: ","Target-Id: ","Parcel-Name: ","Parcel-Owner: ","Parcel-Group: ","Prim-Percent-Used: "],[]);
  51.     list d2 = llParseString2List(llList2String(d,7),["Prim-Percent-Used: ","Parcel-Size: ","Parcel-Desc: "],[]);
  52.     string output = "\n"+llStringTrim(llList2String(d,1),STRING_TRIM) + llStringTrim(llList2String(d,2),STRING_TRIM)+"\n";
  53.     output += llList2String(d,4)+"\n";
  54.     if(llSubStringIndex(llList2String(d,5),llList2String(d,6))==0){
  55.         output += "Owner: Group Owned\n";
  56.     }else{
  57.         output += "Owner: "+llList2String(d,5)+"\n";
  58.         if((key)llList2String(d,6) != NULL_KEY){
  59.             output += "Group: "+llList2String(d,6);
  60.         }
  61.     }
  62.     output += "Percent Used: "+llList2String(d2,0)+"\n";
  63.     output += "Plot size: "+llList2String(d2,1)+"\n";
  64.     output += "Plot desc: "+llList2String(d2,2);
  65.     llInstantMessage((key)llList2String(d,3),output);
  66. }
  67. key myKey;
  68.  
  69. list parcels = [];
  70.  
  71. list servers = [];
  72. default{
  73.     on_rez(integer r){
  74.         llResetScript();
  75.     }changed(integer c){
  76.         if(c & CHANGED_INVENTORY){
  77.             total_nodes = llGetInventoryNumber(10)-2;
  78.         }
  79.     }state_entry(){
  80.         total_nodes = llGetInventoryNumber(10)-2;
  81.         myKey = llGetKey();
  82.         llSetObjectDesc((string)myKey+"@lsl.secondlife.com");
  83.         llSetTimerEvent(1.0);
  84.     }timer(){
  85.         llGetNextEmail("","");
  86.         if(llGetTime() > 120){
  87.             text_update("");
  88.         }
  89.     }email(string t,string a,string s,string m,integer r){
  90.         s = llStringTrim(s,STRING_TRIM);
  91.         if(s == "PARCEL_DETAILS"){
  92.             list d = llParseString2List(m,["Object-Name: ","Region: ","Local-Position: ","Target-Id: ","Target-Action: "],[]);
  93.             mass_details_email("Target-Id: "+llList2String(d,3)+"Target-Action: PARCEL_DETAILS");
  94.         }
  95.         if(s == "PARCEL_INFO"){
  96.             parcel_parse(m);
  97.         }
  98.         if(s == "AGENTS"){
  99.             list d = llParseString2List(m,["Object-Name: ","Region: ","Local-Position: ","Target-Id: ","Target-Action: "],[]);
  100.             mass_agent_email("Target-Id: "+llList2String(d,3)+"Target-Action: AGENTS");
  101.         }
  102.         if(s == "AGENT_DUMP"){
  103.             list d = llParseString2List(m,["Object-Name: ","Region: ","Local-Position: ","Target-Id: ","Agents: "],[]);\
  104.             string output = "\n"+llStringTrim(llList2String(d,1),STRING_TRIM)+llStringTrim(llList2String(d,2),STRING_TRIM)+"\n";
  105.             output += "Agents On Parcel: \n"+llList2String(d,4);
  106.             llInstantMessage((key)llList2String(d,3),output);
  107.         }
  108.         if(s == "ACTION"){
  109.             list d = llParseString2List(m,["Object-Name: ","Region: ","Local-Position: ","Target-Id:","Target-Action:"],[]);
  110.             if(llList2String(d,4) == "MASS_BAN" || llList2String(d,4) == "MASS_ALLOW" || llList2String(d,4) == "MASS_UNSIT"){
  111.                 if(llList2String(d,4)=="MASS_BAN")llAddToLandBanList((key)llList2String(d,3),0);
  112.                 if(llList2String(d,4)=="MASS_UNBAN")llRemoveFromLandBanList((key)llList2String(d,3));
  113.                 if(llList2String(d,4)=="MASS_ALLOW")llAddToLandPassList((key)llList2String(d,3),0);
  114.                 if(llList2String(d,4)=="MASS_UNSIT")llUnSit((key)llList2String(d,3));
  115.                 if(llList2String(d,4)=="MASS_EJECT")llEjectFromLand((key)llList2String(d,3));
  116.                 if(llList2String(d,4)=="MASS_TELEPORT")llTeleportAgentHome((key)llList2String(d,3));
  117.                 if(llList2String(d,4)=="MASS_ALLOW_RESET")llResetLandPassList();
  118.                 if(llList2String(d,4)=="MASS_BAN_RESET")llResetLandBanList();
  119.                 mass_action_email("Target-Id:"+llList2String(d,3)+"Target-Action:"+llList2String(d,4));
  120.             }
  121.         }
  122.         if(s == "CONNECT"){
  123.             list d = llParseString2List(m,["Object-Name: ","Region: ","Local-Position: ","Parcel-Id:"],[]);
  124.             string parcel = llList2String(d,3);
  125.             integer point = llListFindList(servers,[a]);
  126.             if(point ==-1){
  127.                 if(llListFindList(parcels,[parcel]) == -1){
  128.                     servers += a;
  129.                     parcels += parcel;
  130.                     llSay(0,"Added new parcel.");
  131.                 }else{
  132.                     parcels = llListReplaceList(parcels,[parcel],point,point);
  133.                     llSay(0,"Updated parcel to work with new server.");
  134.                 }
  135.                 send_email(a,"RESPOND","CONNECTION_SUCCESS");
  136.             }else{
  137.                 send_email(a,"RESPOND","CONNECTION_SUCCESS");
  138.                 llSay(0,"Server Already Connected.");
  139.             }
  140.         }
  141.         text_update("++c");
  142.         llSay(0,(string)llGetFreeMemory()+"mb free.");
  143.     }
  144. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×