Advertisement
worstbull

Untitled

Dec 9th, 2013
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. float spin_rate = 0.20;
  2. float roll_rate = 0.00;
  3. float yaw_rate  = 0.00;
  4.  
  5. integer LOCAL_AXIS = TRUE;
  6.  
  7. string  CONTROLLER_ID = "A";
  8. integer AUTO_START = TRUE;
  9.  
  10. rotation adjustment = ZERO_ROTATION;
  11.  
  12. integer iStarted = FALSE;
  13.  
  14. randomllTargetOmega()
  15. {
  16.         spin_rate = llFrand(2.0) - 1.0;
  17.         roll_rate = llFrand(2.0) - 1.0;
  18.         yaw_rate  = llFrand(2.0) - 1.0;
  19.  
  20.         llTargetOmega( <roll_rate, yaw_rate, spin_rate>*adjustment, 2.0, 2.0 );
  21. }
  22. default
  23. {
  24.     state_entry()
  25.     {
  26.         llSetTimerEvent(0.1);
  27.  
  28.         if ( LOCAL_AXIS ) adjustment = llGetRot();
  29.  
  30.         if ( AUTO_START )
  31.         {
  32.          iStarted = TRUE;
  33.         }
  34.  
  35.     }
  36.  
  37.     link_message( integer sibling, integer num, string mesg, key target_key )
  38.     {
  39.         if ( mesg != CONTROLLER_ID )
  40.         {
  41.             return;
  42.         }
  43.         else if ( num == 0 )
  44.         {
  45.             llTargetOmega( <0, 0, 0>, 1.0, 1.0 );
  46.             iStarted = FALSE;
  47.             llSetLocalRot( llGetLocalRot() );
  48.         }
  49.         else if ( num == 1 )
  50.         {
  51.             iStarted = TRUE;
  52.         }
  53.         else
  54.         {
  55.         }
  56.     }
  57.     timer()
  58.     {
  59.      if (iStarted)
  60.      {
  61.       randomllTargetOmega();
  62.      }
  63.     }    changed(integer change)
  64.     {
  65.         if (change & CHANGED_LINK)
  66.         {
  67.             if (llGetNumberOfPrims() > 7)
  68.             {
  69.                 if ( AUTO_START )
  70.                 {
  71.                  iStarted = TRUE;
  72.                 }
  73.             } else {
  74.                 if (iStarted)
  75.                 {
  76.                     llTargetOmega( <0, 0, 0>, 1.0, 1.0 );
  77.                     iStarted = FALSE;
  78.                     llSetLocalRot( llGetLocalRot() );
  79.                 }
  80.             }
  81.         }
  82.     }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement