Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // You should only have to change the liftAmount to the distance
- // you want the lift to move.
- integer liftAmount = 4; // change this to the amount you
- vector Top; // want to go up/down
- vector Bottom;
- float Speed = 0.2;
- integer isUp = FALSE; // Stores whether the object is up
- default
- {
- state_entry()
- {
- llSitTarget(<0,0,1>,<0,0,0,1>);
- llSetSitText("Lift");
- Bottom = llGetPos();
- }
- touch_start(integer total_number)
- {
- if(llGetOwner() == llDetectedKey(0))
- {
- Bottom = llGetPos();
- Top = Bottom + <0, 0, liftAmount>;
- llOwnerSay("Bottom Recorded");
- }
- }
- timer()
- {
- vector Place = llGetPos();
- if(isUp == FALSE)
- {
- llSetPos(llGetPos() + <0, 0, (Speed)>);
- if(Top == Place);
- {
- isUp = TRUE;
- llSetTimerEvent(0);
- llSay(0,"Top Floor");
- }
- }
- else
- {
- llSetPos(llGetPos() + <0, 0, -1*(Speed)>);
- if(Place == Bottom)
- {
- llSay(0,"Bottom Floor");
- isUp = FALSE;
- llSetTimerEvent(0);
- }
- }
- }
- changed(integer change)
- {
- if(change & CHANGED_LINK)
- {
- key avataronsittarget = llAvatarOnSitTarget();
- if( avataronsittarget != NULL_KEY )
- {
- if ((llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) && llGetPermissionsKey() == avataronsittarget) {
- llStopAnimation("sit");
- llStartAnimation("stand");
- llSetTimerEvent(0.1);
- } else {
- llRequestPermissions(avataronsittarget, PERMISSION_TRIGGER_ANIMATION);
- }
- }
- }
- }
- run_time_permissions(integer perm)
- {
- if(perm)
- {
- // Place the code here!
- llStopAnimation("sit");
- llStartAnimation("stand");
- llSetTimerEvent(0.1);
- }
- }
- }
Add Comment
Please, Sign In to add comment