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 End in my code :c
You So Russo Offline
Junior Member

Posts: 4
Threads: 1
Joined: Jan 2015
Reputation: 0
#1
Unexpected End in my code :c

My code has got unexpected end but i dont know where or how since I can't see anything that doesn't not work.

PHP Code: (Select All)
void OnStart()
{
    
AddUseItemCallback("""Key1""Door1""UseKeyOnDoor"true);
    
AddEntityCollideCallback("Player""ZoneCollide, "Dialogue", true, 1);    
}

void UseKeyOnDoor("
Key1", "Door1")
{
    SetSwingDoorLocked(asEntity, false, true);
    PlaySoundAtEntity("", "
door_unlock.snt", asEntity, 0, false);
    RemoveItem(asItem)
}


void PlayRecord(string &in asEntity, int alState)
{
    if(alState == 1)
    {
        PlaySoundAtEntity("", "
grapevine.snt", asEntity, 0, true);
    }


}
void Dialogue(string &in asParent, string &in asChild, int alState)
{
    SetPlayerActive(false);
    AddEffectVoice("
agony1", "", "Dialogue", "", false, asParent, 2, 20);
    StartPlayerLookAt("
lookat1", 2, 2, "");
    AddTimer("
T1", 8.5f, "Lookat");
    GiveSanityDamage(5.0f, true);
}

void Lookat(string &in asTimer)
{
    StopPlayerLookAt();
    StartPlayerLookAt("
lookat2", 2, 2, "");
    AddTimer("
T2", 14.0f, "Lookat2");
}
void Lookat2(string &in asTimer)
{
    StopPlayerLookAt();
    SetPlayerActive(true);

01-20-2015, 07:00 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
RE: Unexpected End in my code :c

PHP Code: (Select All)
AddEntityCollideCallback("Player""ZoneCollide, "Dialogue", true, 1); 

There's a missing quote after ZoneCollide. You can easily tell because the color inverts for the whole script after that point.

PHP Code: (Select All)
void UseKeyOnDoor("Key1""Door1"

Constructors also should not have parameters like that. These should be
PHP Code: (Select All)
(string &in asItemstring &in asEntity

(This post was last modified: 01-20-2015, 07:23 PM by Mudbill.)
01-20-2015, 07:21 PM
Find
You So Russo Offline
Junior Member

Posts: 4
Threads: 1
Joined: Jan 2015
Reputation: 0
#3
RE: Unexpected End in my code :c

I've changed it and found there also wasn't a ; after the removeitem but it still says unexpected error :c
(This post was last modified: 01-20-2015, 07:58 PM by You So Russo.)
01-20-2015, 07:50 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#4
RE: Unexpected End in my code :c

What does the error say though? It will give you two numbers that tell you where in your file the issue starts.

01-20-2015, 09:44 PM
Find
You So Russo Offline
Junior Member

Posts: 4
Threads: 1
Joined: Jan 2015
Reputation: 0
#5
RE: Unexpected End in my code :c

FATAL ERROR: Could not load script file
(43, 2): ERR : Unexpected end of file.
01-20-2015, 09:47 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#6
RE: Unexpected End in my code :c

I don't see anything really wrong. The error mentions the very end of the file, but the third character (including 0) is non existant, is it? Perhaps an odd parsing symbol has snuck its way in there?

(This post was last modified: 01-20-2015, 10:17 PM by Mudbill.)
01-20-2015, 10:17 PM
Find
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#7
RE: Unexpected End in my code :c

Quote:Unexpected end of file
Sounds like a missing brace }
Post your script?
edit: Oh it's up there. ok.

I don't know. It seems correct for me too. Can you try this one below?

PHP Code: (Select All)
void OnStart()
{
    
AddUseItemCallback("""Key1""Door1""UseKeyOnDoor"true);
    
AddEntityCollideCallback("Player""ZoneCollide""Dialogue"true1);    
}

void UseKeyOnDoor(string &in asItemstring &in asEntity)
{
    
SetSwingDoorLocked(asEntityfalsetrue);
    
PlaySoundAtEntity("""door_unlock.snt"asEntity0false);
    
RemoveItem(asItem);
}


void PlayRecord(string &in asEntityint alState)
{
    if(
alState == 1)
    {
        
PlaySoundAtEntity("""grapevine.snt"asEntity0true);
    }


}
void Dialogue(string &in asParentstring &in asChildint alState)
{
    
SetPlayerActive(false);
    
AddEffectVoice("agony1""""Dialogue"""falseasParent220);
    
StartPlayerLookAt("lookat1"22"");
    
AddTimer("T1"8.5f"Lookat");
    
GiveSanityDamage(5.0ftrue);
}

void Lookat(string &in asTimer)
{
    
StopPlayerLookAt();
    
StartPlayerLookAt("lookat2"22"");
    
AddTimer("T2"14.0f"Lookat2");
}
void Lookat2(string &in asTimer)
{
    
StopPlayerLookAt();
    
SetPlayerActive(true);


(This post was last modified: 01-20-2015, 11:52 PM by Daemian.)
01-20-2015, 11:35 PM
Find
You So Russo Offline
Junior Member

Posts: 4
Threads: 1
Joined: Jan 2015
Reputation: 0
#8
RE: Unexpected End in my code :c

Oh wow, that worked haha but what did you change? Just found out my key didn't even work that whole time neither T_T. Anyhow thanks dude!
EDIT: Fixed my key no worries c:
(This post was last modified: 01-21-2015, 01:12 AM by You So Russo.)
01-21-2015, 12:51 AM
Find




Users browsing this thread: 1 Guest(s)