Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: SN_Elevator_II

Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
05-03-2006 19:35
Single Neat Elevator_II

This is another approach to coordinate elevator positions. It is a dock and a pod type elevator. You set docks where you want and the pod moves among them. I just wanted to use llRemoteLoadScriptPin to call the pod so that it could move within the whole sim. The height limit is up to 768m.

***Nov 2006***
I noticed that Keknehv Psaltery had invented his WarpPos function but I didn't have a chance to try. I've just been able to give it a try and found it be so great that I don't have to wait until the Pod comes.
I added WarpPos at calling the Pod section. Thanks, Keknehv.
**************

:::USAGE:::
1. Rez a prim and put "ElevatorDock" and "Messenger" scripts into it. The prim changes its shape automatically. You can place it where you want.
2. Rez a prim and put "ElevatorPod" and "Messenger" scripts into it. The prim changes its shape automatically. You don't have to care about the position for now.
3. Create a notecard in your inventory.
4. Left click and hold the mouse button on the yellow Pod in a few seconds. It says, "OK, Plz copy the following information to the first line of the notecard." And then, says a string of hexadecimal numbers, key. Copy the key and paste it on the first line on your notecard.
5. Left click and hold the mouse button on the green Dock in a few seconds. It asks, "What do you call this floor?" Say something you want to call it, such as "1F". If you say, "1F", it says, "OK, Plz copy the following information to the notecard." And then, says, "1F@<some vector value>". Copy the string to the second line on your notecard. And make sure that the dock's name changes to "1F".
6. Go to another place where you want to set the next floor. Then create the ElevatorDock again after the same method. Then copy the information, such as "2F@<some vector value>" to the third line on your notecard.
7. Go to the other place if you need, do the same thing and write the fourth line on your notecard.
8. Return to the first place. Put the notecard in both the dock and the pod. You have to reset just "ElevatorPod" script after putting the notecard into it. You don't have to reset "ElevatorDock".
9. Left click the green dock. The pod should come and dock. And the dialog box appears. Select the "2F" or what you named, and right click on the yellow pod. Select "Get on" on the pie menu.
10. You should go to the second place with the pod. Then don't forget to put the notecard into the dock.
11. Left click the dock and go to the third place. And put the notecard into the dock. Then, setting up is completed.

Touch the dock and select the floor. You can get on the pod to go there.

Note, don't put down any blank line on the notecard even if it is the last line.
If you want to change its color, comment out Transform(); line under the state_entry() and try it. I don't recommend that you change even its shape because it becomes a bit of a task.

Known issues:
1. I couldn't use changed_inventory event in the pod because it was affected by llRemoteLoadScriptPin.
2. I tried to increase the speed by changing to physics halfway but failed.
3. I tried to control camera. But it was affected just while you were getting on it.

ElevatorDock
CODE
// SN_Elevator_II was made by Seagel Neville as public domain, Apr 2006
// Put this script into a prim.

string CardName;
integer handle;
integer CHANNEL;
integer is_touching;
integer gLine;
integer ThisFloorNum;
integer is_working;
vector AvSize;
key PodKey;
key gQueryID;
key av;
list FloorList;
list FloorPosList;
list ShowFloorList;
list ShowFloorPosList;


Transform()
{
llSetPrimitiveParams([
PRIM_TYPE, PRIM_TYPE_TUBE, 0,
<0.0, 1.0, 0.0>, 95.0, <0.0, 0.0, 0.0>, <0.05, 0.12, 0.0>,
<0.0, 0.0, 0.0>, <0.45, 1.0, 0.0>, <0.0, 0.0, 0.0>, 1.0, 0.0, 0.0,
PRIM_ROTATION, <0.0, 0.7, 0, 0.7>, PRIM_SIZE, <2.0, 2.0, 2.0>,
PRIM_MATERIAL, PRIM_MATERIAL_METAL,
PRIM_COLOR, ALL_SIDES, <0.0, 0.25, 0>, 1,
PRIM_TEXTURE, ALL_SIDES, "5748decc-f629-461c-9a36-a35a221fe21f", <1,1,0>, <1,1,0>, 0
]);
}

Listen(integer SW) //SW is TRUE or FALSE.
{
handle = llListen(CHANNEL, "", "", "");
llListenControl(handle, SW);
if(SW == FALSE)
{
llSetTimerEvent(0);
is_touching = 0;
is_working = FALSE;
}
else
{
llSetTimerEvent(30);
}
}

GetNotecardInfo()
{
FloorList = [];
FloorPosList = [];
gLine = 0;
CardName = llGetInventoryName(INVENTORY_NOTECARD, 0);
gQueryID = llGetNotecardLine(CardName, gLine);
}

default
{
state_entry()
{
Listen(FALSE);
llSetObjectName("ElevatorDock");
Transform();
}
changed(integer change)
{
if((change & CHANGED_INVENTORY) && is_working == FALSE)
{
GetNotecardInfo();
}
}
touch(integer total_number)
{
if(llDetectedKey(0) == llGetOwner())
{
is_touching++;
if(is_touching == 20)
{
CHANNEL = 0;
Listen(TRUE);
llOwnerSay("What do you call this floor?");
}
}
}
touch_end(integer total_number)
{
av = llDetectedKey(0);
if(is_touching < 20)
{
if(ShowFloorList != [])
{
is_working = TRUE;
AvSize = llGetAgentSize(av);
CHANNEL = -123456789;
Listen(TRUE);
llWhisper(0, "Wait a minute.");
llRemoteLoadScriptPin(PodKey, "Messenger", 10, TRUE, ThisFloorNum);
}
else
{
llOwnerSay("Plz set up your elevator first");
}
}
}
listen(integer channel, string name, key id, string message)
{
if(channel == 0)
{
if(llGetOwnerKey(id) == llGetOwner())
{
llSetObjectName(message);
llOwnerSay("OK, Plz copy the following information to the notecard.");
llOwnerSay(message + "@" + (string)llGetPos());
Listen(FALSE);
if(llGetInventoryNumber(INVENTORY_NOTECARD) > 0)
{
GetNotecardInfo();
}
}
}
else if(message == "reached")
{
llSetTimerEvent(0);
llSetTimerEvent(10);
llSay(CHANNEL, "AvSize" + (string)AvSize);
llWhisper(0, "Now, plz select the floor and get on the pod.");
llDialog(av, "To what floor do you go?", ShowFloorList, CHANNEL);
Listen(FALSE);
}
}
timer()
{
Listen(FALSE);
llWhisper(0, "The elevator might not currently be available. Plz call again.");
}
dataserver(key query_id, string data)
{
if(query_id == gQueryID)
{
if(data != EOF)
{
integer Analyzed = llSubStringIndex(data, "@");
if(Analyzed == -1)
{
PodKey = (key)data;
}
else if(Analyzed > -1)
{
FloorList += [llGetSubString(data, 0, Analyzed - 1)];
FloorPosList += [llGetSubString(data, Analyzed + 1, -1)];
}
gLine++;
gQueryID = llGetNotecardLine(CardName, gLine);
}
else
{
ThisFloorNum = llListFindList(FloorList, [llGetObjectName()]);
ShowFloorList = llDeleteSubList(FloorList, ThisFloorNum, ThisFloorNum);
ShowFloorPosList = llDeleteSubList(FloorPosList, ThisFloorNum, ThisFloorNum);
}
}
}
}

ElevatorPod
CODE
// SN_Elevator_II was made by Seagel Neville as public domain, Apr 2006 
// Put this script into a prim.
// Added WarpPos (by Keknehv Psaltery) feature, Nov 2006

string CardName;
integer handle;
integer is_touching;
integer FloorSelection;
integer gLine;
key gQueryID;
key av;
vector MoveTargetPos;
vector tempTargetPos;
vector AvSize;
list FloorList;
list FloorPosList;


Transform()
{
llSetPrimitiveParams([
PRIM_TYPE, PRIM_TYPE_CYLINDER, 0,
<0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>,
PRIM_SIZE, <1.5, 1.5, 0.1>,
PRIM_MATERIAL, PRIM_MATERIAL_GLASS,
PRIM_COLOR, ALL_SIDES, <1, 0.75, 0>, 0.8,
PRIM_TEXTURE, ALL_SIDES, "5748decc-f629-461c-9a36-a35a221fe21f", <1,1,0>, <1,1,0>, 0
]);
}

GetNotecardInfo()
{
FloorList = [];
FloorPosList = [];
gLine = 0;
CardName = llGetInventoryName(INVENTORY_NOTECARD, 0);
gQueryID = llGetNotecardLine(CardName, gLine);
}

Listen(integer SW) //SW is TRUE or FALSE.
{
handle = llListen(-123456789, "", "", "");
llListenControl(handle, SW);
if(SW == FALSE)
{
llSetTimerEvent(0);
}
else
{
llSetTimerEvent(60);
}
}

StopSitAnim()
{
llStopAnimation("sit_generic");
llStopAnimation("sit");
llStartAnimation("impatient");
}

CheckMove()
{
if(FloorSelection && llAvatarOnSitTarget() != NULL_KEY)
{
ElevatorMove(MoveTargetPos);
llUnSit(av);
Listen(FALSE);
FloorSelection = FALSE;
}
}

GeneralMove(vector Pos)
{
tempTargetPos = Pos + <0.0, 0.0, 0.5>;
while(llVecDist(llGetPos(), tempTargetPos) != 0)
{
llSetPos(tempTargetPos);
}
}

LandingMove(vector Pos)
{
llSay(-123456789, "reached");
{
while(llVecDist(llGetPos(), Pos) != 0)
{
llSetPos(Pos);
}
llUnSit(av);
}
}

ElevatorMove(vector Pos)
{
if(Pos != ZERO_VECTOR)
{
GeneralMove(Pos);
LandingMove(Pos);
}
}

ElevatorWarp(vector Pos)
{
if(Pos != ZERO_VECTOR) //Fixed a bug
{
tempTargetPos = Pos + <0.0, 0.0, 0.5>;
warpPos(tempTargetPos);
LandingMove(Pos);
}
}

warpPos(vector destpos )
{ //R&D by Keknehv Psaltery, 05/25/2006
//with a little pokeing by Strife, and a bit more
//some more munging by Talarus Luan
//Final cleanup by Keknehv Psaltery
// Compute the number of jumps necessary
integer jumps = (integer)(llVecDist(destpos, llGetPos()) / 10.0) + 1;
// Try and avoid stack/heap collisions
if (jumps > 100 )
jumps = 100; // 1km should be plenty
list rules = [ PRIM_POSITION, destpos ]; //The start for the rules list
integer count = 1;
while ( ( count = count << 1 ) < jumps)
rules = (rules=[]) + rules + rules; //should tighten memory use.
llSetPrimitiveParams( rules + llList2List( rules, (count - jumps) << 1, count) );
}

default
{
state_entry()
{
llSetStatus(STATUS_PHYSICS | STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z, FALSE);
llSetObjectName("ElevatorPod");
llSetSitText("Get on");
Transform();
if(llGetInventoryNumber(INVENTORY_NOTECARD) > 0)
{
GetNotecardInfo();
}
Listen(FALSE);

}
changed(integer change)
{
if(change & CHANGED_LINK)
{
av = llAvatarOnSitTarget();
if(av != NULL_KEY)
{
llRequestPermissions(av, PERMISSION_TRIGGER_ANIMATION);
}
}
}
run_time_permissions(integer perm)
{
if(perm & PERMISSION_TRIGGER_ANIMATION)
{
llSetCameraEyeOffset(<3, 0, 2.5>);
llSetCameraAtOffset(<-5, 0, -0.5>);
StopSitAnim();
CheckMove();
}
}
touch(integer total_number)
{
if(llDetectedKey(0) == llGetOwner())
{
is_touching++;
if(is_touching == 20)
{
llOwnerSay("OK, Plz copy the following information to the first line of the notecard.");
llOwnerSay((string)llGetKey());
is_touching = 0;
}
}
}
listen(integer channel, string name, key id, string message)
{
if(llGetSubString(message, 0, 5) == "AvSize")
{
AvSize = (vector)llGetSubString(message, 6, -1);
llSitTarget(<0, 0, (AvSize.z / 2)>, ZERO_ROTATION);
}
else
{
MoveTargetPos = (vector)llList2String(FloorPosList, llListFindList(FloorList, [message]));
Listen(FALSE);
FloorSelection = TRUE;
CheckMove();
}
}
link_message(integer sender_num, integer num, string str, key id)
{
MoveTargetPos = (vector)llList2String(FloorPosList, num);
ElevatorWarp(MoveTargetPos);
Listen(TRUE);
}
dataserver(key query_id, string data)
{
if(query_id == gQueryID)
{
if (data != EOF)
{
integer Analyzed = llSubStringIndex(data, "@");
if(Analyzed > -1)
{
FloorList += [llGetSubString(data, 0, Analyzed - 1)];
FloorPosList += [llGetSubString(data, Analyzed + 1, -1)];
}
gLine++;
gQueryID = llGetNotecardLine(CardName, gLine);
}
}
}
timer()
{
Listen(FALSE);
llWhisper(0, "Has been expired.");
llResetScript();
}
}

Messenger (This script's name must be "Messenger" precisely)
CODE
default
{
state_entry()
{
llSetRemoteScriptAccessPin(10);
llMessageLinked(LINK_THIS, llGetStartParameter(), "", "");
}

}

Then your notecard would be like this.
CODE
1f2c3bed-5782-aab1-f877-de2cb922eec9
1F@<114.36536, 14.80906, 57.73620>
2F@<111.58475, 19.51487, 358.09445>
3F@<111.11631, 17.50489, 758.05457>
_____________________
:) Seagel Neville :)
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
05-03-2006 20:45
/15/01/104547/1.html
_____________________
i've got nothing. ;)
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
05-04-2006 13:34
Seagel, this sounds really interesting! I'll have to give it a try, and soon!

From what I read, if you are at one of the stations, and the pod is somewhere else, activating the dock will call it to where you are, right? Sounds good!
_____________________
Sorry, LL won't let me tell you where I sell my textures and where I offer my services as a sim builder. Ask me in-world.
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
05-07-2006 08:07
From: Ceera Murakami
Seagel, this sounds really interesting! I'll have to give it a try, and soon!

From what I read, if you are at one of the stations, and the pod is somewhere else, activating the dock will call it to where you are, right? Sounds good!
:o Yeah... It works... But it was too slow to wait when I tested from corner to corner (one corner's height was over 700m) in the sim. It took over 30 seconds to come...
I hate to call the elevator. Single-round is neat, isn't it? :o
_____________________
:) Seagel Neville :)
Aleister Leonov
AL Designs
Join date: 11 Jan 2006
Posts: 68
06-04-2006 03:47
Hi Seagel

I'm just fitting one of these into my home and was wondering how I can slow the transport down... (I know most people want to go faster but I like to run against the tide ;) )

I'm going between 2 floors (a 7m distance in total) and the speed is rather fast for a realistic ride so could you show me what I need to change to drop it by quite a bit.

I tried playing with this

CODE
tempTargetPos = Pos + <0.0, 0.0, 0.5>; 


but it made no noticable difference .. eg..

CODE
tempTargetPos = Pos + <0.0, 0.0, 0.001>; 


Other than that, this is ideal... :D
_____________________
-- Al
AL Designs
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
06-04-2006 18:01
Hello Aleister,

First off, the part you tweaked set just a target positon. It is supposed to reach 0.5m above the dock. I'm not sure but I found that the long distance movement caused you getting inaccurate posistion, so I did two-tiered approch. The pod goes up to 0.5m above where you don't care if it is inaccurate, then it is put in the dock.

The speed depends on llSetPos. Theoretically, you can make it slow down by setting the target position little by little. So replace the following code block on GeneralMove of ElevatorPod script.

CODE
GeneralMove(vector Pos)
{
tempTargetPos = Pos + <0.0, 0.0, 0.5>;
vector DistPos = tempTargetPos - llGetPos();
float speed = 10.0;
float tempX = DistPos.x / speed;
float tempY = DistPos.y / speed;
float tempZ = DistPos.z / speed;
vector tempTargetPos2 = <tempX, tempY, tempZ>;
integer i;
for(i = 0; i < speed; i++)
{
llSetPos(llGetPos() + tempTargetPos2);
}
}
I set speed value to 10.0, which means 1/10 speed. You can tweak it as you like.
_____________________
:) Seagel Neville :)
Aleister Leonov
AL Designs
Join date: 11 Jan 2006
Posts: 68
06-05-2006 01:12
Thanks Seagel, that works perfectly now.

Also your explanation about the workings of the script helped... I can see better how it all works now.
_____________________
-- Al
AL Designs
MaxDaemon Benmergui
Registered User
Join date: 28 Dec 2005
Posts: 3
Access
01-17-2007 05:04
Is there any way I can add access control so that only certain people can access certain floors?
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
01-17-2007 05:31
Aha, this called me up that I forgot renewing this thread scrpt. Thanks.

Hmm... an access restriction? I think it is possible, but it is a pain to add.
How would you manage allowed people? Maybe, names on the notecard.
Prepare notecards for each floor. Then fill in names on it.
Load all names and check it when someone click it. If the perosn is in the list, he/she is allowed to go to the restrictivve floor.

Yeah, this is just an indicator. Actually I have no motivation to implement it. Please you or someone, do it.
_____________________
:) Seagel Neville :)
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-17-2007 05:39
EDIT: Seagel had already replied before I posted.

From: MaxDaemon Benmergui
Is there any way I can add access control so that only certain people can access certain floors?


It would depend on exactly what sort of access restrictions you wanted.
Adding standard door lock type functionality would be easy - Its been covered several times in various forums.
Adding floor by floor restrictions would be a little more difficult but not impossible. Really just duplication of a lock for each floor.

Basic idea is a list of allowed people, each time any one requests the lift they are checked against the list and if on it they are allowed to access the menu's.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-17-2007 05:44
Seagel,
Rather than have to reset the pod script when you add a notecard why not handle CHANGED_INVENTORY?
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
01-17-2007 06:25
From: Newgate Ludd
Seagel,
Rather than have to reset the pod script when you add a notecard why not handle CHANGED_INVENTORY?

:D Though I forgot this, too, I had already commented.
From: someone
Known issues:
1. I couldn't use changed_inventory event in the pod because it was affected by llRemoteLoadScriptPin.
_____________________
:) Seagel Neville :)
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-17-2007 07:03
From: Seagel Neville
:D Though I forgot this, too, I had already commented.



Ah I obviously missed it when I was skimming the post, my apologies.
Poppet McGimsie
Proprietrix, WUNDERBAR
Join date: 28 Jul 2006
Posts: 197
05-07-2007 12:43
I am trying to use this system, but every time I add the Messenger script to the pod, the pod disappears! It does not appear in Lost and Found or trash or anywhere -- it simply disappears. Relogging doesn't help. I follow the instructions exactly, and am standing near it. ANyone else seeing this? Is there a workaround?
Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
05-08-2007 05:12
Hi Everyone,

I keep having all these pods appear out of nowhere. They are piling up in my backyard. Anyone have any idea where they keep coming from???
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
05-08-2007 08:17
Sorry guys, it was my bad :o I forgot that it moves to ZERO_VECTOR when you put the script into the Pod. I fixed it in the ElevatorWarp function of the ElevatorPod script.
_____________________
:) Seagel Neville :)
Bannock Ogg
Registered User
Join date: 24 May 2006
Posts: 28
Working Elevator
05-08-2007 21:45
If u like to see a elevator at work check out Whatchama Call It?? T shirt shop. Located at


http://slurl.com/secondlife/Reign/229/226/23/
Iridium Linden
Wikkid Linden
Join date: 12 Mar 2007
Posts: 262
05-09-2007 00:14
Thanks for that slurl, Bannock. *looks*
Kain Winterfeld
Registered User
Join date: 31 Mar 2008
Posts: 3
04-23-2008 05:55
I don't know what I am doing wrong, but after setting it all up when I click on the first dock I created, instead of the pod moving to it, I get the error message:

Ground: Task Ground trying to illegally load script onto task ElevatorPod!

Not sure why this doesn't work, can anyone please help?
I have a script called Messenger in each dock and in the pod, the notecard is also in each, and the respective scripts are also there. I have copied the hex code read out by each object and pasted it into each notecard (before dropping them into the docks and pod). As far as I can see all the scripts are named correctly and I have made sure there are no spaces in the notecard so I am at a bit of a loss.
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
04-23-2008 06:19
Make sure that ElevatorPod's messenger script compiled OK and is running, you will get that error if the PIN isn't set.
_____________________
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
04-23-2008 06:26
From: Kain Winterfeld
Ground: Task Ground trying to illegally load script onto task ElevatorPod!.

According to "http://forums.secondlife.com/showthread.php?t=126929", "http://forums.secondlife.com/showthread.php?t=115188", and "http://forums.secondlife.com/showthread.php?t=78177" threads, it is said that such an error happend when you set the different PIN's number between sending and receiving script. PIN's number is in "messanger" script. Please make sure that you really put it into the both prims, Dock and Pod.

Ouch, was I too late to post? :D
_____________________
:) Seagel Neville :)
Kain Winterfeld
Registered User
Join date: 31 Mar 2008
Posts: 3
04-23-2008 23:52
Thanks for the info, in the end, I started again from scratch with all new objects and scripts and it worked fine :)