Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Phantom Door ?

Riger Oluja
Registered User
Join date: 25 Nov 2006
Posts: 2
12-16-2006 00:19
Hello all,

This is my first post so go easy;

I am building a skybox as a gift for a friend, it has an irregular shape. What I'd like to do its make one of the panels (single Prim) touchable to switch between a normal (hard) panel and a see-thru phatom panel to act as a door.

Later I'd like to impliment some security measures as well.

Am I barking up the wrong prim or is this reasonable?

Regards in advance
Wildthrust Mathilde
Registered User
Join date: 22 Nov 2006
Posts: 49
12-16-2006 07:13
Not only reasonable but there are many Phantom Security Doors floating around. I have one I wrote myself. It only requires 1 prim ( the door ). I created a texture that is 1024x1024 of sparkles and used an animation script that makes it look kinda like a force field (still need to work on that). But it makes it so the "owner" always has access, but can also add or remove people from an access list.

The resulting effect is if I try to walk in, and someone behind me tries to walk in, I will walk right through, but they will hit a barrier. The one flaw is if I am in the process of walking through, theoreticly someone could pass through at the same time.

For an seperate prim to control it would simply be a matter of putting the "access" part of the code in the seperate prim, and put the phantom code in the other with a "listener" set to recieve commands shouted from the controler.

I have something simmiler to that with my elevator script. The elevator script was a freebie that simply listened for any recognizable command to be said in open chat like "goto floor 1". So I changed the channel number from 0 to another channel. Then I created a 3 button device and coded each "button" that on touch it should shout the appropiate command on the elevator's channel.

I use shout instead of say because it covers 100m instead of 30m that say covers and my building is 60m tall.

The other option is if you have to door and control linked together you can send a link message to the door from the control.

Ill go ahead and be dumb, as Phantom Doors ive seen usualy got for around 1K$L, and just give my Phantom Door code in this post. Though you will have to figure how to devide the code between the door and the controller yourself.

// --------------------------------
list SecurityList = [];
key owner;
string owner_name;
list cmdlist = [];
integer commandchannel = 4; // Used mainly for testing, manualy sets the channel to monitor for commands
// Returns the main command from the message
string GetCommand()
{
string cmdval = llList2String(cmdlist, 0);
cmdval = llToLower(cmdval);
return cmdval;
}

// Returns any sub-command from the message
string GetSubCommand()
{
string firstname = llList2String(cmdlist, 1);
string lastname = llList2String(cmdlist, 2);
//cmdval = llToLower(cmdval);
string cmdval = firstname + " " + lastname;
return cmdval;
}


default
{
on_rez(integer start_param) {
// every time we're rezzed, reset the script
// this ensures that if we're transferred to a new owner, we're listening to them and not still to the previous one
llResetScript();
}

state_entry()
{

owner = llGetOwner();
owner_name = llKey2Name( owner );
llListen( commandchannel, "", "", "";); // Adds a listener to the manualy set command channel
//SecurityList = [owner_name];
llOwnerSay("You are now the admisitrator " + owner_name + ".";);
llSetPrimitiveParams([PRIM_PHANTOM, FALSE]);
}

collision_start(integer number)
{
string collider_name = llDetectedName( 0 );
integer permit = llListFindList( SecurityList, [collider_name] );
if ( permit != -1 || collider_name == owner_name)
{
llSetPrimitiveParams([PRIM_PHANTOM, TRUE]);
llOwnerSay("Phantom Door Access Allowed: " + collider_name);
//llSay(0, "Welcome " + collider_name + ", Entry Allowed";);
} else {
llSetPrimitiveParams([PRIM_PHANTOM, FALSE]);
llOwnerSay("Phantom Door Access NOT Allowed: " + collider_name);
//llSay(0, "You are not on the security list. Entry Not Allowed.";);
}
}

collision_end(integer number)
{
llSetPrimitiveParams([PRIM_PHANTOM, FALSE]);
//llOwnerSay("Door Secured";);
}

// Processes all listen events (ch: Channel, name: Owner Name, key: Owner's Unique ID, msg: Message that was recieved
listen(integer ch, string name, key id, string msg)
{
if(id == llGetOwner()) // Was the command issued by the owner?
{
cmdlist = llParseString2List(msg,[" "],[]); // convert the message into a list
string cmd = GetCommand(); // Get the command issued
string cmdname = GetSubCommand(); // Get any sub-command issued
if ( cmd == "add";)
{
SecurityList += [cmdname];
llOwnerSay(name + " has been added to the Access List.";);
}
else if (cmd == "remove";)
{
integer foundat = llListFindList( SecurityList, [cmdname] );
if ( foundat != -1 )
{
SecurityList = llDeleteSubList( SecurityList, foundat, foundat);
llOwnerSay(name + " has been added to the security list.";);
} else {
llOwnerSay(name + " could not be found on the security list.";);
}
}
else
{
llOwnerSay("Command Not Recognized";);
}
}
}
}
Shirley Marquez
Ethical SLut
Join date: 28 Oct 2005
Posts: 788
12-18-2006 13:32
From: Wildthrust Mathilde

For an seperate prim to control it would simply be a matter of putting the "access" part of the code in the seperate prim, and put the phantom code in the other with a "listener" set to recieve commands shouted from the controler.


Another way would be to link the controller and the door and use link messages. Lower lag, but it might not be practical, depending on the design of the build.
Ace Albion
Registered User
Join date: 21 Oct 2005
Posts: 866
12-19-2006 06:44
If it can be done with the shapes used, you can also consider changing the prim size, hollow, cut or dimple as applicable, to make a hole to get through.
_____________________
Ace's Spaces! at Deco (147, 148, 24)
ace.5pointstudio.com
Wildthrust Mathilde
Registered User
Join date: 22 Nov 2006
Posts: 49
12-21-2006 06:56
Yup, you could use it as a linked item and just use the option to select items inside a linked item when you needed to position the controler without moving the phantom door. I have actualy expanded my phantom door script alot more now since I posted it. And still plan more features, inc using a controler, and possibly working it so the script can be used to control normal doors as well.

I think im basicly working twords just a full blow security access script that can operate both indepentantly or provide communications that other scripts can connect to. That way it basicly takes care of all the security operations, but can work for whatever people want.

Right now im happy cause I have it coded so I can optionaly allow or disallow people bringing there vehicles in. Ive seen far too many planes, cars, and a few motorcycles abandoned INSIDE a store they don't belong to. Esp that batmobile. This script can prevent that. Sill have plans that should just about double the functionality from even what it is now :)