Security System
Posted: Mon Sep 12, 2022 2:31 am
Can anyone direct me to a good security system (to eject unwanted visitors)? I thought I saw some on Marketplace but cannot find any. Thanks
Documentation, discussion and support for Kitely users
https://www.kitely.com/forums/
Code: Select all
//SECURITY ORB v0.2 by Graham Mills_2
//Uses OSSL functions restricted to Owners/Estate Managers
//Use at your own risk. I suggest changing the channel values DCHAN and WCHAN for your own use.
integer DCHAN = -456;
integer WCHAN = -457;
//integer BCHAN = -458;
key ID;
key OWNER;
string STATUS;
list TP_OLD;
list TP_NEW;
vector RED = <1,0,0>;
vector GREEN = <0,1,0>;
list order_buttons(list buttons)
{
return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4)
+ llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10);
}
default
{
state_entry()
{
STATUS = "OFF";
llSetColor(RED, ALL_SIDES);
llListen(DCHAN, "", NULL_KEY, "");
llListen(WCHAN, "", NULL_KEY, "");
//llListen(BCHAN, "", NULL_KEY, "");
}
changed(integer c)
{
if (c & CHANGED_REGION_RESTART)
{
llSetTimerEvent(20.0);
}
}
touch_start(integer n)
{
OWNER = llGetOwner();
list buttons = order_buttons(["ON", "OFF", "ADD WHITE"]);//, "ADD BLACK"
llDialog(OWNER,"Status: "+STATUS, buttons, DCHAN);
llSetTimerEvent(20.0);
}
listen(integer chan, string name, key id, string msg)
{
if ((chan == DCHAN) && (id == OWNER))
{
if (msg == "ON")
{
STATUS = "ON";
llSetColor(GREEN, ALL_SIDES);
}
else if (msg == "OFF")
{
STATUS = "OFF";
llSetColor(RED, ALL_SIDES);
}
else if (msg == "ADD WHITE")
{
llTextBox(OWNER, "Avatar name for whitelist", WCHAN);
}
//else if (msg == "ADD BLACK")
//{
// llTextBox(ID, "Avatar name for blacklist", BCHAN);
//}
}
else if ((chan == WCHAN) && (id == OWNER))//add to whitelist
{
list names = llParseString2List(msg, [" "], []);//from textbox
key id2 = osAvatarName2Key(llList2String(names, 0), llList2String(names, 1)) ;
if (id2 != NULL_KEY)
{
string idname = ","+llList2String(names, 0) +" "+ llList2String(names, 1) +","+ (string)id2+",";//add uri?
integer exists = llGetInventoryType("whitelist");
if (exists == INVENTORY_NONE)//no nc so make one
{
osMakeNotecard("whitelist", [idname]);
}
else //nc present, add new id if unique
{
//read nc, add name to list, write nc
string avies = osGetNotecard("whitelist");
if (llSubStringIndex(avies, ","+id2+",") > -1)
{
llOwnerSay("Avatar ID already in whitelist");
}
else
{
llRemoveInventory("whitelist");
avies = avies + idname;
list temp = llParseString2List(avies, ["\n"], []);
osMakeNotecard("whitelist", llDumpList2String(temp, "\n"));
llOwnerSay("Avatar added to whitelist");
llOwnerSay((string)osGetNumberOfNotecardLines("whitelist") + " avatars on whitelist");
}
}
}
else
{
llOwnerSay("Avatar not recognised");// not in kitely db
}
}
}
timer()
{
integer exists = llGetInventoryType("whitelist");
if ((exists != INVENTORY_NONE) && (llGetColor(0) == GREEN))
{
string white = osGetNotecard("whitelist");
list agents = llGetAgentList(AGENT_LIST_PARCEL, []);
integer i;
key id;
for(i = 0; i < llGetListLength(agents); i++)
{
id = llList2Key(agents, i);
if ((llSubStringIndex(white, ","+id+",") > -1) || (id == OWNER))
{
//On whitelist
}
else
{
TP_NEW = TP_NEW + [id];
if (llListFindList(TP_OLD, id) > -1)
{
llInstantMessage(id, "You are being expelled");
}
else
{
llInstantMessage(id, "Access to this parcel is RESTRICTED. Please leave immediately or you will be expelled in 20 sec.");
}
}
}
list TEMP;
for(i = 0; i < llGetListLength(TP_NEW); i++)
{
id = llList2Key(agents, i);
if (llListFindList(TP_OLD, [id]) > -1)//was present 20 sec previously
{
osTeleportAgent(id, "Kitely Welcome Center", <128, 128, 25>, ZERO_VECTOR);//expel
}
else
{
TEMP = TEMP + [id];
}
}
TP_OLD = TEMP;
TP_NEW = [];
}
}
}
Sorry to hear that. What kind of errors are you getting?Veritas McMaster wrote: ↑Sun Sep 25, 2022 5:43 pmthank you, I get lots of script errors. I took it to a place I have owner's rights but still get errors. I'm going to work through all you said, step by step by rinse and repeat steps.... see if I can get it going. So appreciated!