Guest User

Untitled

a guest
May 12th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // You should only have to change the liftAmount to the distance
  2. // you want the lift to move.
  3.  
  4.  
  5. integer liftAmount = 4; // change this to the amount you
  6. vector Top;                         // want to go up/down
  7. vector Bottom;
  8. float Speed = 0.2;
  9. integer isUp = FALSE; // Stores whether the object is up
  10.  
  11. default
  12. {
  13.     state_entry()
  14.     {
  15.         llSitTarget(<0,0,1>,<0,0,0,1>);        
  16.         llSetSitText("Lift");
  17.         Bottom = llGetPos();
  18.        
  19.     }
  20.     touch_start(integer total_number)
  21.     {
  22.         if(llGetOwner() == llDetectedKey(0))
  23.         {
  24.             Bottom = llGetPos();
  25.             Top = Bottom + <0, 0, liftAmount>;
  26.             llOwnerSay("Bottom Recorded");
  27.         }
  28.     }
  29.    
  30.     timer()
  31.     {
  32.         vector Place = llGetPos();
  33.         if(isUp == FALSE)
  34.         {
  35.             llSetPos(llGetPos() + <0, 0, (Speed)>);
  36.             if(Top == Place);
  37.             {
  38.                 isUp = TRUE;
  39.                 llSetTimerEvent(0);
  40.                 llSay(0,"Top Floor");
  41.             }
  42.         }
  43.         else
  44.         {
  45.         llSetPos(llGetPos() + <0, 0, -1*(Speed)>);
  46.             if(Place == Bottom)
  47.             {
  48.                 llSay(0,"Bottom Floor");
  49.                 isUp = FALSE;
  50.                 llSetTimerEvent(0);
  51.             }
  52.         }
  53.  
  54.     }
  55.     changed(integer change)
  56.     {
  57.         if(change & CHANGED_LINK)
  58.         {
  59.             key avataronsittarget = llAvatarOnSitTarget();
  60.             if( avataronsittarget != NULL_KEY )
  61.             {
  62.                 if ((llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) && llGetPermissionsKey() == avataronsittarget) {
  63.                     llStopAnimation("sit");
  64.                     llStartAnimation("stand");
  65.                     llSetTimerEvent(0.1);
  66.                 } else {
  67.                     llRequestPermissions(avataronsittarget, PERMISSION_TRIGGER_ANIMATION);
  68.                 }
  69.             }
  70.         }
  71.     }
  72.  
  73.  
  74.     run_time_permissions(integer perm)
  75.     {
  76.         if(perm)
  77.         {
  78.             // Place the code here!
  79.             llStopAnimation("sit");
  80.             llStartAnimation("stand");
  81.             llSetTimerEvent(0.1);              
  82.         }
  83.     }
  84. }
Add Comment
Please, Sign In to add comment