Pose Ball.lsl 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. // :CATEGORY:Blue Whale
  2. // :NAME:BlueWhale
  3. // :AUTHOR:Ferd Frederix
  4. // :CREATED:2013-09-06
  5. // :EDITED:2013-09-18 15:38:49
  6. // :ID:107
  7. // :NUM:142
  8. // :REV:1
  9. // :WORLD:Second Life
  10. // :DESCRIPTION:
  11. // pose ball
  12. // :CODE:
  13. // pose ball script
  14. // position to sit on the ball e.g <0.0, 0.0, 0.1>
  15. // sit 0.1 meter above the ball.
  16. // NOTE: if all these are 0, then the sit location is removed
  17. // position to sit on the ball e.g <0.0, 0.0, 0.43>
  18. // sit 0.5 meter above the ball
  19. vector POSITION=<0.0, 0.0, 0.1>;
  20. // hovertext above ball. "" for none.
  21. // add '\n ' at the end to move text up i.e.
  22. // string HOVERTEXT="Sit Here\n ";
  23. string HOVERTEXT="";
  24. // Pie Menu Sit Text. Will only work for the
  25. // main prim but included it anyway. If no text
  26. // is entered between "" it won't be used.
  27. string SIT_TEXT="";
  28. list rgb;
  29. string animation;
  30. integer listener;
  31. default
  32. {
  33. state_entry()
  34. {
  35. if (llStringLength(SIT_TEXT)>0)
  36. llSetSitText(SIT_TEXT);
  37. llSitTarget(POSITION, ZERO_ROTATION);
  38. }
  39. on_rez(integer r)
  40. {
  41. llResetScript();
  42. }
  43. changed(integer change)
  44. {
  45. if (change & CHANGED_LINK)
  46. {
  47. if (llAvatarOnSitTarget() != NULL_KEY)
  48. {
  49. llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_CONTROL_CAMERA|PERMISSION_TRIGGER_ANIMATION);
  50. }
  51. else
  52. {
  53. integer perm=llGetPermissions();
  54. if ((perm & PERMISSION_TRIGGER_ANIMATION) && llStringLength(animation)>0)
  55. llStopAnimation(animation);
  56. animation="";
  57. }
  58. }
  59. }
  60. run_time_permissions(integer perm)
  61. {
  62. if (perm & PERMISSION_TRIGGER_ANIMATION)
  63. {
  64. llStopAnimation("sit");
  65. animation=llGetInventoryName(INVENTORY_ANIMATION,0);
  66. llStartAnimation(animation);
  67. }
  68. if ( perm & PERMISSION_CONTROL_CAMERA )
  69. {
  70. llClearCameraParams(); // reset camera to default
  71. llSetCameraParams([
  72. CAMERA_ACTIVE, 1, // 1 is active, 0 is inactive
  73. CAMERA_BEHINDNESS_ANGLE, 15.0, // (0 to 180) degrees
  74. CAMERA_BEHINDNESS_LAG, 1.0, // (0 to 3) seconds
  75. CAMERA_DISTANCE, 10.0, // ( 0.5 to 10) meters
  76. CAMERA_FOCUS_LAG, 0.05 , // (0 to 3) seconds
  77. CAMERA_FOCUS_LOCKED, FALSE, // (TRUE or FALSE)
  78. CAMERA_FOCUS_THRESHOLD, 0.0, // (0 to 4) meters
  79. CAMERA_PITCH, 10.0, // (-45 to 80) degrees
  80. CAMERA_POSITION_LAG, 0.0, // (0 to 3) seconds
  81. CAMERA_POSITION_LOCKED, FALSE, // (TRUE or FALSE)
  82. CAMERA_POSITION_THRESHOLD, 0.0, // (0 to 4) meters
  83. CAMERA_FOCUS_OFFSET, <-2.0, 0.0, -3.0> // <-10,-10,-10> to <10,10,10> meters
  84. ]);
  85. }
  86. }
  87. }