Linden脚本语言奇怪的语法错误

时间:2017-07-11 00:20:25

标签: syntax syntax-error linden-scripting-language secondlife

任何人都可以告诉我这个脚本中的语法错误是什么?它说(54,8) 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>);            }
        }

1 个答案:

答案 0 :(得分:1)

如果这是整个脚本,则缺少控件事件和默认状态的右括号。

顺便说一下:

  1. 您的格式不一致。选择一种风格并坚持下去,这样的事情会更加引人注目。

  2. 我不知道你正在使用什么样的观众,但是在Firestorm中,编译你的脚本没有丢失的括号给了我这样的信息:

    (54,10) mismatched input '<EOF>' expecting '}'
    1 syntax error(s)
    
  3. 这比语法错误更有帮助。