View difference between Paste ID: DKYzck2C and GNqCQm7Z
SHOW: | | - or go back to the newest paste.
1
float spin_rate = 0.20;
2
float roll_rate = 0.00;
3
float yaw_rate  = 0.00;
4
5
integer LOCAL_AXIS = TRUE; 
6
7
string  CONTROLLER_ID = "A";
8-
integer AUTO_START = TRUE;
8+
integer AUTO_START = FALSE;
9
10
rotation adjustment = ZERO_ROTATION;
11
12
integer iStarted = FALSE;
13
14
randomllTargetOmega()
15
{
16
        spin_rate = llFrand(2.0) - 1.0;
17
        roll_rate = llFrand(2.0) - 1.0;
18
        yaw_rate  = llFrand(2.0) - 1.0;
19
20
        llTargetOmega( <roll_rate, yaw_rate, spin_rate>*adjustment, 2.0, 2.0 );
21
}
22
default
23
{
24
    state_entry()
25
    {
26
        llTargetOmega( <0, 0, 0>, 1.0, 1.0 );
27
        llSetTimerEvent(0.1);
28
29
        if ( LOCAL_AXIS ) adjustment = llGetRot();
30
31
        if ( AUTO_START )
32
        {
33
         iStarted = TRUE;
34
        }
35
36
    }
37
38
    link_message( integer sibling, integer num, string mesg, key target_key )
39
    {
40
        if ( mesg != CONTROLLER_ID )
41
        {
42
            return;
43
        }
44
        else if ( num == 0 )
45
        {
46
            llTargetOmega( <0, 0, 0>, 1.0, 1.0 );
47
            iStarted = FALSE;
48
            llSetLocalRot( llGetLocalRot() );
49
        }
50
        else if ( num == 1 )
51
        {
52
            iStarted = TRUE;
53
        }
54
        else
55
        {
56
        }
57
    }
58
    timer()
59
    {
60
     if (iStarted)
61
     {
62
      randomllTargetOmega();
63
     }
64
    }    changed(integer change)
65
    {
66
        if (change & CHANGED_LINK)
67
        {
68
            if (llGetNumberOfPrims() > 7)
69
            {
70
                 iStarted = TRUE;
71
            } else {
72
                if (iStarted && !AUTO_START)
73
                {
74
                    llTargetOmega( <0, 0, 0>, 1.0, 1.0 );
75
                    iStarted = FALSE;
76
                    llSetLocalRot( llGetLocalRot() );
77
                }
78
            }
79
        }
80
    }
81
}