Wing controller.lsl 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // :CATEGORY:Bird
  2. // :NAME:flamingo
  3. // :AUTHOR:Ferd Frederix
  4. // :CREATED:2013-09-06
  5. // :EDITED:2013-09-18 15:38:53
  6. // :ID:314
  7. // :NUM:415
  8. // :REV:1
  9. // :WORLD:Second Life
  10. // :DESCRIPTION:
  11. // Wing control
  12. // :CODE:
  13. // Bird flock Wing controller script
  14. // Author: Ferd Frederix
  15. // This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
  16. // This means that this script itself is not for sale, that the script must be full Mod at all time, and that modifications to it MUST be provided to anyone upon request. Pets made with this script may be sold. ~ Ferd Frederix
  17. // 5-26-2013
  18. // Goes into the body of the pet with the SOUND file
  19. // 1 ourt of 3 cycles pushes down
  20. integer STROKE = 2; // bigger is a harder stroke, max is 10
  21. float STROKETIME = 0.5; // a wing cycle is twice a stroke
  22. integer counter = -1; // boolean for wing up/down
  23. string SOUND = "flying-dragon";
  24. default
  25. {
  26. timer()
  27. {
  28. counter = ~counter; // -1 = 0 = -1
  29. if (counter)
  30. {
  31. llMessageLinked( LINK_SET, -STROKE, "flap",""); // tell the wing to flup up/down
  32. llPlaySound(SOUND,1.0);
  33. }
  34. else
  35. {
  36. llMessageLinked( LINK_SET, STROKE, "flap",""); // tell the wing to flup up/down
  37. }
  38. }
  39. link_message(integer from, integer num, string str, key id)
  40. {
  41. llOwnerSay(str);
  42. if (str =="fly")
  43. {
  44. llSetTimerEvent(STROKETIME);
  45. }
  46. else if (str =="land")
  47. {
  48. llSetTimerEvent(0);
  49. }
  50. }
  51. on_rez(integer p)
  52. {
  53. llResetScript();
  54. }
  55. }