KanEd-Test02.lsl 989 B

12345678910111213141516171819202122232425262728293031
  1. integer counter;
  2. default
  3. {
  4. state_entry()
  5. {
  6. llSay( 0, "Hello, Avatar! Touch to change color and size.");
  7. counter = 0;
  8. }
  9. touch_start(integer total_number)
  10. { // do these instructions when the object is touched.
  11. counter = counter + 1;
  12. // choose three random RGB color components between 0. and 1.0.
  13. float redness = llFrand( 1.0 );
  14. float greenness = llFrand( 1.0 );
  15. float blueness = llFrand( 1.0 );
  16. // combine color components into a vector and use that vector
  17. // to set object color.
  18. vector prim_color = < redness, greenness, blueness >;
  19. llSetColor( prim_color, ALL_SIDES ); // set object color to new color.
  20. // choose a random number between 0. and 10. for use as a scale factor.
  21. float new_scale = llFrand(10.0) + 1.0;
  22. llSetScale(< new_scale, new_scale, new_scale > ); // set object scale.
  23. llSay( 0, "Touched by angel number " + (string)counter);
  24. }
  25. }