aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/bin/assets/ScriptsAssetSet/KanEd-Test09.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-Test09.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-Test09.lsl')
-rw-r--r--bin/assets/ScriptsAssetSet/KanEd-Test09.lsl71
1 files changed, 71 insertions, 0 deletions
diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test09.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test09.lsl
new file mode 100644
index 0000000..095f942
--- /dev/null
+++ b/bin/assets/ScriptsAssetSet/KanEd-Test09.lsl
@@ -0,0 +1,71 @@
1vector startPos;
2vector curPos;
3vector curForce;
4integer second;
5
6default
7{
8 state_entry()
9 {
10 llSay( 0, "Hello, Avatar! Touch to launch me straight up.");
11 llSetStatus( 1, TRUE );
12 startPos = < 0, 0, 0 >;
13 }
14
15 touch_start(integer total_number)
16 {
17 startPos = llGetPos();
18 curPos = startPos;
19 curForce = < 0, 0, 0 >;
20 second = 0;
21
22 llSetColor( < 1.0, 0.0, 0.0 > , ALL_SIDES ); // set color to red.
23
24 float objMass = llGetMass();
25 float Z_force = 10.2 * objMass;
26
27 llSetForce( < 0.0, 0.0, Z_force >, FALSE );
28
29 llSay( 0, "Force of " + (string)Z_force + " being applied." );
30 llSetTimerEvent(1);
31 }
32
33 timer()
34 {
35 second++;
36 curPos = llGetPos();
37 float curDisplacement = llVecMag( curPos - startPos );
38
39 if( ( curDisplacement > 30. ) && // then object is too far away, and
40 ( llGetForce() != < 0.0, 0.0, 0.0 > ) ) // force not already zero,
41 { // then let gravity take over, and change color to green.
42 llSetForce( < 0.0, 0.0, 0.0 >, FALSE );
43 llSetColor( < 0, 1.0, 0 >, ALL_SIDES );
44 llSay( 0, "Force removed; object in free flight." );
45 }
46
47 if ( second > 19 ) // then time to wrap this up.
48 {
49 // turn object blue and zero force to be safe....
50 llSetColor( < 0, 0, 1.0 >, ALL_SIDES ); // change color to blue.
51 llSetForce( < 0, 0, 0 >, FALSE );
52
53 // ...move object back to starting position...
54 // ...after saving current status of Physics attribute.
55 integer savedStatus = llGetStatus( 1 );
56 llSetStatus( 1, FALSE ); // turn physics off.
57 while ( llVecDist( llGetPos(), startPos ) > 0.001)
58 {
59 llSetPos( startPos );
60 }
61 llSetStatus( 1, savedStatus ); // restore Physics status.
62
63 //...and then turn color to black and Reset the script.
64 llSetColor( < 1, 1, 1 >, ALL_SIDES );
65 llSetTimerEvent( 0 ); // turn off timer events.
66 llSay( 0, "Done and resetting script." );
67 llResetScript(); // return object to ready state.
68 }
69 }
70}
71