xs_animated_eye script.lsl 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. // :CATEGORY:XS Pet
  2. // :NAME:XS Pet Robot
  3. // :AUTHOR:Ferd Frederix
  4. // :KEYWORDS: Pet,XS,breed,breedable,companion,Ozimal,Meeroo,Amaretto,critter,Fennux,Pets
  5. // :CREATED:2013-09-06
  6. // :EDITED:2014-01-30 12:24:20
  7. // :ID:988
  8. // :NUM:1434
  9. // :REV:0.50
  10. // :WORLD:Second Life, OpenSim
  11. // :DESCRIPTION:
  12. // XS Pet xs_eye script
  13. // :CODE:
  14. // xs_eye script
  15. // blinking eye plug in script.lsl
  16. // Use this with eyes made by the Gif2SL converter
  17. /////////////////////////////////////////////////////////////////////
  18. // This code is licensed as Creative Commons Attribution/NonCommercial/Share Alike
  19. // See http://creativecommons.org/licenses/by-nc-sa/3.0/
  20. // Noncommercial -- You may not use this work for commercial purposes
  21. // If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one.
  22. // This means that you cannot sell this code but you may share this code.
  23. // You must attribute authorship to me and leave this notice intact.
  24. //
  25. // Exception: I am allowing this script to be sold inside an original build.
  26. // You are not selling the script, you are selling the build.
  27. // Ferd Frederix
  28. // Put any texture converted by gif_2_SL_animation_v0.6.exe into a prim with this script to get it to play back automatically as a movie
  29. //
  30. integer nTextures;
  31. integer animOn = TRUE; //Set to FALSE and call initAnim() again to stop the animation.
  32. list effects = [LOOP]; // LOOP for GIF89 movies
  33. integer movement = 0;
  34. integer face = ALL_SIDES; //Number representing the side to activate the animation on.
  35. integer sideX = 1; //Represents how many horizontal images (frames) are contained in your texture.
  36. integer sideY = 1; //Same as sideX, except represents vertical images (frames).
  37. float start = 0.0; //Frame to start animation on. (0 to start at the first frame of the texture)
  38. float length = 0.0; //Number of frames to animate, set to 0 to animate all frames.
  39. float speed = 10.0; //Frames per second to play.
  40. integer i;
  41. fetch()
  42. {
  43. nTextures = llGetInventoryNumber(INVENTORY_TEXTURE);
  44. string texture = llGetInventoryName(INVENTORY_TEXTURE,i);
  45. string texture1 = llGetInventoryName(INVENTORY_TEXTURE,i+1);
  46. llSetTextureAnim(LOOP,ALL_SIDES,1,1, 1,1,1);
  47. llSetTexture(texture,ALL_SIDES);
  48. llSleep(llFrand(5));
  49. list data = llParseString2List(texture1,[";"],[]);
  50. string X = llList2String(data,1);
  51. string Y = llList2String(data,2);
  52. string Z = llList2String(data,3);
  53. sideX = (integer) X;
  54. sideY = (integer) Y;
  55. speed = (float) Z;
  56. float tot = (float) (sideX * sideY);
  57. llSetTextureAnim(ANIM_ON|LOOP,ALL_SIDES,sideX,sideY,start,length,speed);
  58. llSetTexture(texture1,ALL_SIDES);
  59. llSetTimerEvent(tot/10);
  60. }
  61. default
  62. {
  63. state_entry()
  64. {
  65. llSetTimerEvent(1);
  66. }
  67. // touch the prim to switch to a pair of flipping textures, one of them a movie
  68. touch_start(integer p)
  69. {
  70. i+=2;
  71. if (i >= nTextures)
  72. {
  73. i = 0;
  74. }
  75. }
  76. timer()
  77. {
  78. fetch();
  79. }
  80. }