aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/bin/assets/ScriptsAssetSet/KanEd-Test14.lsl
blob: 2c6003581075562e999a4d761bcba7689d559da6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
integer createdObjectCounter;
integer linkedObjectCounter;

default
{
   state_entry()
   {
       llSay( 0, "Hello, Avatar!");
       linkedObjectCounter = 0;  // zero the linked object counter.
   }

   touch_start(integer total_number)
   {
       if( createdObjectCounter <= 0 )  // nothing has yet been linked,
       {                               // begin object creation sequence...
          // ask for permissions now, since it will be too late later.
          llRequestPermissions( llGetOwner(), PERMISSION_CHANGE_LINKS );
       }
       else   // just do whatever should be done upon touch without
       {      // creating new objects to link. 
           // insert commands here to respond to a touch.
       }
   }
 
   run_time_permissions( integer permissions_granted )
   {
      if( permissions_granted == PERMISSION_CHANGE_LINKS )
      {   // create 2 objects.
          llRezObject("Object1", llGetPos() + < 1, 0, 2 >, 
                      ZERO_VECTOR, ZERO_ROTATION, 42);
          createdObjectCounter = createdObjectCounter + 1;

          llRezObject("Object1", llGetPos() + < -1, 0, 2 >, 
                      ZERO_VECTOR, ZERO_ROTATION, 42);
          createdObjectCounter = createdObjectCounter + 1;

      }
      else
      {
          llOwnerSay( "Didn't get permission to change links." );
          return;
      }
   }
 
   object_rez( key child_id )
   {
       llOwnerSay( "rez happened and produced object with key " + 
                    (string)child_id );
 
       // link as parent to the just created child.
       llCreateLink( child_id, TRUE ); 
 
       // if all child objects have been created then the script can
       // continue to work as a linked set of objects.
       linkedObjectCounter++;
       if( linkedObjectCounter >= 2 ) 
       {
           // Change all child objects in the set to red (including parent).
           llSetLinkColor( LINK_ALL_CHILDREN, < 1, 0, 0 >, ALL_SIDES );  
 
           // Make child object "2" half-tranparent.
           llSetLinkAlpha( 2, .5, ALL_SIDES );

           // Insert commands here to manage subsequent activity of the 
           // linkset, like this command to rotate the result:
           // llTargetOmega( < 0, 1, 1 >, .2 * PI, 1.0 );
       }
   }
}