Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: Single Neat Elavator

Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
12-21-2005 06:45
Hello there,

:::Introduction:::
This elevator allows you to transport yourself up to 768m.
You don't have to run on the floor. :p
You don't have to create any hole in your building for this elevator because this allwos you to pass through ceilings and floors. :D
Just create the elevator's floor and put this script into it.
You have to adjust each floor height. For that purpose, you should edit elements of top two lists in this script to fit your building.
I recommend you create and set this elevator on each floor because this returns
every time tranporting you so that you don't have to call.

:::Usage:::
1. Touch the floor and it shows a dialog box to select floor.
2. Right click and select "Get on". That's all.

:::Note:::
If you set the height over actual 768m, it would stop and wouldn't move anymore.
You can set like pose balls on the elevator floor to allow multi ppl to get on. But don't forget to let them unsit when you get to the target floor.

CODE
// SN_Elevator was made by Seagel Neville as public domain, Dec 2005.

list heightList = [300, 500, 700]; // You have to put down the height of each floor here
list menuList = ["2F", "3F", "Rooftop"]; // Dialog box's list. Go along with heightList.

key av;
float height;
integer CHANNEL;
integer HANDLE;
integer FloorSelection = FALSE;
vector StartPos;
vector AVsize;

StopSitAnim() // Don't sit on the floor. :p
{
llStopAnimation("sit_generic");
llStopAnimation("sit");
llStartAnimation("impatient"); // Needed keyframes of legs' parts.
} // If you want to know this more, make sure to replace this for "stand". :p

ElevatorMove()
{
if(FloorSelection)
{
vector TargetPos = <StartPos.x, StartPos.y, StartPos.z + height>;
while(llVecDist(llGetPos(), TargetPos) != 0)
{
llSetPos(TargetPos);
}
llUnSit(av);
llSleep(1);
while(llVecDist(llGetPos(), StartPos) != 0)
{
llSetPos(StartPos);
}
}
else
{
llUnSit(av);
llWhisper(0, "Plz touch this floor and select where you go first");
}
}

default
{
state_entry()
{
llSetSitText("Get on");
StartPos = llGetPos();
}
on_rez(integer start_param)
{
llResetScript();
}
changed(integer change)
{
if(change & CHANGED_LINK)
{
av = llAvatarOnSitTarget();
if(av != NULL_KEY)
{
llRequestPermissions(av, PERMISSION_TRIGGER_ANIMATION);
}
}
}
run_time_permissions(integer perm)
{
StopSitAnim();
ElevatorMove();
FloorSelection = FALSE;
}
touch_start(integer change)
{
key avatar = llDetectedKey(0);
AVsize = llGetAgentSize(avatar);
llSitTarget(<0, 0, (AVsize.z / 2)>, ZERO_ROTATION); // Wow, don't you think this is a master touch? :p
CHANNEL = llRound(llFrand(1000000) - 10000000);
HANDLE = llListen(CHANNEL, "", "", "");
llDialog(avatar, "To what floor do you go?", menuList, CHANNEL);
}
listen(integer channel, string name, key id, string message)
{
height = llList2Float(heightList, llListFindList(menuList, [message]));
llListenRemove(HANDLE); // Is this a manner?
FloorSelection = TRUE;
}
}
_____________________
:) Seagel Neville :)
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
12-21-2005 13:21
/15/56/78710/1.html
_____________________
i've got nothing. ;)
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
12-21-2005 14:45
This looks like a simpler version of Cubey Terra's Mark III teleporter.

(not the code, the concept)
Lyric Alexander
Tree-hugging Fillosofer
Join date: 25 Feb 2005
Posts: 130
12-21-2005 18:48
It does go up nicely, although it overshot the height by about 20meters or so. It would be nice if it took you back down as well. I know zilch about scripts. :o
_____________________
Visit Cylyria's Misty Gardens at:

http://slurl.com/secondlife/Assateague%20Shores/36/50/23/
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
12-22-2005 08:57
From: Argent Stonecutter
This looks like a simpler version of Cubey Terra's Mark III teleporter.

(not the code, the concept)
Aha, it maybe. ;) The teleporter used by this method will allows you to transport while playing some animations.
From: Lyric Alexander
It does go up nicely, although it overshot the height by about 20meters or so. It would be nice if it took you back down as well. I know zilch about scripts.
:eek: Sorry, I haven't thought about normal use. :D But overshot? You can modify the first line, such as "list heightList = [10, 20, 30];". And don't forget the next line's list is gone along with them, such as "list menuList = ["2F", "3F", "4F"];. And I knew you should set llSleep time a bit longer when you use this in the shorter distance.
And as I recommend, you can place this on the 2nd floor, too. And modify it such as ""list heightList = [-10, 10, 20];" and "list menuList = ["1F", "3F", "4F"];".

And I forgot to say this, when you rez the eleavator included this script, the offset position is decided there. So if you adjust its position, you have to reset the script again there. Sorry for inconvenience. :o

I made a sample. This is available on my yard.
_____________________
:) Seagel Neville :)
Nepenthes Ixchel
Broadly Offended.
Join date: 6 Dec 2005
Posts: 696
12-22-2005 21:00
From: Lyric Alexander
It does go up nicely, although it overshot the height by about 20meters or so.


I suspect this is the cause:
CODE

vector TargetPos = <StartPos.x, StartPos.y, StartPos.z + height>;


This treats the height as relative, so if your starting position is +20 metres high and the height is 300 you will end up at +320. Either tweak the height values or replace the code with
CODE

vector TargetPos = <StartPos.x, StartPos.y, height>;


I'll be using this script tonight to provide easy access to my 600 metre high work platform. I moved into a nice area so I don't want my junk-yard style workshop at ground level. :-)
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
12-23-2005 01:03
From: Nepenthes Ixchel
This treats the height as relative, so if your starting position is +20 metres high and the height is 300 you will end up at +320. Either tweak the height values or replace the code with
CODE
 vector TargetPos = <StartPos.x, StartPos.y, height>; 
Aha, that makes sense. Yes, I made this relative because I didn't know how much level everybody was living at. :)
From: someone
I'll be using this script tonight to provide easy access to my 600 metre high work platform. I moved into a nice area so I don't want my junk-yard style workshop at ground level. :-)
Yup, feel free to customize this to fit your purpose. :)
_____________________
:) Seagel Neville :)
Lyric Alexander
Tree-hugging Fillosofer
Join date: 25 Feb 2005
Posts: 130
12-23-2005 01:39
Yes I found out that by taking the starting meters and ending meters and subtracting them i come up with the exact amt of meters I need to get to the elevation without the overshot.

And to make one that goes down, create another platform and do the same thing only use a "minus sign" (-) before the amount of meters you need to descend. It works very nicely thankyou...i now have my parcel set up with them.

Kewl beans! ;)

Thanks for making me use my brain.
_____________________
Visit Cylyria's Misty Gardens at:

http://slurl.com/secondlife/Assateague%20Shores/36/50/23/
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
If you want this to move slower, here is an adjustable spped version.
12-27-2005 07:42
Hello there,

Though I didn't think of normal use, if you want to use this within short range and move slower, this is an adjustable speed version.
CODE
// SN_Elevator(adjustable speed version) was made by Seagel Neville as public domain, Dec 2005.

list heightList = [10, 20, 30]; // You have to put down the height of each floor here
list menuList = ["2F", "3F", "4F"]; // Dialog box's list. Go along with heightList.
integer speed = 10; // You can change the elevator speed here. 1 is the fastest.

key av;
float height;
integer CHANNEL;
integer HANDLE;
integer FloorSelection = FALSE;
vector StartPos;
vector AVsize;

StopSitAnim() // Don't sit on the floor. ;p
{
llStopAnimation("sit_generic");
llStopAnimation("sit");
llStartAnimation("impatient"); // Needed keyframes of legs.
} // If you want to know this more, make sure to replace this for "stand". ;p

ElevatorMove()
{
if(FloorSelection)
{
integer i;
for(i = 0; i <= speed; i++)
{
llSetPos(llGetPos() + (<0.0, 0.0, height / speed> * llGetRot()));
}
llUnSit(av);
llSleep(1);
while(llVecDist(llGetPos(), StartPos) != 0)
{
llSetPos(StartPos);
}
}
else
{
llUnSit(av);
llWhisper(0, "Plz touch this floor and select where you go first");
}
}

default
{
state_entry()
{
llSetSitText("Get on");
StartPos = llGetPos();
}
on_rez(integer start_param)
{
llResetScript();
}
changed(integer change)
{
if(change & CHANGED_LINK)
{
av = llAvatarOnSitTarget();
if(av != NULL_KEY)
{
llRequestPermissions(av, PERMISSION_TRIGGER_ANIMATION);
}
}
}
run_time_permissions(integer perm)
{
StopSitAnim();
ElevatorMove();
FloorSelection = FALSE;
}
touch_start(integer change)
{
key av = llDetectedKey(0);
AVsize = llGetAgentSize(av);
llSitTarget(<0, 0, (AVsize.z / 2)>, ZERO_ROTATION); // Wow, don't you think this is a master touch? ;p
integer CHANNEL = llRound(llFrand(1000000) - 10000000);
HANDLE = llListen(CHANNEL, "", "", "");
llDialog(av, "To what floor do you go?", menuList, CHANNEL);
}
listen(integer channel, string name, key id, string message)
{
height = llList2Float(heightList, llListFindList(menuList, [message]));
llListenRemove(HANDLE); // Is this a manner?
FloorSelection = TRUE;
}
}

[EDIT] Note:If you let it go heigher, you seem to have to increase the value of speed, that is, to make it slower. I'm not sure why but I experienced that I could go up just 20m when I set the speed 1. And heiger you go, more inaccurate the actual height is... Yeah, I know why this happens. :o
_____________________
:) Seagel Neville :)
Lyric Alexander
Tree-hugging Fillosofer
Join date: 25 Feb 2005
Posts: 130
12-27-2005 14:44
Oh nice!

Thanks for the added info regarding the speed. The overall workings of scripts alludes me but i can manage the little things..... ;)
_____________________
Visit Cylyria's Misty Gardens at:

http://slurl.com/secondlife/Assateague%20Shores/36/50/23/
Aeryck Epsilon
Registered User
Join date: 23 Aug 2005
Posts: 7
01-10-2006 06:06
I built an elevator platform lst night using this and it worked great, I can see many uses for this. One thing that I would like to know though. How would I make this a onetime use deal, I.E. I rez the elevator, ride it to my platform in the sky, and then it disapears rather than returning to ground level? Scripting is definately NOT my strong point.
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
01-10-2006 06:23
Would you like to let it poof? Then, replace this custom function.
CODE
ElevatorMove() 
{
if(FloorSelection)
{
integer i;
for(i = 0; i <= speed; i++)
{
llSetPos(llGetPos() + (<0.0, 0.0, height / speed> * llGetRot()));
}
llUnSit(av);
llSleep(1);
// Below is the returning sectiion
// while(llVecDist(llGetPos(), StartPos) != 0)
// {
// llSetPos(StartPos);
// }
// So comment out or delete here and add the following one line.
llDie();
}
else
{
llUnSit(av);
llWhisper(0, "Plz touch this floor and select where you go first");
}
}
_____________________
:) Seagel Neville :)
Aeryck Epsilon
Registered User
Join date: 23 Aug 2005
Posts: 7
01-10-2006 07:56
Thanks, I'll try that. I thought that that might be the area I needed to change, but wasn't sure.
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
01-10-2006 09:12
You should find the "ElevatorMove() " and a bunch of codes. Compare and just replace it. I hope that helps.
_____________________
:) Seagel Neville :)
Vincent Parvenu
Registered User
Join date: 24 Jul 2005
Posts: 22
03-10-2006 15:39
I have been trying to hash together pieces of a few teleport styles scripts, and it seems not to be working too well. I understand what the parts do, but cannot make them communicate well in script form. I am a lover, not a fighter. (I am a builder, not a scripter)

So I like this design for what it does, but I am trying to get the destination to be non-coordinate nature. just to increase a set number of meters from the start position.

Anyone...Anyone?

V
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
03-10-2006 16:32
Didn't it work by the default? It is described as "list heightList = [300, 500, 700]; ". Those number means that it would move 300, 500, or 700m up from the first position. If you live on the land which has 25m height, it would move 325, 525, or 725m up. Tell me how high your land is and how high you want to move.
_____________________
:) Seagel Neville :)
Vincent Parvenu
Registered User
Join date: 24 Jul 2005
Posts: 22
03-10-2006 17:26
You know what? I was trying to make a mountain out of a mole hill when it was already a mountain.

Thanks!

V
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
03-11-2006 02:25
You mean this elevator couldn't go through in the mountain? Sorry, I'm afraid that I don't understand what you want to know. :o
_____________________
:) Seagel Neville :)
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
03-11-2006 04:00
It's an English idiom Seagel - "making a mountain out of a molehill" is when there's a little bit of work to be done but it's easy (the metaphorical molehill), and you (through stupidity, lack of thought or carelessness) make it into huge task (the metaphorical mountain).

What he was saying was, to paraphrase, "all I needed to do was change those offsets to my values but I thought it was much harder than that" - English lessons as well as scripting tips.:)
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
03-11-2006 04:19
:eek: :o :D :p Thank you, Eloise! You always help me in English. ;) Thank you.
Aha, and... what do you think I can do for him? He doesn't want to change values? For example, preparing like a destination ball, and when he just put it on the destination, the elevator should set the target, like that?
_____________________
:) Seagel Neville :)
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
03-11-2006 05:33
Seagel?

Is it possible to modify this so that between the ground level station and the middle one, an offset of about 30 meters is also added to X and Y? My art studio is 500M up from where I would place the ground station, but is offset by about 30 M to the North and East from being straight over where I would want the ground station inside my house. And for the highest stop, it would be just 6 M or so higher, straight above the second one...

Perhaps a modification could be made to add variables at the top of the script, to store the specific (X,Y,Z) coordinates for each stop, and to indicate which stop this copy of the elevator was supposed to return to?



... And yes, I really do use my skybox more as a low-lag art studio than as a place for adult "playtime"!
_____________________
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
03-11-2006 06:39
Yes, it is possible. I've modified this like that before because someone asked so.
CODE
// ver0.4SP was tweaked by Seagel Neville, Mar 2006.
// SN_Elevator was made by Seagel Neville as public domain, Dec 2005.

list heightList = [450, 456]; // You have to put down the height of each floor here
list menuList = ["MyHouse", "Top-stop"]; // Dialog box's list. Go along with heightList.

list xCoordinateList = [30, 30]; // Let these two lines go along with top two lists, heightList and menuList. *Modified
list yCoordinateList = [30, 30]; // The default is 0 to move straght up and down. *Modified

key av;
float height;
float xCoord; //*Modified
float yCoord; //*Modified
integer CHANNEL;
integer HANDLE;
integer FloorSelection = FALSE;
vector StartPos;
vector AVsize;

StopSitAnim() // Don't sit on the floor. ;p
{
llStopAnimation("sit_generic");
llStopAnimation("sit");
llStartAnimation("impatient"); // Needed keyframes of legs.
} // If you want to know this more, make sure to replace this for "stand". ;p

ElevatorMove()
{
if(FloorSelection)
{
vector TargetPos = <StartPos.x + xCoord, StartPos.y + yCoord, StartPos.z + height>; //*Modified
while(llVecDist(llGetPos(), TargetPos) != 0)
{
llSetPos(TargetPos);
}
llUnSit(av);
llSleep(2);
while(llVecDist(llGetPos(), StartPos) != 0)
{
llSetPos(StartPos);
}
}
else
{
llUnSit(av);
llWhisper(0, "Plz touch this floor and select where you go first");
}
}

default
{
state_entry()
{
llSetSitText("Get on");
StartPos = llGetPos();
}
on_rez(integer start_param)
{
llResetScript();
}
changed(integer change)
{
if(change & CHANGED_LINK)
{
av = llAvatarOnSitTarget();
if(av != NULL_KEY)
{
llRequestPermissions(av, PERMISSION_TRIGGER_ANIMATION);
}
}
}
run_time_permissions(integer perm)
{
StopSitAnim();
ElevatorMove();
FloorSelection = FALSE;
}
touch_start(integer change)
{
key av = llDetectedKey(0);
AVsize = llGetAgentSize(av);
llSitTarget(<0, 0, (AVsize.z / 2)>, ZERO_ROTATION); // Wow, don't you think this is a master touch? ;p
integer CHANNEL = llRound(llFrand(1000000) - 10000000);
HANDLE = llListen(CHANNEL, "", "", "");
llDialog(av, "To what floor do you go?", menuList, CHANNEL);
}
listen(integer channel, string name, key id, string message)
{
integer SelectedFloor = llListFindList(menuList, [message]); //*Modified
height = llList2Float(heightList, SelectedFloor); //*Modified
xCoord = llList2Float(xCoordinateList, SelectedFloor); //*Modified
yCoord = llList2Float(yCoordinateList, SelectedFloor); //*Modified
llListenRemove(HANDLE); // Is this a manner?
FloorSelection = TRUE;
}
}
But it would move to each floor directly, not come via way-stop. If you want it, you may consider much.
_____________________
:) Seagel Neville :)
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
03-11-2006 17:19
Thank you! I can't wait to try it out!
_____________________
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.
Vincent Parvenu
Registered User
Join date: 24 Jul 2005
Posts: 22
Mountain Man
04-01-2006 15:29
SN,
Seems a recent code update to SL causes the elevator now to whisper even though you do a successful touch, floor choice, and then teleport. Any idea on why this is happening?

V
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
04-01-2006 18:46
It became to recall run_time_permissions again when you stood up. :( When you stood up, you relased the floor selction information, then it started again and warned. I couldn't manage to fix it. Plz wait untill the next release, 1.9.0(20), which will be released the week of April 3. I hope it will be fixed.
_____________________
:) Seagel Neville :)
1 2 3