Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unexpected token "{" error from this script.
dasde Offline
Junior Member

Posts: 30
Threads: 6
Joined: May 2011
Reputation: 0
#1
Unexpected token "{" error from this script.

Hello

I have this script on a map where I want two leaders to add 1 and 7 to a local int, when int is 8 a Swing door should unlock.

But instead I just get the error "Unexpected token "{"" when I try to launch the game map.

Here is the script:

void AddLocalVarInt(string& Unlock, int alVal);
{

        if(GetLocalVarInt("Unlock")==8)
        {
           SetLevelSwingDoorLocked(mansion_1, false);
          
        }
}    
void OnLeverStateChange(string &in Lever1, int alState)
{

    AddDebugMessage(Lever1 + "'s current state: " + alState, false);

    if (alState == -1)
    {
     AddLocalVarInt("Unlock", 1);

    }
}

Thank you for your help
(This post was last modified: 05-26-2011, 08:11 PM by dasde.)
05-26-2011, 08:11 PM
Find
Greven Offline
Member

Posts: 106
Threads: 13
Joined: May 2011
Reputation: 3
#2
RE: Unexpected token "{" error from this script.

(05-26-2011, 08:11 PM)dasde Wrote: Hello

I have this script on a map where I want two leaders to add 1 and 7 to a local int, when int is 8 a Swing door should unlock.

But instead I just get the error "Unexpected token "{"" when I try to launch the game map.

Here is the script:

void AddLocalVarInt(string& Unlock, int alVal);
{

        if(GetLocalVarInt("Unlock")==8)
        {
           SetLevelSwingDoorLocked(mansion_1, false);
          
        }
}    
void OnLeverStateChange(string &in Lever1, int alState)
{

    AddDebugMessage(Lever1 + "'s current state: " + alState, false);

    if (alState == -1)
    {
     AddLocalVarInt("Unlock", 1);

    }
}

Thank you for your help

At the "void AddLocalVarInt(string& Unlock, int alVal);" There shouldnt be a ; at the end.

[WIP] Recidivus
(This post was last modified: 05-26-2011, 09:09 PM by Greven.)
05-26-2011, 09:09 PM
Find
dasde Offline
Junior Member

Posts: 30
Threads: 6
Joined: May 2011
Reputation: 0
#3
RE: Unexpected token "{" error from this script.

Okay, now I get this error: (see attachment)

Here is the full script:

//===========================================
     // Starter's Script File!
     //===========================================

     //===========================================
     // This runs when the map first starts
     void OnStart()
     {

     }





     //===========================================
     // This runs when the player enters the map
     void OnEnter()
     {
     }

     //===========================================
     // This runs when the player leaves the map
     void OnLeave()
     {
     }
    
    
     //===========================================
     // Areas




////////////////////////////////////////
//UNLOCK START SWINGDOOR

void AddLocalVarInt(string& UnlockDoor, int alVal)
{

        if(GetLocalVarInt("UnlockDoor")==8)
        {
           SetLevelSwingDoorLocked(mansion_1, false);
          
        }
}    
void OnLeverStateChange(string &in Lever1, int alState)
{

    AddDebugMessage(Lever1 + "'s current state: " + alState, false);

    if (alState == -1)
    {
     AddLocalVarInt("UnlockDoor", 1);

    }
}


void OnLeverStateChange(string &in Lever7, int alState)
{
    AddDebugMessage(Lever7 + "'s current state: " + alState, false);

    if (alState == -1)
    {
     AddLocalVarInt("UnlockDoor", 7);
    }
}



Attached Files
.png   error.PNG (Size: 34.47 KB / Downloads: 77)
05-27-2011, 08:14 AM
Find
Greven Offline
Member

Posts: 106
Threads: 13
Joined: May 2011
Reputation: 3
#4
RE: Unexpected token "{" error from this script.

hmm.. i dont know alot with the whole "if" thing but when it says mansion_1 is not declared it means it needs "". Like this SetLevelSwingDoorLocked("mansion_1", false);

[WIP] Recidivus
05-27-2011, 09:31 AM
Find
dasde Offline
Junior Member

Posts: 30
Threads: 6
Joined: May 2011
Reputation: 0
#5
RE: Unexpected token "{" error from this script.

Fixed it by myself.

This is my script for future googlers:
void OnLeverStateChange(string &in Lever1, int alState)
{
        if (alState == -1)
        {
            AddLocalVarInt("Var01", 1);
        }    

}

void OnLeverStateChange1(string &in Lever7, int alState)
{
        if (alState == -1)
        {
            AddLocalVarInt("Var01", 7);
        }
}
05-27-2011, 02:25 PM
Find




Users browsing this thread: 1 Guest(s)