// // _|_| // _| _| _|_|_|_| _|_| _|_|_| _|_| // _| _| _| _| _| _| _| _|_|_|_| // _| _| _| _| _| _| _| _| // _|_| _|_|_|_| _|_| _| _| _|_|_| // MiniVerse // // Common sense is not included with this software and must be supplied by end user. // Read the script first, ensure the necessary OSSL functions are enabled if needed. // A Friendlier CHILD GATE // Configuration//////////////////////////////////// // Note: only flagged avatars see the following warning. string warning = "\nAll tenants and visitors must be over the age of 21.\n \nIn compliance with with LOCAL LAWS, Child Avatars are NEVER allowed in this simulator.\n \nChange your appearance before exploring or MOVE ON.\n \nADULT HUMAN AVATARS ONLY."; string place = "ATRIUS"; //name your region string staffMsg = " was removed for using a child avatar."; float sizeLimit = 1.6; //height limit of avatars in region, in arbitrary units -- 1.6 is the shortest Ruth can get. float scanInterval = 30;//the interval of scanning in seconds integer scope = AGENT_LIST_REGION;//either AGENT_LIST_PARCEL or AGENT_LIST_REGION string method = "tphome"; // change to 'eject' if protecting a parcel. You are done. //If 'tphome' selected, see values at the end of the 'timer()' section. /////////////////////////////////////////////////// integer on = FALSE; string forbiddenCreatorFile = "cav_forbiddencreators"; string forbiddenAttachmentFile = "cav_forbiddenattachmentnames"; string forbiddenWordFile = "cav_forbiddenwords"; string sizeLimitFile = "cav_heightlimit"; key sizeLimitReq; key owner; integer ready = FALSE; //data lists list forbiddenWords = []; list forbiddenAttNames = []; list forbiddenCreators = []; //flags integer gotWords = FALSE; integer gotNames = FALSE; integer gotCreators = FALSE; integer gotSizeLimit = FALSE; amIready() { if(gotWords == TRUE && gotNames == TRUE && gotCreators == TRUE && gotSizeLimit == TRUE) { if(ready == FALSE) { llOwnerSay("ChildGATE OFF."); } ready = TRUE; llSetText("OFF",<1,0,0>,1); } } integer scanPersonForBadStuff(key avi) { list attachments = llGetAttachedList(avi); integer attLen = llGetListLength(attachments); integer iAtt = 0; do { key att = (key)llList2String(attachments,iAtt); string attName = llToLower(llKey2Name(att)); if(llGetListLength(forbiddenCreators) > 0) { key objCreator = llList2Key(llGetObjectDetails(att,[OBJECT_CREATOR]),0); if(llListFindList(forbiddenCreators,[objCreator]) != -1) { //creator is forbidden return TRUE; } } if(llGetListLength(forbiddenAttNames) > 0) { //Creator not forbidden, check attachment names list if(llListFindList(forbiddenAttNames,[attName]) != -1) { //attachment name is forbidden return TRUE; } integer len = llGetListLength(forbiddenAttNames); integer i = 0; do { string fName = llList2String(forbiddenAttNames,i); list temp = llParseString2List(attName,[],[fName]); if(llListFindList(temp,[fName]) != -1) { return TRUE; } } while(++i 0) { list words = llParseString2List(attName,[" "],[]); integer wLen = llGetListLength(words); integer iWord = 0; do { string word = llList2String(words,iWord); if(llListFindList(forbiddenWords,[word]) != -1) { return TRUE; } } while(++iWord < wLen); } vector size = llGetAgentSize(avi); if(size.z < sizeLimit && sizeLimit > 0) { return TRUE; } } while(++iAtt < attLen); //llOwnerSay("false"); return FALSE; } string who(key id) { return "secondlife:///app/agent/" + (string)id + "/inspect"; } //requests+stuff key creatorFileReq; integer creatorFileLine = 0; key attachmentFileReq; integer attachmentFileLine = 0; key wordFileReq; integer wordFileLine = 0; key creatorKeyReq; integer creatorNameIndex = 0; integer creatorNameLen; list creatorNonKeys = []; //////////////////////////////////////////////////////////////////////////// //where the fun starts //////////////////////////////////////////////////////////////////////////// default { listen(integer channel, string name, key id, string txt) { if(llGetOwnerKey(id) == owner) { txt = llToLower(txt); if(txt == "on") { on = TRUE; llSetTimerEvent(scanInterval); llOwnerSay("Turning ON."); } else if(txt == "off") { on = FALSE; llSetTimerEvent(0); llOwnerSay("Turning OFF."); } } } state_entry() { owner = llGetOwner(); llListen(40,"",NULL_KEY,""); if(llGetInventoryType(forbiddenCreatorFile) == INVENTORY_NOTECARD) { creatorFileReq = llGetNotecardLine(forbiddenCreatorFile,creatorFileLine); } else { llOwnerSay("Notecard \""+forbiddenCreatorFile+"\" missing."); } if(llGetInventoryType(forbiddenAttachmentFile) == INVENTORY_NOTECARD) { attachmentFileReq = llGetNotecardLine(forbiddenAttachmentFile,attachmentFileLine); } else { llOwnerSay("Notecard \""+forbiddenAttachmentFile+"\" missing."); } if(llGetInventoryType(forbiddenWordFile) == INVENTORY_NOTECARD) { wordFileReq = llGetNotecardLine(forbiddenWordFile,wordFileLine); } else { llOwnerSay("Notecard \""+forbiddenWordFile+"\" missing."); } if(llGetInventoryType(sizeLimitFile) == INVENTORY_NOTECARD) { sizeLimitReq = llGetNotecardLine(sizeLimitFile,0); } else { llOwnerSay("Notecard \""+sizeLimitFile+"\" missing."); } } dataserver(key req,string data) { integer displayScanning = FALSE; if(req == creatorFileReq) { displayScanning = TRUE; if(data == EOF) { //stop, check amount of non-keys creatorNameLen = llGetListLength(creatorNonKeys); if(creatorNameLen > 0) { llOwnerSay("Verifying "+(string)creatorNameLen+" names of forbidden creators..."); } else { llOwnerSay("Forbidden creators parsed."); gotCreators = TRUE; amIready(); } return; } else if((key)data) { llOwnerSay("Verified "+who(data)); forbiddenCreators += [(key)data]; } else { creatorNonKeys += [data]; } creatorFileLine += 1; creatorFileReq = llGetNotecardLine(forbiddenCreatorFile,creatorFileLine); } else if(req == attachmentFileReq) { displayScanning = TRUE; if(data == EOF) { llOwnerSay("Forbidden attachment names parsed."); gotNames = TRUE; amIready(); return; } else { forbiddenAttNames += [llToLower(data)]; } attachmentFileLine += 1; attachmentFileReq = llGetNotecardLine(forbiddenAttachmentFile,attachmentFileLine); } else if(req == wordFileReq) { displayScanning = TRUE; if(data == EOF) { llOwnerSay("Forbidden words parsed."); gotWords = TRUE; amIready(); return; } else { forbiddenWords += [llToLower(data)]; } wordFileLine += 1; wordFileReq = llGetNotecardLine(forbiddenWordFile,wordFileLine); } else if(req == creatorKeyReq) { displayScanning = TRUE; if((key)data) { llOwnerSay("Verified "+who((key)data)); forbiddenCreators += [(key)data]; } creatorNameIndex += 1; if(creatorNameIndex < creatorNameLen) { } else { llOwnerSay("All creator names verified."); gotCreators = TRUE; amIready(); creatorNonKeys = []; } } else if(req == sizeLimitReq) { displayScanning = TRUE; sizeLimit = (float)data; if(sizeLimit <= 0) { sizeLimit = 0; llOwnerSay("Size scanninng disabled."); } else { llOwnerSay("Size scanning set to "+data+"."); } gotSizeLimit = TRUE; amIready(); } if(displayScanning ==TRUE && ready ==FALSE) { llSetText("...scanning...",,1); } } timer() { list ppl = llGetAgentList(scope,[]); integer len = llGetListLength(ppl); integer i = 0; vector pos = llGetPos(); do { key person = llList2Key(ppl,i); if(person) { if(scanPersonForBadStuff(person) == TRUE) { string parcelName = llList2String(llGetParcelDetails(pos,[PARCEL_DETAILS_NAME]),0); llDialog(person, warning,["OK"],-1337); if(method == "eject") { //eject child from your parcel. llEjectFromLand(person); } else if(method == "tphome") { //Uncomment next line to send child home. //llTeleportAgentHome(person); llOwnerSay("CGate Killed Avatar in " + llGetRegionName() ); if (person == llDetectedKey(0)); list lName = llParseString2List(osKey2Name(person), [" "],[]); string FirstName = llList2String(lName,0); string LastName = llList2String(lName,1); //Sometimes 'send home' does not work - The next choice is agressive. //Change the first 2 characters lower case after uncommenting the next line. //OSKickAvatar(FirstName,LastName,"Sorry, child Avatars not allowed."); } } } } while(++i < len); } touch_start(integer num) { key owner = llGetOwner(); if (llDetectedKey(0) != owner) return; if (owner); { if(on) { on = FALSE; llSetTimerEvent(0); llOwnerSay("Turning OFF."); llSetText("OFF",<1,0,0>,1); } else { on = TRUE; llSetTimerEvent(scanInterval); llOwnerSay("Turning ON."); llSetText("",<0,1,0>,1); } } } changed(integer change) { if(change & (CHANGED_INVENTORY | CHANGED_OWNER)) { llResetScript(); } } }