pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

ScriptAcademy.org pastebin - collaborative debugging tool (LSL (Linden Scripting Language)) View Help

Posted by daniloloko dawes on Thu 26 Jan 14:01
download | new post

  1. // Open Pose Ball
  2. // from Dolyn Foley
  3. // Feel free to ask me about this code
  4. // Please pass it on, a la GPL
  5.  
  6.  
  7. string sitAnimation = "";
  8. // if sitAnimation is left blank
  9. // the script will grab the first animation in the container.
  10. // if a value is set, it will use that instead.
  11. //string sitAnimation = "yoga_float";
  12.  
  13.  
  14.     on_rez(integer start_param) {
  15.         llResetScript();
  16.     }
  17.  
  18.     state_entry() {
  19.         llSetText("", <0.0,0.0,50.0>, 1);
  20.         llSitTarget( <-300,-300,-300>, ZERO_ROTATION );
  21.  
  22.         // if blank, we look in inventory
  23.         if (sitAnimation == "") {
  24.             sitAnimation = llGetInventoryName(INVENTORY_ANIMATION, 0);
  25.            
  26.             // oops, use default
  27.             if (sitAnimation == "") {
  28.                 sitAnimation = "sit";
  29.             }
  30.         }
  31.     }
  32.  
  33.  
  34.     // Using state to control sitting
  35.     // If you're in this state, no one is sitting
  36.     changed(integer change) {
  37.         if (change & CHANGED_LINK) {
  38.             key avatar = llAvatarOnSitTarget();
  39.             if ( avatar != NULL_KEY )  {
  40.                 llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION);
  41.             }
  42.         }       
  43.     }
  44.  
  45.        
  46.         if(parm == PERMISSION_TRIGGER_ANIMATION) {
  47.             llStopAnimation("sit");
  48.             llStartAnimation(sitAnimation);
  49.             state sitting;
  50.         }
  51.     }   
  52. }
  53.  
  54.  
  55. state sitting {
  56.     state_entry() {
  57.     }
  58.  
  59.     // Oddly, this event listener NEEDS to be here.
  60.     // If it isn't, then when you shift out of this state,
  61.     // then event goes dead in default.
  62.     touch_start(integer total_number) {
  63.     }
  64.  
  65.     // Assume sitting, thus any CHANGED_LINK means standing.       
  66.     changed(integer change) {
  67.         if (change & CHANGED_LINK) {
  68.             llStopAnimation(sitAnimation);
  69.             llResetScript();
  70.         }       
  71.     }
  72.  
  73. }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@

Please note - we've added a reCaptcha to this service to help prevent spam. Any problems, please IM Hippyjim Starbrook



Remember me