xs_two-texture eyes.lsl 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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:1436
  9. // :REV:0.50
  10. // :WORLD:Second Life, OpenSim
  11. // :DESCRIPTION:
  12. // XS Pet xs_texture-two eyes
  13. // :CODE:
  14. // xs_texture-two eyes
  15. // the names of the textures for eyes that shut and close by flipping between them.
  16. string OPEN = "eyes open"; // awake
  17. string CLOSED = "eyes closed"; // sleeping
  18. string DEAD = "eyes dead"; // could be a copy of eyes closed, or (X)(X)
  19. string ANI_DIE = "death"; // a string taught to the pet by the animator when the animal is to die.
  20. string ANI_SLEEP = "sleep"; // Sleeping
  21. string ANI_STAND = "stand"; // default standing animation
  22. integer flags;
  23. // Original Particle Script 0.4j
  24. // Created by Ama Omega 3-7-2004
  25. // Updated by Jopsy Pendragon 5-11-2004
  26. // For classes/tutorials/tricks, visit the Particle Labratory in Teal
  27. // Values marked with (*) are defaults.
  28. // SECTION ONE: APPEARANCE -- These settings affect how each particle LOOKS.
  29. integer glow = TRUE; // TRUE or FALSE(*)
  30. vector startColor = <1,1,1>; // RGB color, black<0,0,0> to white<1,1,1>(*)
  31. vector endColor = <1,1,1>; //
  32. float startAlpha = 1.0; // 0.0 to 1.0(*), lower = more transparent
  33. float endAlpha = 1.0; //
  34. vector startSize = <0.1,0.1,0>; // <0.04,0.04,0>(min) to <10,10,0>(max>, <1,1,0>(*)
  35. vector endSize = <.3,.3,0>; // (Z part of vector is discarded)
  36. key texture = "f9b67edf-d837-e507-361b-0d34f4c64396"; // Texture used for particles. Texture must be in prim's inventory.
  37. // SECTION TWO: FLOW -- These settings affect how Many, how Quickly, and for how Long particles are created.
  38. // Note,
  39. integer count = 1; // Number of particles created per burst, 1(*) to 4096
  40. float rate = 1.0; // Delay between bursts of new particles, 0.0 to 60, 0.1(*)
  41. float age = 5.0; // How long each particle lives, 0.1 to 60, 10.0(*)
  42. float life = 0.0; // When to stop creating new particles. never stops if 0.0(*)
  43. // SECTION THREE: PLACEMENT -- Where are new particles created, and what direction are they facing?
  44. float radius = .30; // 0.0(default) to 64? Distance from Emitter where new particles are created.
  45. float innerAngle = 0.75; // "spread", for all ANGLE patterns, 0(default) to PI
  46. float outerAngle = 0.0; // "tilt", for ANGLE patterns, 0(default) to TWO_PI, can use PI_BY_TWO or PI as well.
  47. integer pattern = PSYS_SRC_PATTERN_ANGLE_CONE; // Choose one of the following:
  48. // PSYS_SRC_PATTERN_EXPLODE (sends particles in all directions)
  49. // PSYS_SRC_PATTERN_DROP (ignores minSpeed and maxSpeed. Don't bother with count>1 )
  50. // PSYS_SRC_PATTERN_ANGLE_CONE (set innerangle/outerange to make rings/cones of particles)
  51. // PSYS_SRC_PATTERN_ANGLE (set innerangle/outerangle to make flat fanshapes of particles)
  52. vector omega = <0,0,0>; // How much to rotate the emitter around the <X,Y,Z> axises. <0,0,0>(*)
  53. // Warning, there's no way to RESET the emitter direction once you use Omega!!
  54. // You must attach the script to a new prim to clear the effect of omega.
  55. // SECTION FOUR: MOVEMENT -- How do the particles move once they're created?
  56. integer followSource = FALSE; // TRUE or FALSE(*), Particles move as the emitter moves, (TRUE disables radius!)
  57. integer followVel = FALSE; // TRUE or FALSE(*), Particles rotate towards their direction
  58. integer wind = FALSE; // TRUE or FALSE(*), Particles get blown away by wind in the sim
  59. integer bounce = TRUE; // TRUE or FALSE(*), Make particles bounce on Z altitude of emitter
  60. float minSpeed = 0.1; // 0.01 to ? Min speed each particle is spit out at, 1.0(*)
  61. float maxSpeed = 0.2; // 0.01 to ? Max speed each particle is spit out at, 1.0(*)
  62. vector push = <0,0,-0.3>; // Continuous force pushed on particles, use small settings for long lived particles
  63. key target = ""; // Select a target for particles to arrive at when they die
  64. // can be "self" (emitter), "owner" (you), "" or any prim/persons KEY.
  65. list sys;
  66. updateParticles()
  67. {
  68. flags = 0;
  69. if (target == "owner") target = llGetOwner();
  70. if (target == "self") target = llGetKey();
  71. if (glow) flags = flags | PSYS_PART_EMISSIVE_MASK;
  72. if (bounce) flags = flags | PSYS_PART_BOUNCE_MASK;
  73. if (startColor != endColor) flags = flags | PSYS_PART_INTERP_COLOR_MASK;
  74. if (startSize != endSize) flags = flags | PSYS_PART_INTERP_SCALE_MASK;
  75. if (wind) flags = flags | PSYS_PART_WIND_MASK;
  76. if (followSource) flags = flags | PSYS_PART_FOLLOW_SRC_MASK;
  77. if (followVel) flags = flags | PSYS_PART_FOLLOW_VELOCITY_MASK;
  78. if (target != "") flags = flags | PSYS_PART_TARGET_POS_MASK;
  79. sys = [ PSYS_PART_MAX_AGE,age,
  80. PSYS_PART_FLAGS,flags,
  81. PSYS_PART_START_COLOR, startColor,
  82. PSYS_PART_END_COLOR, endColor,
  83. PSYS_PART_START_SCALE,startSize,
  84. PSYS_PART_END_SCALE,endSize,
  85. PSYS_SRC_PATTERN, pattern,
  86. PSYS_SRC_BURST_RATE,rate,
  87. PSYS_SRC_ACCEL, push,
  88. PSYS_SRC_BURST_PART_COUNT,count,
  89. PSYS_SRC_BURST_RADIUS,radius,
  90. PSYS_SRC_BURST_SPEED_MIN,minSpeed,
  91. PSYS_SRC_BURST_SPEED_MAX,maxSpeed,
  92. PSYS_SRC_TARGET_KEY,target,
  93. PSYS_SRC_INNERANGLE,innerAngle,
  94. PSYS_SRC_OUTERANGLE,outerAngle,
  95. PSYS_SRC_OMEGA, omega,
  96. PSYS_SRC_MAX_AGE, life,
  97. PSYS_SRC_TEXTURE, texture,
  98. PSYS_PART_START_ALPHA, startAlpha,
  99. PSYS_PART_END_ALPHA, endAlpha
  100. ];
  101. float newrate = rate;
  102. if (newrate == 0.0) newrate=.01;
  103. if ( (age/rate)*count < 4096) llParticleSystem(sys);
  104. else {
  105. llInstantMessage(llGetOwner(),"Your particle system creates too many concurrent particles.");
  106. llInstantMessage(llGetOwner(),"Reduce count or age, or increate rate.");
  107. llParticleSystem( [ ] );
  108. }
  109. }
  110. default
  111. {
  112. on_rez(integer startparam)
  113. {
  114. llResetScript();
  115. }
  116. state_entry()
  117. {
  118. llSetTexture(OPEN, ALL_SIDES); // open
  119. llSetTimerEvent(llFrand(3) + 3);
  120. }
  121. timer()
  122. {
  123. llSetTexture(CLOSED, ALL_SIDES); // closed
  124. llSleep(llFrand(0.2) + .1); // sometimes blink a little faster, from 0.2 to 0.3
  125. llSetTexture(OPEN, ALL_SIDES); // open
  126. llSetTimerEvent(llFrand(3) + 3); // make them blink randomly
  127. }
  128. link_message(integer sender, integer num, string str, key id)
  129. {
  130. if (num == 1 && str == ANI_SLEEP )
  131. {
  132. llSetTexture(CLOSED, ALL_SIDES); //closed
  133. updateParticles(); // turn on particle Zzzz's
  134. llSetTimerEvent(0); // no blink
  135. }
  136. else if (num == 1 && str == ANI_STAND)
  137. {
  138. llParticleSystem( [] ); // turn off particle ZZZ's by sending an empty list
  139. llSetTexture(OPEN, ALL_SIDES); //open
  140. llSetTimerEvent(llFrand(3) + 3);
  141. }
  142. else if (num == 1 && str == ANI_DIE)
  143. {
  144. llSetTexture(DEAD ,ALL_SIDES) ; // dead eye (X)(X) texture
  145. llParticleSystem( [ ] ); // turn off particle ZZZ's
  146. llSetTimerEvent(0); // no blink
  147. }
  148. }
  149. }