Advertisement
Guest User

Untitled

a guest
Nov 25th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Rezzer
  2. string      OBJECT_NAME         = "thing";      // Name of object to rez
  3. vector      OBJECT_OFFSET_POS   = <0,0,3>;      // Position to rez object at
  4. rotation    OBJECT_OFFSET_ROT   = ZERO_ROTATION;// Rotation to rez object at
  5. vector      OBJECT_VELOCITY     = ZERO_VECTOR;  // Velocity to rez object at
  6.  
  7. string      DIE_SCRIPT_NAME     = "die";        // Name of the die script
  8. integer     PIN_MAX             = 2147483647;   // INT_MAX
  9. integer     PIN_MIN             = 1;            // avoid 0 because it is used as the
  10.                                                 // start param when rezzed from inv
  11.  
  12. integer     OWNER_ONLY          = FALSE;        // If only owner can use
  13.  
  14. key         object_key          = NULL_KEY;     // Key of rezzed object
  15. integer     object_rezzed       = FALSE;        // Whether object is rezzed
  16. integer     object_pin;                         // PIN for rezzed object
  17.  
  18. integer random_pin() {
  19.     return llCeil( llFrand(PIN_MAX - PIN_MIN) ) + PIN_MIN;
  20. }
  21.  
  22. default {
  23.     touch_start(integer num) {
  24.         if ( OWNER_ONLY && (llDetectedKey(0) != llGetOwner()) )
  25.             return;
  26.            
  27.         if ( object_rezzed ) { // Object is already rezzed
  28.             llRemoteLoadScriptPin( object_key, DIE_SCRIPT_NAME, object_pin, TRUE, TRUE );
  29.             object_key      = NULL_KEY;
  30.             object_rezzed   = FALSE;
  31.         } else {
  32.             object_pin = random_pin();
  33.             llRezObject(
  34.                 OBJECT_NAME, llGetPos() + OBJECT_OFFSET_POS, OBJECT_VELOCITY,
  35.                 llGetRot() * OBJECT_OFFSET_ROT, object_pin
  36.             );
  37.             object_rezzed = TRUE;
  38.         }
  39.     }
  40.    
  41.     object_rez(key id) {
  42.         object_key = id;
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement