Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: lift (elevator)

timeless Montreal
Registered User
Join date: 5 Dec 2006
Posts: 8
12-11-2006 17:02
Well, this is the first script that I have written that I think might be worth something to someone else. There isn't much to it, but I was trying to figure out a creative way to get from one level to the next with out walking. I hope you like it, and I am sorry if it is already out there and I missed it.
CODE


// lift script, v 1.0 by timeless montreal
//
// This script will allow you to make any prim a lift or an elevator.
// You should only have to change the liftAmount to the distance
// you want the lift to move. Of course, if you rather it move
// side to side, it shouldn't be too hard to tweak.
//
// enjoy!

integer liftAmount = 4; // change this to the amount you
// want to go up/down

integer isUp = FALSE; // Stores whether the object is up


movePlatform(){
llStartAnimation("stand");
if(isUp == FALSE){
llSetPos(llGetPos() + <0, 0, liftAmount>);
isUp = TRUE;
} else {
llSetPos(llGetPos() + <0, 0, -1*(liftAmount)>);
isUp = FALSE;
}
}

default
{
state_entry()
{
llSitTarget(<0,0,1>,<0,0,0,1>);
llSetSitText("Lift");
}


changed(integer change)
{
if(change & CHANGED_LINK)
{
key avataronsittarget = llAvatarOnSitTarget();
if( avataronsittarget != NULL_KEY )
{
if ((llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) && llGetPermissionsKey() == avataronsittarget) {
llStopAnimation("sit");
movePlatform();
} else {
llRequestPermissions(avataronsittarget, PERMISSION_TRIGGER_ANIMATION);
}
}
}
}


run_time_permissions(integer perm)
{
if(perm)
{
// Place the code here!
llStopAnimation("sit");
movePlatform();
}
}
}


Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
12-11-2006 21:09
/15/1c/154329/1.html
_____________________
i've got nothing. ;)
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
12-11-2006 22:49
You may want to program in some reference position, either up or down, as repeated use might make this elevator "walk".
Alexandra Jericho
Registered User
Join date: 14 Nov 2006
Posts: 11
12-14-2006 10:26
I was looking for something like this since I don't have enough room in my house for a set of stairs. I'll try it out and let you know how it works for me.
Thanks!
Tiarnalalon Sismondi
Registered User
Join date: 1 Jun 2006
Posts: 402
12-14-2006 12:22
The easiest thing to do when you don't have room for stairs is to just have a short-range teleporter.

All you would need to do is add a panel to the wall with a script that just has something similar to this:

CODE
vector FloorTwo = <0,0,5>; //This is for how far away the desired location on the second floor is from the button the script is in
default
{
state_entry()
{
llSetText("Click to go to the 2nd floor",<1,1,1>,1>;
llSitTarget(FloorTwo,ZERO_ROTATION);
}
changed(integer change)
{
if (CHANGE & CHANGED_LINK)
{
key av = llAvatarOnSitTarget();
if (av)
{
llSleep(0.5);
llUnSit(av);
}
}
}
}


Now obviously I just threw that together, but it operates on the same principle, only it moves you instead of the prim/object. Really just the most basic of a sit teleport script. I would just imagine that if there's no room for stairs, there probably isn't much room for an elevator :)

Course this all assumes that you are saying that even the single prim spiral stairs that can be made with rings and tubes are too large.
FD Spark
Prim & Texture Doodler
Join date: 30 Oct 2006
Posts: 4,697
12-14-2006 13:10
what is the maxium height that you can go up and down?
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
12-14-2006 13:54
300 M limit on any axis
Alexandra Jericho
Registered User
Join date: 14 Nov 2006
Posts: 11
12-14-2006 15:33
I tried combining a little of both the above scripts and ot works to move myself upstairs, but I tried to tweak it to move me back down and I keep getting syntax errors at every math symbol I try. It then sends me farther up instead of down.
Here's the code:

liftAmount = 5; //This is for how far away the desired location on the second floor is from the button the script is in
default
{
state_entry()
{
llSetText("Click to go to the 2nd floor",<1,1,1>,1);
llTouchTarget(llSetPos(llGetPos() - <0, 0, liftAmount>;););
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
key av = llAvatarOnTouchTarget();
if (av)
{
llSleep(0.5);
llUnSit(av);
}
}
}
}



I'm a total newbie to LSL but have some experience in other languages, so I may be way off base.
What am I doing wrong?
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
12-14-2006 23:29
1. You should have decleard your "liftAmount" as float.
2. There is no llTouchTarget function. It must be llSitTarget.
3. llSitTarget requires a vector and a rotation as parameters.
4. llSetPos doesn't return anything.
5. There is no llAvatarOnTouchTarget function. It must be llAvatarOnSitTarget.

From: ed44 Gupte
300 M limit on any axis
I think it can go up to 768m height.
_____________________
:) Seagel Neville :)
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
12-15-2006 04:32
From: Seagel Neville
I think it can go up to 768m height.

I just did some experiments using a box with a simple teleport script and it certainly stopped me going above 300 M above the box. When I selected 330 M it put me at 300 M above the box.

I then tilted the box in one axis by 45 degrees, and I was able to get 400M up.

with formula ";(target- llGetPos()) / llGetRot()" it still went up at right angles to the ground. I guess Pythagoras has something to do with that. With one tilt you should be able to go to the square root of 180000 (300 * 300 + 300 * 300) which I make to be a bit above 400. If you tilt in another direction as well you could possibly get another 100 M or so, probably giving you a total of over 500 M, still a bit short of 768.

Its close to midnight for me, so my brain is turning into mush. Maybe someone can calculate what the actual theoretical limit is.

I guess that because they are tilted, tp's are usually orbs so it will not be so noticable!

See also the wiki:
http://rpgstats.com/wiki/index.php?title=LlSitTarget
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
12-15-2006 08:07
ed44, the point seems to be that whose script FDSpark asked about. You took it was Tiarnalalon's short-range teleport one and I took it was OP's lift one.
So what we should have told was that llSitTarget's limit was generally 300m (tricky 500m) and llSetPos's limit was 768m. ;)
_____________________
:) Seagel Neville :)
Tiarnalalon Sismondi
Registered User
Join date: 1 Jun 2006
Posts: 402
12-15-2006 09:15
Well another limitation of llSetPos is you can't go any further than a 10m vector distance away from your current loc. So for example, if you wanted to move the elevator up 12m, it would fail.

Don't get me wrong, I like the nice feel of using an elevator to change floors, and I have one I made that works quite well non-physically....but it's more of a warpPos transporter than an elevator. I have have you sitting with a standing animation inside something that looks rather like a turbolift.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
12-15-2006 10:00
For a physical platform to use as an elevator and not have a ANY limitations to height (20,000 meters anyone?) you can scavenge parts from the script in this thread;
/54/80/148764/1.html

EDIT. It has been a while and I forgot but there are two useful scripts in that link. The first post is a physical vehicle and on the second page at the end there is an attachment. Both work well.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
12-15-2006 13:45
Sorry to confuse the issue. To make amends I'll summarize this thread, there are four ways to move around using aids:

a. wearing a prim containing a flight assist script. See:
/54/81/135024/1.html
I wear one of these in a little prim on my back and moved it inside my av's body.

b. sitting on a prim and having it move you and itself around. There is a 10 M single move limit but Keknehv Psaltery overcame this and developed warpPos which you can see at:
http://rpgstats.com/wiki/index.php?title=LibraryWarpPos

c. changing the sit target of a prim up to 300 m in any axis direction and then sitting on that prim. See post #5.

d. using a physical elevator. Really needs Havok 2. You would not need to sit on this, but an animation override is desirable. Jesse has described this.

Hope I did not add more to the confusion.
Sebastian Glitterbuck
Registered User
Join date: 14 Feb 2005
Posts: 23
Ways to get around
12-20-2006 08:09
From: ed44 Gupte
Sorry to confuse the issue. To make amends I'll summarize this thread, there are four ways to move around using aids:

a. wearing a prim containing a flight assist script. See:
/54/81/135024/1.html
I wear one of these in a little prim on my back and moved it inside my av's body.

b. sitting on a prim and having it move you and itself around. There is a 10 M single move limit but Keknehv Psaltery overcame this and developed warpPos which you can see at:
http://rpgstats.com/wiki/index.php?title=LibraryWarpPos

c. changing the sit target of a prim up to 300 m in any axis direction and then sitting on that prim. See post #5.

d. using a physical elevator. Really needs Havok 2. You would not need to sit on this, but an animation override is desirable. Jesse has described this.

Hope I did not add more to the confusion.


Someone on another recent thread added a 5th way.. that I just checked out for myself. Sim "The Future" has a transport system that appears to be push-based. You walk through a prim and get pushed up and at certain points there are other prims that push you in a different direction when you collide. It's nice work but may not be suitable for all parcels.
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
12-20-2006 16:28
Thanks. Always happy to learn more. The 5th way way seems like an extension of a flight assist script controlled by others.