"Syntax error: expecting rightparen before not." <- I looked around, but I can't explain why this appears

"Syntax error: expecting rightparen before not." <- I looked around, but I can't explain why this appears

这个代码有点大,因为它是一个大项目的一部分,但我根本找不到这个问题的解释或解决方案。我在 Java 中使用 Stencylworks 进行编码,我对此还是个新手,所以我将转储整个 class 的代码,因为我真的不知道会发生什么造成它。 (是的,我会在代码中标记错误消息所指的行)

我会post这里的错误信息,但是这里的系统似乎认为它是代码,所以我只说错误都是标题中引用的信息,而且我'在下面的 posted 代码中标记了错误消息所指的行。

这是代码

package scripts
{
    import flash.display.BlendMode;
    import flash.events.*;
    import flash.net.*;
    import flash.filters.*;

    import Box2DAS.Collision.*;
    import Box2DAS.Collision.Shapes.*;
    import Box2DAS.Common.*;
    import Box2DAS.Dynamics.*;
    import Box2DAS.Dynamics.Contacts.*;
    import Box2DAS.Dynamics.Joints.*;

    import stencyl.api.data.*;
    import stencyl.api.engine.*;
    import stencyl.api.engine.actor.*;
    import stencyl.api.engine.behavior.*;
    import stencyl.api.engine.bg.*;
    import stencyl.api.engine.font.*;
    import stencyl.api.engine.scene.*;
    import stencyl.api.engine.sound.*;
    import stencyl.api.engine.tile.*;
    import stencyl.api.engine.utils.*;

    import org.flixel.*;
    import mochi.as3.*;
    import flash.ui.Mouse;



    public dynamic class Design_51_51_Spawn extends SceneScript
    {       

        public var _PreviousScene1:String;
        public var _PreviousScene2:String;
        public var _PreviousScene3:String;
        public var _PreviousScene4:String;
        public var _PreviousScene5:String;
        public var _XPositiona:Number;
        public var _Ypositiona:Number;
        public var _XPositionb:Number;
        public var _YPositionb:Number;
        public var _Xpositionc:Number;
        public var _Ypositionc:Number;
        public var _Ypositiond:Number;
        public var _Xpositione:Number;
        public var _Ypositione:Number;
        public var _Xpositiond:Number;
        public var _ChangeTrack1:Boolean;
        public var _NextTrack:SoundClip;
        public var _ChangeTrack2:Boolean;
        public var _PreviousScene6:String;
        public var _Xpositionf:Number;
        public var _Ypositionf:Number;
        public var _PreviousScene7:String;
        public var _Xpositiong:Number;
        public var _Ypositiong:Number;
        public var _SpawnLocationa:String;
        public var _SpawnLocationB:String;
        public var _SpawnLocationc:String;
        public var _SpawnLocationd:String;
        public var _SpawnLocatione:String;
        public var _SpawnLocationf:String;
        public var _SpawnLocationg:String;
        public var _Playeractor:Actor;
        public var _NextScene:Scene;
        public var _FadeOutTime:Number;
        public var _FadeInTime:Number;
        public var _NextSceneName1:String;
        public var _Wind1:Number;
        public var _Region:Region;
        public var _NextScene2:Scene;
        public var _NextSceneName2:String;
        public var _Wind2:Number;
        public var _Region2:Region;
        public var _NextScene3:Scene;
        public var _NextSceneName3:String;
        public var _Wind3:Number;
        public var _region3:Region;
        public var _NextScene4:Scene;
        public var _NextSceneName4:String;
        public var _Wind4:Number;
        public var _Region4:Region;
        public var _NextScene5:Scene;
        public var _NextSceneName5:String;
        public var _Wind5:Number;
        public var _Region5:Region;
        override public function init():void
        {
            setGameAttribute("Respawn", false);
            setVolumeForChannel(Number((getGameAttribute("wind"))) /100, 3);

            if (sameAs((getGameAttribute("Previous Scene")), _PreviousScene1))
            {
                if ((getGameAttribute("Returned to beginning")as Boolean))
                {
                    createActor(getActorType(328), (_XPositiona + Number("" + ((getGameAttribute(_SpawnLocationa)) as Array)[0])), (_Ypositiona + Number("" + ((getGameAttribute(_SpawnLocationa)) as Array)[1])), FRONT);
                }

                else
                {
                    if ((getGameAttribute("33 saved")as Boolean))
                    {
                        createActor(getActorType(355), (_XPositiona + Number("" + ((getGameAttribute(_SpawnLocationa)) as Array)[0])), (_Ypositiona + Number("" + ((getGameAttribute(_SpawnLocationa)) as Array)[1])), FRONT);
                    }

                    else
                    {
                        createActor(getActorType(164), _XPositiona, _Ypositiona, FRONT);
                    }
                }

                if (_ChangeTrack1)
                {
                    stopSoundOnChannel(1);
                    loopSoundOnChannel(_NextTrack, 1);
                }
            }

            if (sameAs((getGameAttribute("Previous Scene")), _PreviousScene2))
            {
                if ((getGameAttribute("Returned to beginning")as Boolean))
                {
                    createActor(getActorType(328), (_XPositionb + Number("" + ((getGameAttribute(_SpawnLocationB)) as Array)[0])), (_YPositionb + Number("" + ((getGameAttribute(_SpawnLocationB)) as Array)[1])), FRONT);
                }

                else
                {
                    if ((getGameAttribute("33 saved")as Boolean))
                    {
                        createActor(getActorType(355), (_XPositionb + Number("" + ((getGameAttribute(_SpawnLocationB)) as Array)[0])), (_YPositionb + Number("" + ((getGameAttribute(_SpawnLocationB)) as Array)[1])), FRONT);
                    }

                    else
                    {
                        createActor(getActorType(164), _XPositionb, _YPositionb, FRONT);
                    }
                }

                if (_ChangeTrack2)
                {
                    stopSoundOnChannel(1);
                    loopSoundOnChannel(_NextTrack, 1);
                }
            }

            if (sameAs((getGameAttribute("Previous Scene")), _PreviousScene3))
            {
                if ((getGameAttribute("Returned to beginning")as Boolean))
                {
                    createActor(getActorType(328), (_Xpositionc + Number("" + ((getGameAttribute(_SpawnLocationc)) as Array)[0])), (_Ypositionc + Number("" + ((getGameAttribute(_SpawnLocationc)) as Array)[1])), FRONT);
                }

                else
                {
                    if ((getGameAttribute("33 saved")as Boolean))
                    {
                        createActor(getActorType(355), (_Xpositionc + Number("" + ((getGameAttribute(_SpawnLocationc)) as Array)[0])), (_Ypositionc + Number("" + ((getGameAttribute(_SpawnLocationc)) as Array)[1])), FRONT);
                    }

                    else
                    {
                        createActor(getActorType(164), _Xpositionc, _Ypositionc, FRONT);
                    }
                }
            }

            if (sameAs((getGameAttribute("Previous Scene")), _PreviousScene4))
            {
                if ((getGameAttribute("Returned to beginning")as Boolean))
                {
                    createActor(getActorType(328), (_Xpositiond + Number("" + ((getGameAttribute(_SpawnLocationd)) as Array)[0])), (_Ypositiond + Number("" + ((getGameAttribute(_SpawnLocationd)) as Array)[1])), FRONT);
                }

                else
                {
                    if ((getGameAttribute("33 saved")as Boolean))
                    {
                        createActor(getActorType(355), (_Xpositiond + Number("" + ((getGameAttribute(_SpawnLocationd)) as Array)[0])), (_Ypositiond + Number("" + ((getGameAttribute(_SpawnLocationd)) as Array)[1])), FRONT);
                    }

                    else
                    {
                        createActor(getActorType(164), _Xpositiond, _Ypositiond, FRONT);
                    }
                }
            }

            if (sameAs((getGameAttribute("Previous Scene")), _PreviousScene5))
            {
                if ((getGameAttribute("Returned to beginning")as Boolean))
                {
                    createActor(getActorType(328), (_Xpositione + Number("" + ((getGameAttribute(_SpawnLocatione)) as Array)[0])), (_Ypositione + Number("" + ((getGameAttribute(_SpawnLocatione)) as Array)[1])), FRONT);
                }

                else
                {
                    if ((getGameAttribute("33 saved")as Boolean))
                    {
                        createActor(getActorType(355), (_Xpositione + Number("" + ((getGameAttribute(_SpawnLocatione)) as Array)[0])), (_Ypositione + Number("" + ((getGameAttribute(_SpawnLocatione)) as Array)[1])), FRONT);
                    }

                    else
                    {
                        createActor(getActorType(164), _Xpositione, _Ypositione, FRONT);
                    }
                }
            }

            if (sameAs((getGameAttribute("Previous Scene")), _PreviousScene6))
            {
                if ((getGameAttribute("Returned to beginning")as Boolean))
                {
                    createActor(getActorType(328), (_Xpositionf + Number("" + ((getGameAttribute(_SpawnLocationf)) as Array)[0])), (_Ypositionf + Number("" + ((getGameAttribute(_SpawnLocationf)) as Array)[1])), FRONT);
                }

                else
                {
                    if ((getGameAttribute("33 saved")as Boolean))
                    {
                        createActor(getActorType(355), (_Xpositionf + Number("" + ((getGameAttribute(_SpawnLocationf)) as Array)[0])), (_Ypositionf + Number("" + ((getGameAttribute(_SpawnLocationf)) as Array)[1])), FRONT);
                    }

                    else
                    {
                        createActor(getActorType(164), _Xpositionf, _Ypositionf, FRONT);
                    }
                }
            }

            if (sameAs((getGameAttribute("Previous Scene")), _PreviousScene7))
            {
                if ((getGameAttribute("Returned to beginning")as Boolean))
                {
                    createActor(getActorType(328), (_Xpositiong + Number("" + ((getGameAttribute(_SpawnLocationg)) as Array)[0])), (_Ypositiong + Number("" + ((getGameAttribute(_SpawnLocationg)) as Array)[1])), FRONT);
                }

                else
                {
                    if ((getGameAttribute("33 saved")as Boolean))
                    {
                        createActor(getActorType(355), (_Xpositiong + Number("" + ((getGameAttribute(_SpawnLocationg)) as Array)[0])), (_Ypositiong + Number("" + ((getGameAttribute(_SpawnLocationg)) as Array)[1])), FRONT);
                    }

                    else
                    {
                        createActor(getActorType(164), _Xpositiong, _Ypositiong, FRONT);
                    }
                }
            }

            setGameAttribute("Respawn", false);
            setGameAttribute("Re/Spawning", false);
        }
        override public function update():void
        {

            if (!(_Playeractor ! = null)) // here
            {
                _Playeractor = getLastCreatedActor();
                print("" + _Playeractor);
            }

            if (((_Region ! = null && _NextScene ! = null) && !(isTransitioning()))) // here
            {
                if (isInRegion(_Playeractor, _Region))
                {
                    setGameAttribute("Re/Spawning", true);
                    switchScene(_NextScene.getID(), createFadeOut(((1000*_FadeOutTime))), createFadeIn(((1000*_FadeInTime))));
                    setGameAttribute("Previous Scene", _PreviousScene1);
                    setGameAttribute("Scene", _NextSceneName1);
                    setGameAttribute("wind", _Wind1);
                    setGameAttribute("Re/Spawning", false);
                }
            }

            if (((_Region2 ! = null && _NextScene2 ! = null) && !(isTransitioning()))) // here
            {
                if (isInRegion(_Playeractor, _Region2))
                {
                    setGameAttribute("Re/Spawning", true);
                    switchScene(_NextScene2.getID(), createFadeOut(((1000*_FadeOutTime))), createFadeIn(((1000*_FadeInTime))));
                    setGameAttribute("Previous Scene", _PreviousScene2);
                    setGameAttribute("Scene", _NextSceneName2);
                    setGameAttribute("wind", _Wind2);
                    setGameAttribute("Re/Spawning", false);
                }
            }

            if (((_region3 ! = null && _NextScene3 ! = null) && !(isTransitioning()))) // here
            {
                if (isInRegion(_Playeractor, _region3))
                {
                    setGameAttribute("Re/Spawning", true);
                    switchScene(_NextScene3.getID(), createFadeOut(((1000*_FadeOutTime))), createFadeIn(((1000*_FadeInTime))));
                    setGameAttribute("Previous Scene", _PreviousScene3);
                    setGameAttribute("Scene", _NextSceneName3);
                    setGameAttribute("wind", _Wind3);
                    setGameAttribute("Re/Spawning", false);
                }
            }

            if (((_Region4 ! = null && _NextScene4 ! = null) && !(isTransitioning()))) // here
            {
                if (isInRegion(_Playeractor, _Region4))
                {
                    setGameAttribute("Re/Spawning", true);
                    switchScene(_NextScene4.getID(), createFadeOut(((1000*_FadeOutTime))), createFadeIn(((1000*_FadeInTime))));
                    setGameAttribute("Previous Scene", _PreviousScene4);
                    setGameAttribute("Scene", _NextSceneName4);
                    setGameAttribute("wind", _Wind4);
                    setGameAttribute("Re/Spawning", false);
                }
            }

            if (((_Region5 ! = null && _NextScene5 ! = null) && !(isTransitioning()))) // here
            {
                if (isInRegion(_Playeractor, _Region5))
                {
                    setGameAttribute("Re/Spawning", true);
                    switchScene(_NextScene5.getID(), createFadeOut(((1000*_FadeOutTime))), createFadeIn(((1000*_FadeInTime))));
                    setGameAttribute("Previous Scene", _PreviousScene5);
                    setGameAttribute("Scene", _NextSceneName5);
                    setGameAttribute("wind", _Wind5);
                    setGameAttribute("Re/Spawning", false);
                }
            }
        }
        override public function draw(g:Graphics, x:Number, y:Number):void
        {
        }

        public function Design_51_51_Spawn(ignore:*, scene:GameState)
        {
            super(scene);
            nameMap["Previous Scene 1"] = "_PreviousScene1";
nameMap["Previous Scene 2"] = "_PreviousScene2";
nameMap["Previous Scene 3"] = "_PreviousScene3";
nameMap["Previous Scene 4"] = "_PreviousScene4";
nameMap["Previous Scene 5"] = "_PreviousScene5";
nameMap["X Position a"] = "_XPositiona";
nameMap["Y position a"] = "_Ypositiona";
nameMap["X Position b"] = "_XPositionb";
nameMap["Y Position b"] = "_YPositionb";
nameMap["X position c"] = "_Xpositionc";
nameMap["Y position c"] = "_Ypositionc";
nameMap["Y position d"] = "_Ypositiond";
nameMap["X position e"] = "_Xpositione";
nameMap["Y position e"] = "_Ypositione";
nameMap["X position d"] = "_Xpositiond";
nameMap["Change Track 1?"] = "_ChangeTrack1";
nameMap["Next Track"] = "_NextTrack";
nameMap["Change Track 2?"] = "_ChangeTrack2";
nameMap["Previous Scene 6"] = "_PreviousScene6";
nameMap["X position f"] = "_Xpositionf";
nameMap["Y position f"] = "_Ypositionf";
nameMap["Previous Scene 7"] = "_PreviousScene7";
nameMap["X position g"] = "_Xpositiong";
nameMap["Y position g"] = "_Ypositiong";
nameMap["Spawn Location a"] = "_SpawnLocationa";
nameMap["Spawn Location B"] = "_SpawnLocationB";
nameMap["Spawn Location c"] = "_SpawnLocationc";
nameMap["Spawn Location d"] = "_SpawnLocationd";
nameMap["Spawn Location e"] = "_SpawnLocatione";
nameMap["Spawn Location f"] = "_SpawnLocationf";
nameMap["Spawn Location g"] = "_SpawnLocationg";
nameMap["Player actor"] = "_Playeractor";
nameMap["Next Scene 1"] = "_NextScene";
nameMap["Fade Out Time"] = "_FadeOutTime";
nameMap["Fade In Time"] = "_FadeInTime";
nameMap["Next Scene Name 1"] = "_NextSceneName1";
nameMap["Wind 1"] = "_Wind1";
nameMap["Region 1"] = "_Region";
nameMap["Next Scene 2"] = "_NextScene2";
nameMap["Next Scene Name 2"] = "_NextSceneName2";
nameMap["Wind 2"] = "_Wind2";
nameMap["Region 2"] = "_Region2";
nameMap["Next Scene 3"] = "_NextScene3";
nameMap["Next Scene Name 3"] = "_NextSceneName3";
nameMap["Wind 3"] = "_Wind3";
nameMap["region 3"] = "_region3";
nameMap["Next Scene 4"] = "_NextScene4";
nameMap["Next Scene Name 4"] = "_NextSceneName4";
nameMap["Wind 4"] = "_Wind4";
nameMap["Region 4"] = "_Region4";
nameMap["Next Scene 5"] = "_NextScene5";
nameMap["Next Scene Name 5"] = "_NextSceneName5";
nameMap["Wind 5"] = "_Wind5";
nameMap["Region 5"] = "_Region5";

        }

        override public function forwardMessage(msg:String):void
        {

        }
    }
}

感谢您的宝贵时间!

看来您的问题正在发生,因为您在“!”之间有一个 space。和“=”在您标记的所有行上。您正在尝试使用不等式运算符,即“!=”,或者一个感叹号后跟一个没有 space.

的等号

当您单独使用感叹号时,它会被解释为 "logical not" 并且您收到的错误消息是因为编译器正在尝试对您正在尝试的内容做出最好的猜测要做。

如果删除“!”之间的所有 space和“=”则应注意此错误。