Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

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
Discussion Thread
12-11-2006 21:09
/54/2f/154380/1.html
_____________________
i've got nothing. ;)
Andrew Hughes
Registered User
Join date: 24 Jul 2006
Posts: 5
01-14-2007 12:57
nicccccceeeeeeee way to be trav!



From: timeless Montreal
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();
}
}
}


Lhorentso Nurmi
Registered User
Join date: 24 Nov 2006
Posts: 246
01-14-2007 17:33
is there a way to call it if you're no on the same level as the elevator?