// Bromley College // Linden Script Exhibition // Code for poster 35 integer count; vector startPosition; float groundLevel; default { state_entry() { llSetTimerEvent( 0 ); //disable timer startPosition = llGetPos(); groundLevel = llGround( startPosition ); } touch_start(integer total_number) //wait for an avatar to touch chair { llSay(0, "Respond to the dialog box and then sit on the chair. Once sat touch the chair again"); llRequestPermissions(llDetectedKey(0), PERMISSION_TAKE_CONTROLS); //ask permission to take control of the agent's keys. state new; } } state new { touch_start(integer total_number) { count == 0; // zero count llSetTimerEvent( 1 ); //enable one second timer event if ((llGetPermissions() & PERMISSION_TAKE_CONTROLS)) //if take control permission has been given { llSay(0, "Control Granted. You can now use your forward and back arrow keys to control the chair"); llTakeControls( CONTROL_FWD | CONTROL_BACK, TRUE, FALSE ); //state default; } if (! (llGetPermissions() & PERMISSION_TAKE_CONTROLS)) //if control permission has not been given { llSay(0, "Agent has not given permission"); llResetScript(); } } control( key id, integer held, integer change ) // event for processing key press. { vector position = llGetPos(); if ( change & held & CONTROL_FWD ) { // the "move forward" control has been activated. if( position.z < (startPosition.z + 10.0) ) { llSetPos( llGetPos() + < 0, 0, 1.0 >); // move up } } else if ( change & held & CONTROL_BACK ) { // the "move backward" key has been activated. if( position.z > groundLevel + 1.0 ) { llSetPos( llGetPos() + < 0, 0, -1.0 >); // move down } } } timer () // Reset the object to it's original position after 20 seconds { count ++; //increment count if(count > 20) // reset after 20 secs { llSetPos( startPosition ); llResetScript(); } } } // End of code;