It's been sitting in my inventory for two years now, totally unused. I've played with the idea of selling a security device in SL, but just never did.
In light of a thread about Socialism over on SLUniverse, I've decided to release it to the wild. Here it is, totally free for anyone who wants to use/hack it.
My name is Vares Solvang, and I'm a Socialist.
CODE
//Ejection script written by Vares Solvang September 18, 2006
//This script is released for free use by anyone. Feel free to hack it, modify it, change it - whatever. It's yours to do
// with as you will.
integer ban = FALSE; // toggle for automatic banning of ejected person
integer doyou; // listen function for sub menus
key ejectem; // key of person to be ejected
string person; // person to be ejected
list alloweduserlist = []; // allowed users
integer CHANNEL = 4283; // dialog channel
list MENU_MAIN = ["ChangeUser", "List users", "Appearance", "Ban Only"]; // the main menu
list persontoeject = []; // used to parse eject command
key toucher; // key of person that touch started the menu
key user; // key of person using voice command ejection
default
{
on_rez(integer whatever)
{
llResetScript();
}
state_entry()
{
llListen(1000,"","","");
}
touch_start(integer total_number)
{
toucher = (llDetectedKey(0));
if (llListFindList(alloweduserlist, [llDetectedName(0)]) >=0 | toucher == llGetOwner())
llDialog(toucher, "What would you like to do?", MENU_MAIN, CHANNEL); // present dialog on click
llListen(CHANNEL,"","","");
}
listen(integer channel, string name, key id, string message)
{
user = id;
if (llGetSubString(message,0,4) == llToLower("eject") && id == llGetOwner() || llListFindList(alloweduserlist, [name]) >=0 && llGetSubString(message,0,4) == llToLower("eject")) // Starts scan for person to eject if speaker is authorized
{
list persontoeject = llParseString2List (message,["eject "],[]);
person = llDumpList2String(persontoeject,"");
llSensor(person,"",AGENT,96,PI);
}
else if (message == "ChangeUser")
{
state addremoveuser;
}
else if (message == "List users")
{
state listusers;
}
else if (message == "Appearance")
{
state appearance;
}
else if (message == "Ban Only")
{
state banonly;
}
}
sensor(integer total_number) // Ejection sequence
{
ejectem = llDetectedKey(0);
if (llOverMyLand(ejectem))
{
llSay(0,"Ejecting "+person+" now");
llEjectFromLand(ejectem);
state autoban;
}
else llSay(0,"I can not eject "+person+" because they are not on your land");
}
no_sensor()
{
llSay(0,person+" is not here");
}
}
state autoban // Menu to toggle automatic banning of ejected person on and off
{
state_entry()
{
list Auto_ban = ["Yes", "No"];
llListen(CHANNEL,"","","");
llSetTimerEvent(30);
llDialog(user, person+"Has been ejected, do you want to add "+person+" to the ban list?", Auto_ban, CHANNEL); // launch menu
}
listen(integer channel, string name, key id, string message)
{
if (message == "Yes" )
{
llAddToLandBanList(ejectem, 0);
llInstantMessage(user,person+" has been added to the ban list");
state default;
}
else if (message == "No" )
{
llInstantMessage(user,person+" has NOT been added to the ban list.");
state default;
}
}
timer()
{
state menureset;
}
}
state addremoveuser // Add and remove authorized users
{
state_entry()
{
list addremove = ["Add User", "RemoveUser"];
llListen(CHANNEL,"","","");
llSetTimerEvent(15);
llDialog(user, "Would you like to add an authorized user or remove one?", addremove, CHANNEL); // launch menu
}
listen(integer channel, string name, key id, string message)
{
if (message == "Add User")
{
state add;
}
else if (message == "RemoveUser")
{
state remove;
}
}
timer()
{
state menureset;
}
}
state appearance // change texture of ejector
{
state_entry()
{
list apperance = ["Visible", "Invisible"];
llListen(CHANNEL,"","","");
llSetTimerEvent(30);
llDialog(user, "Would you like your ejector to be visible or invisible?", apperance, CHANNEL); // launch menu
}
listen(integer channel, string name, key id, string message)
{
if (message == "Visible")
{
llSetAlpha(1.0, ALL_SIDES); // set entire prim 100% visible.
state default;
}
else if (message == "Invisible")
{
llSetAlpha(0.0, ALL_SIDES); // set entire prim 100% invisible.
state default;
}
}
timer()
{
state menureset;
}
}
state add // add authorized user
{
state_entry()
{
llListen(0,"","","");
llSetTimerEvent(30);
llInstantMessage(toucher,"Say the name of the person you want to authorize now, spelling and capitilization must match the persons name exactally.");
}
listen(integer channel, string name, key id, string message)
{
string addremove = message;
alloweduserlist = (alloweduserlist=[]) + alloweduserlist + addremove;
llInstantMessage(user, addremove+" has been added to the authorized user list");
//llSay(0, llDumpList2String(alloweduserlist," , "));
state default;
}
timer()
{
state menureset;
}
}
state remove // remove authorized user
{
state_entry()
{
llListen(0,"","","");
llSetTimerEvent(30);
llInstantMessage(toucher,"Say the name of the person you want to remove now, spelling and capitilization must match the persons name exactally.");
}
listen(integer channel, string name, key id, string message)
{
string addremove = message;
integer index = llListFindList( alloweduserlist, [addremove] );
if ( index = !1 )
{
llInstantMessage(user, addremove+" is not an authorized user.");
state default;
}
else
{
alloweduserlist = llDeleteSubList(alloweduserlist,index,index);
llInstantMessage(user, addremove+" has been removed to the authorized user list");
state default;
}
}
timer()
{
state menureset;
}
}
state listusers // IM's list of authorized users to toucher
{
state_entry()
{
integer l = llGetListLength(alloweduserlist);
if (l == 0)
{
llInstantMessage(user,"You are the only authorized user at this time.");
state default;
}
else
{
llInstantMessage(user, "Authorized users are "+llDumpList2String(alloweduserlist,", "));
state default;
}
}
}
state menureset
{
state_entry()
{
llInstantMessage(toucher, "Time has expired to respond, no action taken.");
state default;
}
}
state banonly // ban someone from your parcel
{
state_entry()
{
llListen(0,"","","");
llSetTimerEvent(30);
llInstantMessage(toucher,"Say the name of the person you want to ban now, spelling and capitilization must match the persons name exactally.");
}
listen(integer channel, string name, key id, string message)
{
{
llAddToLandBanList(message, 0);
llInstantMessage(toucher,message+" has been added to the ban list");
state default;
}
}
timer()
{
llInstantMessage(user," Timer has expired, no one has been added to the ban list.");
state menureset;
}
}
Notecard with basic instructions for use:
To eject someone say: /1000 eject "person's name"
For example: /1000 eject Philip Linden
The person's name must be exact. Spelling and caPiTaliZatiOn MUST match.
The ejector has a 96m range, however it will only eject people on land that YOU own. The owner of the Ejector MUST be the owner of the land. You can use it with group land, but it must be deeded to the group in order to work.
Touch Ejector for menu options, most of which are self-explanitory. There is a time out on all of the menu options to reduce lag (we don't want it listening forever for a response that will never come), so if you get a "The Ejector 3.5: Time has expired to respond, no action taken." message, simply touch the menu option again to start over.
A number of the menu options will ask you to say the name of a person in open chat. Simply say the person's full name and nothing else. It will be listeing and will assume that the next thing you say is the person's name. Whenever it asks for a name, spelling and capitalization MUST match exactly.
You can click the Apperance button to change the Ejector to invisible mode. Even though it's invisible, you will still be able to touch it and get the menu. This is useful to keep others from playing with it, but since you know right where it is you can touch it any time you like, even if you can't see it.
You can add a custom "Ejection Message" if like. This is a message that will be sent as an IM to the person being ejected. It can be any message you like (or no message at all). The default is to NOT send a message when a person is ejected.
For example: /1000 eject Philip Linden
The person's name must be exact. Spelling and caPiTaliZatiOn MUST match.
The ejector has a 96m range, however it will only eject people on land that YOU own. The owner of the Ejector MUST be the owner of the land. You can use it with group land, but it must be deeded to the group in order to work.
Touch Ejector for menu options, most of which are self-explanitory. There is a time out on all of the menu options to reduce lag (we don't want it listening forever for a response that will never come), so if you get a "The Ejector 3.5: Time has expired to respond, no action taken." message, simply touch the menu option again to start over.
A number of the menu options will ask you to say the name of a person in open chat. Simply say the person's full name and nothing else. It will be listeing and will assume that the next thing you say is the person's name. Whenever it asks for a name, spelling and capitalization MUST match exactly.
You can click the Apperance button to change the Ejector to invisible mode. Even though it's invisible, you will still be able to touch it and get the menu. This is useful to keep others from playing with it, but since you know right where it is you can touch it any time you like, even if you can't see it.
You can add a custom "Ejection Message" if like. This is a message that will be sent as an IM to the person being ejected. It can be any message you like (or no message at all). The default is to NOT send a message when a person is ejected.

