GLHF
GLHF

Reputation: 4034

Linden Scripting Language Weird Syntax Error

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>);            }
        }

Upvotes: 0

Views: 172

Answers (1)

Jeanne Pindar
Jeanne Pindar

Reputation: 627

If that's the whole script, you are missing the closing brackets for both the control event and the default state.

By the way:

  1. Your formatting is inconsistent. Choose a style and stick with it, and things like this will be more noticeable.

  2. I don't know what viewer you're using, but in Firestorm, compiling your script without the missing brackets gave me the message:

    (54,10) mismatched input '<EOF>' expecting '}'
    1 syntax error(s)
    

which is rather more helpful than just a syntax error.

Upvotes: 1

Related Questions