Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. //AO Overrider Pose Ball Script V 1.2
  2. //Updated 11/09/2006
  3. //Created by Jesse Barnett
  4. //Edited to check if there is an animation to stop
  5. //and Sit Position is stored in Object Description
  6. //Drop this in a prim along with an animation. Store the sit
  7. //position in the Object description
  8. //Example; <0.0, 0.0, 1.0>
  9. //If you change this then reset the script by using right
  10. //click/reset for changes to apply immediately. If you forget then it will display
  11. //"reset script" when you sit. Just stand and sit again for changes to take effect
  12.  
  13.  
  14. //To see how it works and hear it go through the animations it is stopping, then
  15. //make idebug = TRUE;
  16. integer idebug = FALSE;//if TRUE then llOwnerSay sdebugs
  17. string sdebug;
  18. integer perm;//permissions
  19. string anim2run;//animation in inventory
  20. vector sit_pos;//adjust as needed in object description Example: <0.0, 0.0, 1.0>
  21. list anims2stop;//default or AO sit animation
  22. float sleep = 0.5;//duration of llSleep in seconds
  23.  
  24. debug(){
  25. if(idebug == 1)
  26. llOwnerSay(sdebug);
  27. }
  28.  
  29. sit_desc_change(){
  30. if((sit_pos + (vector)llGetObjectDesc()) != (sit_pos* 2))
  31. llResetScript();
  32. //This checks to see if the description field matchs the stored position
  33. else
  34. llSitTarget(sit_pos, ZERO_ROTATION);
  35. }
  36.  
  37. stop_anim(){
  38. integer list_pos = 0;
  39. integer list_length = llGetListLength(anims2stop);
  40. sdebug = (string)list_length;
  41. debug();
  42. if(list_length > 0){
  43. while(list_pos < list_length){
  44. llStopAnimation(llList2String(anims2stop, list_pos));
  45. sdebug = (string)list_pos;
  46. debug();
  47. list_pos++;
  48. }
  49. }
  50. }
  51.  
  52. default{
  53. state_entry(){
  54. llSetTouchText("Reset");
  55. llOwnerSay("Script Reset.");
  56. anim2run=llGetInventoryName(INVENTORY_ANIMATION,0) ;
  57. sit_pos = (vector)llGetObjectDesc();
  58. sit_desc_change();
  59. perm=llGetPermissions();
  60. }
  61.  
  62. touch_start(integer num_detected) {
  63. llResetScript();
  64. llSetText("",<0,0,0>,0.0);
  65. }
  66.  
  67. changed(integer change){
  68. if (change & CHANGED_LINK)
  69. if (llAvatarOnSitTarget() != NULL_KEY){
  70. llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);
  71. }
  72.  
  73. else{
  74. perm=llGetPermissions();
  75. if ((perm & PERMISSION_TRIGGER_ANIMATION) && llStringLength(anim2run)>0)
  76. llStopAnimation(anim2run);
  77. llSetAlpha(1.0, ALL_SIDES);
  78. }
  79. }
  80. run_time_permissions(integer perm){
  81. if (perm & PERMISSION_TRIGGER_ANIMATION)
  82. anims2stop = [];//Clears the list
  83. sdebug = "perms granted";
  84. llStopAnimation("sit");
  85. llSleep(sleep);//need sleep to give avatar time to cycle from stand
  86. //to default sit to AO sit
  87. anims2stop = llGetAnimationList(llAvatarOnSitTarget());
  88. sdebug = llList2CSV(anims2stop);
  89. debug();
  90. stop_anim();//This runs the subroutine up top .
  91. llSetAlpha(0.0, ALL_SIDES);
  92. llStartAnimation(anim2run);
  93. sdebug = "anim2run started";
  94. debug();
  95. }
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement