Advertisement
BlueWall

Animation Script

Mar 2nd, 2012
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. //
  2. // Simple Walk
  3. // Copyright (c) 2009, the owner of avatar Catherine Pfeffer
  4. // Distributed under GPL license version 2
  5. // See details at http://www.gnu.org/licenses/gpl-2.0.html
  6. //
  7. // @BlueWall Added check in changed event for animation change (available on OpenSim)
  8. //
  9.  
  10. string VERSION = "1.0";
  11.  
  12. string animation;
  13. string old_anim;
  14. key owner;
  15.  
  16. default
  17. {
  18. state_entry()
  19. {
  20. integer perms = llGetPermissions();
  21.  
  22. animation = llGetInventoryName(INVENTORY_ANIMATION, 0);
  23. old_anim = "Standing";
  24. owner = llGetOwner();
  25.  
  26. llSetAlpha(0.0, ALL_SIDES);
  27. llOwnerSay("version " + VERSION + ".");
  28.  
  29. if (perms & PERMISSION_TAKE_CONTROLS)
  30. state enabled;
  31. llRequestPermissions(llGetOwner(),
  32. PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION);
  33. }
  34.  
  35. run_time_permissions(integer perms)
  36. {
  37. llSay(0,"Yow");
  38. if (perms & PERMISSION_TAKE_CONTROLS)
  39. {
  40. integer desired_controls =
  41. CONTROL_FWD | CONTROL_BACK | CONTROL_UP | CONTROL_DOWN;
  42.  
  43. llTakeControls(desired_controls, TRUE, TRUE);
  44. state enabled;
  45. }
  46. }
  47. }
  48.  
  49. state enabled
  50. {
  51. state_entry()
  52. {
  53. llOwnerSay("ready.");
  54. }
  55.  
  56. on_rez(integer param)
  57. {
  58. llResetScript();
  59. }
  60.  
  61. changed(integer _ch)
  62. {
  63. if(( _ch & CHANGED_ANIMATION) == CHANGED_ANIMATION)
  64. {
  65. if (llGetAnimation(llGetOwner()) != "Walking")
  66. {
  67. llStopAnimation(animation);
  68. }
  69. }
  70. }
  71.  
  72. control(key id, integer held, integer change)
  73. {
  74. string new_anim = llGetAnimation(owner);
  75.  
  76. if (new_anim != old_anim)
  77. {
  78. if (new_anim == "Walking")
  79. llStartAnimation(animation);
  80. old_anim = new_anim;
  81. }
  82. }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement