1
0

KanEd-Test14.lsl 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. integer createdObjectCounter;
  2. integer linkedObjectCounter;
  3. default
  4. {
  5. state_entry()
  6. {
  7. llSay( 0, "Hello, Avatar!");
  8. linkedObjectCounter = 0; // zero the linked object counter.
  9. }
  10. touch_start(integer total_number)
  11. {
  12. if( createdObjectCounter <= 0 ) // nothing has yet been linked,
  13. { // begin object creation sequence...
  14. // ask for permissions now, since it will be too late later.
  15. llRequestPermissions( llGetOwner(), PERMISSION_CHANGE_LINKS );
  16. }
  17. else // just do whatever should be done upon touch without
  18. { // creating new objects to link.
  19. // insert commands here to respond to a touch.
  20. }
  21. }
  22. run_time_permissions( integer permissions_granted )
  23. {
  24. if( permissions_granted == PERMISSION_CHANGE_LINKS )
  25. { // create 2 objects.
  26. llRezObject("Object1", llGetPos() + < 1, 0, 2 >,
  27. ZERO_VECTOR, ZERO_ROTATION, 42);
  28. createdObjectCounter = createdObjectCounter + 1;
  29. llRezObject("Object1", llGetPos() + < -1, 0, 2 >,
  30. ZERO_VECTOR, ZERO_ROTATION, 42);
  31. createdObjectCounter = createdObjectCounter + 1;
  32. }
  33. else
  34. {
  35. llOwnerSay( "Didn't get permission to change links." );
  36. return;
  37. }
  38. }
  39. object_rez( key child_id )
  40. {
  41. llOwnerSay( "rez happened and produced object with key " +
  42. (string)child_id );
  43. // link as parent to the just created child.
  44. llCreateLink( child_id, TRUE );
  45. // if all child objects have been created then the script can
  46. // continue to work as a linked set of objects.
  47. linkedObjectCounter++;
  48. if( linkedObjectCounter >= 2 )
  49. {
  50. // Change all child objects in the set to red (including parent).
  51. llSetLinkColor( LINK_ALL_CHILDREN, < 1, 0, 0 >, ALL_SIDES );
  52. // Make child object "2" half-tranparent.
  53. llSetLinkAlpha( 2, .5, ALL_SIDES );
  54. // Insert commands here to manage subsequent activity of the
  55. // linkset, like this command to rotate the result:
  56. // llTargetOmega( < 0, 1, 1 >, .2 * PI, 1.0 );
  57. }
  58. }
  59. }