Can anyone enlight me what is the syntax error in this script? It says (54,8) Syntax error
which is the last bracket. How on the earth last bracket is syntax error?
vector startPosition;
float groundLevel;
default
{
state_entry()
{
// get permission to take over the avatar's control inputs.
llRequestPermissions( llGetOwner(), PERMISSION_TAKE_CONTROLS );
startPosition = llGetPos();
groundLevel = llGround( startPosition );
}
run_time_permissions( integer perm ) // event for processing
// permission dialog.
{
if ( perm & PERMISSION_TAKE_CONTROLS ) // permission has been given.
{
// go ahead and take over the forward and backward controls.
llTakeControls( CONTROL_FWD | CONTROL_BACK | CONTROL_LEFT | CONTROL_RIGHT, TRUE, FALSE );
}
}
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.y < (startPosition.y + 10.0) )
{
llSetPos( llGetPos() + < 0, 0.5,0>); // move up
}
}
else if ( change & held & CONTROL_BACK )
{ // the "move backward" key has been activated.
if( position.y > groundLevel + 1.0 )
{
llSetPos( llGetPos() + < 0,-0.5,0>); // move down
}
}
if ( change & held & CONTROL_RIGHT) { // the "move forward" control has been activated.
if( position.x < (startPosition.x + 10.0) )
{
llSetPos( llGetPos() + < 0.5,0,0>);
}
}
else if ( change & held & CONTROL_LEFT)
{
if( position.y > groundLevel + 1.0 )
{
llSetPos( llGetPos() + < -0.5,0,0>); }
}