Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.01 KB | None | 0 0
  1. list mouthAnims = ["Frown", "Grin", "Normal", "Pant", "Shock", "Snarl", "Test"];
  2. list eyeAnims = ["Angry", "Confused", "Happy", "Normal", "Sad", "Tired"];
  3. list earAnims = ["Droop", "IdleHappy", "Normal", "Pinned", "Sad", "Silly"];
  4. list tailAnims = ["bouncewag", "CurlWag", "Lowswish"];
  5.  
  6. list AOConfig = [
  7. "CrouchWalking", "Crouch_Walk",
  8. "Falling Down", "Descend",
  9. "Flying", "FlyForwardFastADD",
  10. "FlyingSlow", "FlyForwardFast",
  11. "Hovering", "Flap_Loop",
  12. "Hovering Down", "Descend",
  13. "Hovering Up", "Flap",
  14. "Jumping", "Descend",
  15. "Landing", "Land",
  16. "PreJumping", "PreJump",
  17. "Running", "HopRun",
  18. "Sitting", "Sit",
  19. "Sitting on Ground", "Sit",
  20. //"Standing Up", "",
  21. "Striding", "Hopping_Walk",
  22. //"Soft Landing", "",
  23. //"Taking Off", "",
  24. "Turning Left", "StandTurnLeft",
  25. "Turning Right", "StandTurnRight",
  26. "Walking", "Hopping_Walk"
  27. ];
  28. setupAO(){
  29. llResetAnimationOverride("ALL");
  30. llSleep(0.1);
  31. integer i = 0;
  32. integer l = llGetListLength(AOConfig);
  33. for(;i<l;i+=2){
  34. llSetAnimationOverride(llList2String(AOConfig, i), llList2String(AOConfig, i+1));
  35. }
  36. }
  37.  
  38. string lastStandAnim = "Stnd_2";
  39. float nextAnimTime;
  40. integer isTyping;
  41.  
  42. string earAnim = "Ears_Normal";
  43. string eyeAnim = "Eyes_Normal";
  44. string mouthAnim = "Mout_Normal";
  45. string tailAnim = "Tail_CurlWag";
  46.  
  47. float lastCrouch;
  48. integer crouch;
  49.  
  50. key owner;
  51.  
  52. setup(){
  53. owner = llGetOwner();
  54. llStartAnimation(lastStandAnim);
  55. llStartAnimation(earAnim);
  56. llStartAnimation(eyeAnim);
  57. llStartAnimation(mouthAnim);
  58. llStartAnimation(tailAnim);
  59. llTakeControls(0xFFFFFFFF, TRUE, TRUE);
  60. setupAO();
  61. llSetTimerEvent(0.1);
  62. }
  63.  
  64. default{
  65. attach(key id){
  66. if(id){
  67. llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION|PERMISSION_OVERRIDE_ANIMATIONS|PERMISSION_TAKE_CONTROLS);
  68. }else{
  69. //Shutdown AO when detached
  70. llResetAnimationOverride("ALL");
  71. }
  72. }
  73.  
  74. state_entry(){
  75. if(llGetAttached()){
  76. llListen(1, "", "", "");
  77. llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION|PERMISSION_OVERRIDE_ANIMATIONS|PERMISSION_TAKE_CONTROLS);
  78. }
  79. }
  80. listen(integer i, string n, key k, string m){
  81. if(llGetOwnerKey(k) == owner){
  82. list params = llParseString2List(m, [" "], []);
  83. m = llList2String(params, 0);
  84. if(m == "mouth"){
  85. string prop = llList2String(params, 1);
  86. if(~llListFindList(mouthAnims, (list)prop)){
  87. llStopAnimation(mouthAnim);
  88. llStartAnimation(mouthAnim = "Mout_"+prop);
  89. return;
  90. }else if(prop != ""){
  91. llOwnerSay("Unknown animation for mouth: "+prop);
  92. }
  93. llOwnerSay("Valid mouth animations: "+llList2CSV(mouthAnims));
  94. }else
  95. if(m == "ear"){
  96. string prop = llList2String(params, 1);
  97. if(~llListFindList(earAnims, (list)prop)){
  98. llStopAnimation(earAnim);
  99. llStartAnimation(earAnim = "Ears_"+prop);
  100. return;
  101. }else if(prop != ""){
  102. llOwnerSay("Unknown animation for ears: "+prop);
  103. }
  104. llOwnerSay("Valid ear animations: "+llList2CSV(earAnims));
  105. }else
  106. if(m == "eye"){
  107. string prop = llList2String(params, 1);
  108. if(~llListFindList(eyeAnims, (list)prop)){
  109. llStopAnimation(eyeAnim);
  110. llStartAnimation(eyeAnim = "Eyes_"+prop);
  111. return;
  112. }else if(prop != ""){
  113. llOwnerSay("Unknown animation for eyes: "+prop);
  114. }
  115. llOwnerSay("Valid eye animations: "+llList2CSV(eyeAnims));
  116. }else
  117. if(m == "tail"){
  118. string prop = llList2String(params, 1);
  119. if(~llListFindList(tailAnims, (list)prop)){
  120. llStopAnimation(tailAnim);
  121. llStartAnimation(tailAnim = "Tail_"+prop);
  122. return;
  123. }else if(prop != ""){
  124. llOwnerSay("Unknown animation for tail: "+prop);
  125. }
  126. llOwnerSay("Valid tail animations: "+llList2CSV(tailAnims));
  127. }
  128. }
  129. }
  130. control(key id, integer level, integer edge){
  131. integer start = level & edge;
  132. integer end = ~level & edge;
  133. integer held = level & ~edge;
  134. integer untouched = ~(level | edge);
  135. if(level&CONTROL_DOWN){
  136. if(llGetAgentInfo(owner)&AGENT_CROUCHING){
  137. if(crouch == 0){
  138. float now = llGetTime();
  139. if(lastCrouch+0.25>now){
  140. llStartAnimation("Crouch_Hide (Extra not important)");
  141. crouch = 2;
  142. }else{
  143. llStartAnimation("Crouch");
  144. crouch = 1;
  145. }
  146. lastCrouch = llGetTime();
  147. }
  148. }
  149. }else if(crouch){
  150. if(crouch==1)llStopAnimation("Crouch");
  151. else if(crouch==2)llStopAnimation("Crouch_Hide (Extra not important)");
  152. crouch = 0;
  153. }
  154. }
  155.  
  156. timer(){
  157. float now = llGetTime();
  158. if(nextAnimTime>now){
  159. integer aid = llFloor(llFrand(3))+2;
  160. string newAnim = "Stnd_"+(string)aid;
  161. llStopAnimation(lastStandAnim);
  162. llStartAnimation(newAnim);
  163. lastStandAnim = newAnim;
  164. nextAnimTime = now+5+llFrand(5);
  165. }
  166. if(llGetAgentInfo(owner)&AGENT_TYPING){
  167. if(!isTyping){
  168. isTyping = TRUE;
  169. llStartAnimation("Talking");
  170. }
  171. }else if(isTyping){
  172. llStopAnimation("Talking");
  173. isTyping = FALSE;
  174. }
  175. }
  176.  
  177. run_time_permissions(integer p){
  178. if(p){
  179. setup();
  180. }
  181. }
  182. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement