aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/bin/assets/ScriptsAssetSet/KanEd-Test04.lsl
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-01-12 18:00:46 +0000
committerJustin Clarke Casey2009-01-12 18:00:46 +0000
commitfb8faa8336ddb795ccd6840259b06a2608350a57 (patch)
tree1f4977b9918d416602af88709e15aecf9499b969 /bin/assets/ScriptsAssetSet/KanEd-Test04.lsl
parent* Remove FunSLUDP code since this has moved to http://forge.opensimulator.org... (diff)
downloadopensim-SC_OLD-fb8faa8336ddb795ccd6840259b06a2608350a57.zip
opensim-SC_OLD-fb8faa8336ddb795ccd6840259b06a2608350a57.tar.gz
opensim-SC_OLD-fb8faa8336ddb795ccd6840259b06a2608350a57.tar.bz2
opensim-SC_OLD-fb8faa8336ddb795ccd6840259b06a2608350a57.tar.xz
* Apply http://opensimulator.org/mantis/view.php?id=2913
* Add the KanEd scripts to the standard library * Thanks Fly-Man-
Diffstat (limited to 'bin/assets/ScriptsAssetSet/KanEd-Test04.lsl')
-rw-r--r--bin/assets/ScriptsAssetSet/KanEd-Test04.lsl51
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 @@
1integer counter;
2integer second;
3vector startPosition;
4
5default
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