aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/bin/assets/ScriptsAssetSet/KanEd-Test12.lsl
diff options
context:
space:
mode:
Diffstat (limited to 'bin/assets/ScriptsAssetSet/KanEd-Test12.lsl')
-rw-r--r--bin/assets/ScriptsAssetSet/KanEd-Test12.lsl46
1 files changed, 46 insertions, 0 deletions
diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test12.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test12.lsl
new file mode 100644
index 0000000..eaa885b
--- /dev/null
+++ b/bin/assets/ScriptsAssetSet/KanEd-Test12.lsl
@@ -0,0 +1,46 @@
1vector startPosition;
2float groundLevel;
3
4default
5{
6 state_entry()
7 {
8 // get permission to take over the avatar's control inputs.
9 llRequestPermissions( llGetOwner(), PERMISSION_TAKE_CONTROLS );
10
11 startPosition = llGetPos();
12 groundLevel = llGround( startPosition );
13 }
14
15 run_time_permissions( integer perm ) // event for processing
16 // permission dialog.
17 {
18 if ( perm & PERMISSION_TAKE_CONTROLS ) // permission has been given.
19 {
20 // go ahead and take over the forward and backward controls.
21 llTakeControls( CONTROL_FWD | CONTROL_BACK, TRUE, FALSE );
22 }
23 }
24
25 control( key id, integer held, integer change ) // event for processing
26 // key press.
27 {
28 vector position = llGetPos();
29
30 if ( change & held & CONTROL_FWD )
31 { // the "move forward" control has been activated.
32 if( position.z < (startPosition.z + 10.0) )
33 {
34 llSetPos( llGetPos() + < 0, 0, 1.0 >); // move up
35 }
36 }
37 else if ( change & held & CONTROL_BACK )
38 { // the "move backward" key has been activated.
39 if( position.z > groundLevel + 1.0 )
40 {
41 llSetPos( llGetPos() + < 0, 0, -1.0 >); // move down
42 }
43 }
44 }
45}
46