aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/bin/assets/ScriptsAssetSet/KanEd-Test10.lsl
diff options
context:
space:
mode:
Diffstat (limited to 'bin/assets/ScriptsAssetSet/KanEd-Test10.lsl')
-rw-r--r--bin/assets/ScriptsAssetSet/KanEd-Test10.lsl57
1 files changed, 57 insertions, 0 deletions
diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test10.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test10.lsl
new file mode 100644
index 0000000..de16df7
--- /dev/null
+++ b/bin/assets/ScriptsAssetSet/KanEd-Test10.lsl
@@ -0,0 +1,57 @@
1vector startPosition;
2float groundLevel;
3
4default
5{
6 state_entry()
7 {
8 llListen( 0, "", llGetOwner(), "");
9
10 startPosition = llGetPos();
11 groundLevel = llGround( startPosition );
12
13 llSay( 0, "Control this object with chat commands like:" );
14 llSay( 0, "'up' or 'down' followed by a distance." );
15 }
16
17 listen( integer channel, string name, key id, string message )
18 {
19 // separate the input into blank-delmited tokens.
20 list parsed = llParseString2List( message, [ " " ], [] );
21
22 // get the first part--the "command".
23 string command = llList2String( parsed, 0 );
24
25 // get the second part--the "distance".
26 string distance_string = llList2String( parsed, 1 );
27 float distance = ( float )distance_string;
28
29 vector position = llGetPos();
30
31 if( command == "up" )
32 {
33 if( ( position.z + distance ) < (startPosition.z + 10.0 ) )
34 {
35 llSetPos( llGetPos() + < 0, 0, distance > ); // move up
36 llSetText( "Went up " + (string)distance, < 1, 0, 0 >, 1 );
37 }
38 else
39 {
40 llSetText( "Can't go so high.", < 1, 0, 0 >, 1 );
41 }
42 }
43 else if( command == "down" )
44 {
45 if( ( position.z - distance ) > groundLevel )
46 {
47 llSetPos( llGetPos() + < 0, 0, -distance > ); // move down
48 llSetText( "Went down " + (string)distance, < 1, 0, 0 >, 1 );
49 }
50 else
51 {
52 llSetText( "Can't go so low.", < 1, 0, 0 >, 1 );
53 }
54 }
55 }
56}
57