diff options
Diffstat (limited to '')
-rw-r--r-- | bin/assets/ScriptsAssetSet/KanEd-Test04.lsl | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test04.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test04.lsl new file mode 100644 index 0000000..5aa25af --- /dev/null +++ b/bin/assets/ScriptsAssetSet/KanEd-Test04.lsl | |||
@@ -0,0 +1,51 @@ | |||
1 | integer counter; | ||
2 | integer second; | ||
3 | vector startPosition; | ||
4 | |||
5 | default | ||
6 | { | ||
7 | state_entry() | ||
8 | { | ||
9 | llSay( 0, "Hello, Avatar! Touch to change position."); | ||
10 | counter = 0; | ||
11 | startPosition = llGetPos(); | ||
12 | } | ||
13 | |||
14 | touch_start(integer total_number) | ||
15 | { | ||
16 | counter = counter + 1; | ||
17 | |||
18 | llSay( 0, "Touched by angel number " + (string)counter); | ||
19 | |||
20 | llSetTimerEvent( 1 ); // arrange for a "timer event" every second. | ||
21 | } | ||
22 | |||
23 | timer() // do these instructions every time the timer event occurs. | ||
24 | { | ||
25 | second++; | ||
26 | |||
27 | // choose three random distances between 0. and 10.0. | ||
28 | float X_distance = llFrand( 10.0 ); | ||
29 | float Y_distance = llFrand( 10.0 ); | ||
30 | float Z_distance = llFrand( 10.0 ); | ||
31 | |||
32 | // combine these distance components into a vector and use it | ||
33 | // to increment the starting position and reposition the object. | ||
34 | vector increment = < X_distance, Y_distance, Z_distance >; | ||
35 | vector newPosition = startPosition + increment; | ||
36 | llSetPos( newPosition ); // reposition object. | ||
37 | |||
38 | if ( second > 19 ) // then time to wrap this up. | ||
39 | { | ||
40 | // move object back to starting position... | ||
41 | while ( llVecDist( llGetPos(), startPosition ) > 0.001) | ||
42 | { | ||
43 | llSetPos( startPosition ); | ||
44 | } | ||
45 | |||
46 | llSay( 0, "Object now resting and resetting script." ); | ||
47 | llResetScript(); // return object to ready state. | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | |||