clockwerk-opensim-config – Blame information for rev 9

Subversion Repositories:
Rev:
Rev Author Line No. Line
9 vero 1 vector startPosition;
2 float groundLevel;
3  
4 default
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