1
0

KanEd-Test03.lsl 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. integer counter;
  2. integer second;
  3. default
  4. {
  5. state_entry()
  6. {
  7. llSay( 0, "Hello, Avatar! Touch to change color and size.");
  8. counter = 0;
  9. }
  10. touch_start(integer total_number)
  11. {
  12. counter = counter + 1;
  13. llSay( 0, "Touched by angel number " + (string)counter);
  14. llSetTimerEvent( 2 ); // create a "timer event" every 2 seconds.
  15. }
  16. timer() // do these instructions every time the timer event occurs.
  17. {
  18. second++;
  19. // choose three random RGB color components between 0. and 1.0.
  20. float red = llFrand( 1.0 );
  21. float green = llFrand( 1.0 );
  22. float blue = llFrand( 1.0 );
  23. // combine color components into a vector and use that vector
  24. // to set object color.
  25. vector prim_color = < red, green, blue >;
  26. llSetColor( prim_color, ALL_SIDES ); // set object color to new color.
  27. // a choose random number between 0. and 10 for use as a scale factor.
  28. float new_scale = llFrand( 10.0 );
  29. llSetScale(< new_scale, new_scale, new_scale > ); // set object scale.
  30. if ( second > 19 ) // then time to wrap this up.
  31. {
  32. // turn object black, print "resting" message, and reset object....
  33. llSetColor( < 0, 0, 0 >, ALL_SIDES );
  34. llSay( 0, "Object now resting and resetting script." );
  35. llResetScript(); // return object to ready state.
  36. }
  37. }
  38. }