Welcome! Here you can paste sources and general debugging text, You can even set yourself a password if you want to keep it just for yourself.

Posted by Anonymous on September Sun 18th 3:49 PM - Never Expires
Download | New paste

  1. //Note: this code was adapted from someone.
  2. //
  3.  
  4. key mkLoungingAgentKey = NULL_KEY;
  5. integer miPermissionsAcquired = FALSE;
  6.  
  7. default
  8. {
  9.     state_entry()
  10.     {
  11.         //overriden sit target
  12.         //lower them a bit
  13.         vector vLoungeTarget = <-0.8, -0.1, -.85>;
  14.        
  15.         rotation rX;
  16.         rotation rY;
  17.         rotation rZ;
  18.         rotation r;
  19.        
  20.         //build rotations
  21.         //Note: this is broken out like this to simplify the
  22.         //        process of finding the correct sit angle.  I
  23.         //        use the following form until I have the rotation
  24.         //        that I want perfect, and then I simply
  25.         //        hardcode the perfected quaterion and remove   
  26.         //        this mess.
  27.         //
  28.         rX = llAxisAngle2Rot( <1,0,0>, -90 * DEG_TO_RAD);         //cartwheel
  29.         rY = llAxisAngle2Rot( <0,1,0>, 90 * DEG_TO_RAD);       //sumersault
  30.         rZ = llAxisAngle2Rot( <0,0,1>, 90 * DEG_TO_RAD);       //turn in place
  31.        
  32.         //combine rotations
  33.         r = rX * rY * rZ;
  34.        
  35.         //override 'sit' on pie menu
  36.         llSetSitText( "Join" );
  37.  
  38.         //override default sit target and rotation on prim
  39.         llSitTarget( vLoungeTarget, r );
  40.     }
  41.    
  42.     changed(integer change)
  43.     {
  44.         if (change & CHANGED_LINK)
  45.         {
  46.             key agent = llAvatarOnSitTarget();
  47.             if ( mkLoungingAgentKey == NULL_KEY && agent != NULL_KEY )
  48.             {
  49.  
  50.                 //changed user
  51.                 //cache new user key and request their permissions
  52.                 mkLoungingAgentKey = agent;
  53.                  llRequestPermissions(mkLoungingAgentKey,PERMISSION_TRIGGER_ANIMATION);
  54.             }
  55.             else if ( mkLoungingAgentKey != NULL_KEY && agent == NULL_KEY)
  56.             {
  57.                
  58.                 //user is getting up
  59.                 if ( miPermissionsAcquired )
  60.                 {
  61.                    
  62.                     //restore anims
  63.                     llStopAnimation("sit_ground");
  64.                                
  65.                 }
  66.                
  67.                 //reset the script to release permissions
  68.                 llResetScript();
  69.             }
  70.         }       
  71.     }
  72.    
  73.     run_time_permissions(integer parm)
  74.     {
  75.         if(parm == PERMISSION_TRIGGER_ANIMATION)
  76.         {
  77.            
  78.             //set permission flag
  79.             miPermissionsAcquired = TRUE;
  80.            
  81.             //cancel the sit anim
  82.             llStopAnimation("sit_ground");
  83.            
  84.             llStartAnimation("sit_ground");
  85.         }
  86.     }   
  87. }
Language:
To highlight particular lines, prefix each line with @@





Hosted by KanGouLya for OpenTunisia
Donate for OpenTunisia Servers.
Powered by PHPaste 1.1