Security System

Post requests for goods or services
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1141 times

Re: Security System

Post by Graham Mills »

Apologies, I'd naively assumed that this was for use on Kitely and that you were an owner. I personally have negligible knowledge of land management either on Kitely or elsewhere so I am not the best person to offer advice.

The OSSL scope for Kitely is documented here:

https://www.kitely.com/virtual-world-ne ... functions/

At present the script uses some OSSL scripting functions limited to Owners/Estate Managers on Kitely and some that could be readily replaced with LSL equivalents:

osName2Key -- I suspect this could be replaced with llName2Key

osTeleportAgent -- I'm not sure how that's managed in SL security orbs as I think llTeleportAgent requires explicit avatar permission. Perhaps they use llTeleportAgentHome. Another option would be to use llEjectFromLand which moves the avatar to the edge of the parcel. Details of the (similar) setup for each are here:

https://wiki.secondlife.com/wiki/LlTeleportAgentHome
https://wiki.secondlife.com/wiki/LlEjectFromLand

osMakeNotecard -- Unfortunately on Kitely the ability to make a notecard via OSSL is restricted to Owners/Land Managers and as far as I know there is no equivalent in SL. The other security scripts I flagged previously presumably use some alternative data storage mechanism.

osGetNumberOfNotecardLines -- not sure whether that's in the current version but it's also limited to Owners/Land Managers.

Perhaps one of the more proficient scripters on the Forum will pick up on your idea and develop a more portable product for the Market.
These users thanked the author Graham Mills for the post:
Veritas McMaster
User avatar
Veritas McMaster
Posts: 50
Joined: Wed Feb 23, 2022 12:37 pm
Has thanked: 147 times
Been thanked: 67 times
Contact:

Re: Security System

Post by Veritas McMaster »

Thanks! Will work through all this, too. I do want it for Kitely, my home grid but also for other places. Desmond is willing to make me an estate manager, which may help with some other scripted items we've been trying to use (like Shelenn's great Visitor's Board from OSFest).

I wish someone would make a security system that is exportable and put it on Kitely Market. You have given what is needed, Graham. I'll keep bumbling through, learning as I go, and I can't thank you enough.
These users thanked the author Veritas McMaster for the post (total 2):
Graham MillsChris Namaste
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1141 times

Re: Security System

Post by Graham Mills »

I've modified the menu to offer two ways to add avatars to the whitelist:
ADD TEXT uses the textbox as previously
ADD TOUCH is new. It turns the orb/prim blue for 20 sec during which time an avatar touching the orb has its name and key recorded in the whitelist. After 20 sec the orb reverts to its previous colour, either red (off) or green (on). This should allow hypergrid users to be added.

I haven't tested this and it could probably do with some prompts but it should work.

I may modify the script for my own purposes but otherwise don't intend making any further modifications available at this time.

[UPDATED 28/09/22: changed llOwnerSay to open chat; added hovertext to denote ADD BY TOUCH active.]

Code: Select all

//SECURITY ORB v0.31 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>;
vector BLUE = <0, 0, 1>;
vector PREVCOLOR;

list order_buttons(list buttons)
{
    return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4)
         + llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10);
}

addToWhitelist(list names, key id2)
{
    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)
            {
                llSay(0, "Avatar ID already in whitelist");
            }
            else
            {                
                llRemoveInventory("whitelist");
                avies = avies + idname;
                list temp = llParseString2List(avies, ["\n"], []);
                osMakeNotecard("whitelist", llDumpList2String(temp, "\n"));
                llSay(0,"Avatar added to whitelist");
                llSay(0 ,(string)(osGetNumberOfNotecardLines("whitelist")-1) + " avatars on whitelist");
            }
        }
    }
}

default
{
    state_entry()
    { 
        STATUS = "OFF";
        llSetColor(RED, ALL_SIDES);
        llListen(DCHAN, "", NULL_KEY, "");
        llListen(WCHAN, "", NULL_KEY, "");
    }
    
    changed(integer c)
    {
        if (c & CHANGED_REGION_RESTART)
        {
            llSetTimerEvent(20.0);
        }
    }
    
    touch_start(integer n)
    {
        OWNER = llGetOwner();
        key touchkey = llDetectedKey(0);
        if ((touchkey != OWNER) && (llGetColor(0) == BLUE))//add to whitelist by touch
        {
            string name = llDetectedName(0);
            llSay(0, "Added to whitelist: "+name + " " + (string)touchkey);
            list names = llParseString2List(name, [" "], []);
            key id2 = touchkey;
            addToWhitelist(names, id2); 
        }
        else
        { 
            list buttons = order_buttons(["ON", "OFF", "ADD TEXT", "ADD TOUCH"]);//, "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 TEXT")
            {
                llTextBox(OWNER, "Avatar name for whitelist", WCHAN);
            }
            else if (msg == "ADD TOUCH")
            {
                PREVCOLOR = llGetColor(0);
                llSetText("Touch prim to add \n name to whitelist", <1,1,1>, 1);
                llSetColor(BLUE, ALL_SIDES);
            }
        }
        else if ((chan == WCHAN)  && (id == OWNER))//add to whitelist from textbox
        {
            list names = llParseString2List(msg, [" "], []);
            key id2 = osAvatarName2Key(llList2String(names, 0), llList2String(names, 1)) ;
            if (id2 != NULL_KEY)
            {
               addToWhitelist(names, id2);
            }
            else 
            {
                llSay(0, "Avatar not recognised");// not in kitely db
            }
        }
    }
    
    timer()
    {
        if (llGetColor(0) == BLUE)
        {
            llSetText("", ZERO_VECTOR, 0);
            llSetColor(PREVCOLOR, ALL_SIDES);
        }
        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++)//screen agents vs whitelist
            {
                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 = [];
        }
    }
}
These users thanked the author Graham Mills for the post (total 3):
Veritas McMasterIlan TochnerChris Namaste
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1141 times

Re: Security System

Post by Graham Mills »

Shocked and saddened to hear of Veritas's passing via group notices. Always such a positive influence in everything she did.
These users thanked the author Graham Mills for the post (total 4):
Ilan TochnerChris NamasteShandon LoringTonia Kara 3
User avatar
Chris Namaste
Posts: 350
Joined: Wed Jan 27, 2016 6:55 pm
Has thanked: 1527 times
Been thanked: 323 times

Re: Security System

Post by Chris Namaste »

it truelly is :'(
we didnt know each other in person,all i read from her here in forum was kind & friendly,
thanks to Desmond to let us know the sad 'news',
and how brave and loving she was,

she is-was-always will be a caringloving person,she showed that in many ways,

blessings & support to her closed ones & family+♥
These users thanked the author Chris Namaste for the post (total 2):
Graham MillsTonia Kara 3
Chris CreationZ url kitely market : https://www.kitely.com/market?store=914 ... &sort=date
Because ultimately we are not the avatars we create. We are not the pictures on the film stock. We are the light that shines through.Jim Carrey
Post Reply