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
Script Help Unnexpected end of file error CONTINUES!
xjonx Offline
Junior Member

Posts: 15
Threads: 7
Joined: Feb 2014
Reputation: 0
#1
Exclamation  Unnexpected end of file error CONTINUES!

I made a post last time annnddd... The solution didn't work, now I got an error but at the very end of .hps file WICH IS NOT WRONG!
(59, 2) : ERR : Unexpected end of file
//This is only executed when the map is loaded for the first time. Only happens once. Can be used for adding effects that should not repeat.//
void OnStart()
{  
    AddUseItemCallback("", "key1", "frontdoor", "UseKeyOnDoor", true);
    FadeOut(0);
    SetPlayerActive(false);
    SetSanityDrainDisabled(true);
    ShowPlayerCrosshairIcons(false)

    AddTimer("fadein", 3 "TimerInroOutro");

    PlayMusic(inrto_cabin.ogg, false, 1, 1, 1, false);
}           //Missing brace

    void TimerInroOutro(string &in asTimer)
{
    if(GetLocalVarInt("Intro") < 3) {

        if(asTimer == "fadein") {
            TeleportPlayer("Intro_" + GetLocalVarInt("Intro"));
            FadeIn(1);
            AddTimer("fadeout", 4, "TimerIntroOutro");
    }

    if(asTimer == "fadeout") {
        FadeOut(1);
        AddTimer("fadein", 1 "TimerIntroOutro);
        AddLocalVarInt(Intro, 1);
    }
    else
    {
        TeleportPlayer("Spawn");
        FadeIn(2);
        SetPlayerActive(true);
        SetSanityDrainDisabled(false);
        ShowPlayerCrosshairIcons(true);

        PlayMusic(inrto_cabin.ogg, false, 0, 1, 2, false);
    }
}
}       //Missing brace

void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("frontdoor", false, true);
    RemoveItem(asItem);
}

//This is executed every time you enter the level. Can be executed several times. Can be used for playing music and adding checks.//
void OnEnter()
{

}

//This is executed every time you leave the level. Can be executed several times. Can be used for stopping music//
void OnLeave()
{

} <-(59, 2)
Help? Huh
(This post was last modified: 03-01-2014, 08:50 PM by xjonx.)
03-01-2014, 08:48 PM
Find
davide32 Offline
Junior Member

Posts: 27
Threads: 6
Joined: Nov 2013
Reputation: 0
#2
RE: Unnexpected end of file error CONTINUES!

try this:


void OnStart()
{
AddUseItemCallback("", "key1", "frontdoor", "UseKeyOnDoor", true);
FadeOut(0);
SetPlayerActive(false);
SetSanityDrainDisabled(true);
ShowPlayerCrosshairIcons(false)

AddTimer("fadein", 3 "TimerInroOutro");

PlayMusic(inrto_cabin.ogg, false, 1, 1, 1, false);
} //Missing brace

void TimerInroOutro(string &in asTimer)
{
if(GetLocalVarInt("Intro") < 3) {

if(asTimer == "fadein") {
TeleportPlayer("Intro_" + GetLocalVarInt("Intro"));
FadeIn(1);
AddTimer("fadeout", 4, "TimerIntroOutro");
}

if(asTimer == "fadeout") {
FadeOut(1);
AddTimer("fadein", 1 "TimerIntroOutro);
AddLocalVarInt(Intro, 1);
}
else
{
TeleportPlayer("Spawn");
FadeIn(2);
SetPlayerActive(true);
SetSanityDrainDisabled(false);
ShowPlayerCrosshairIcons(true);

PlayMusic(inrto_cabin.ogg, false, 0, 1, 2, false);
}
}
} //Missing brace

void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("frontdoor", false, true);
RemoveItem(asItem);
}

//This is executed every time you enter the level. Can be executed several times. Can be used for playing music and adding checks.//
void OnEnter()
{

}

//This is executed every time you leave the level. Can be executed several times. Can be used for stopping music//
void OnLeave()
{

}
03-01-2014, 09:01 PM
Find
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#3
RE: Unnexpected end of file error CONTINUES!

ShowPlayerCrosshairIcons(false);

03-01-2014, 09:12 PM
Find
xjonx Offline
Junior Member

Posts: 15
Threads: 7
Joined: Feb 2014
Reputation: 0
#4
RE: Unnexpected end of file error CONTINUES!

(03-01-2014, 09:01 PM)davide32 Wrote: try this:


void OnStart()
{
AddUseItemCallback("", "key1", "frontdoor", "UseKeyOnDoor", true);
FadeOut(0);
SetPlayerActive(false);
SetSanityDrainDisabled(true);
ShowPlayerCrosshairIcons(false)

AddTimer("fadein", 3 "TimerInroOutro");

PlayMusic(inrto_cabin.ogg, false, 1, 1, 1, false);
} //Missing brace

void TimerInroOutro(string &in asTimer)
{
if(GetLocalVarInt("Intro") < 3) {

if(asTimer == "fadein") {
TeleportPlayer("Intro_" + GetLocalVarInt("Intro"));
FadeIn(1);
AddTimer("fadeout", 4, "TimerIntroOutro");
}

if(asTimer == "fadeout") {
FadeOut(1);
AddTimer("fadein", 1 "TimerIntroOutro);
AddLocalVarInt(Intro, 1);
}
else
{
TeleportPlayer("Spawn");
FadeIn(2);
SetPlayerActive(true);
SetSanityDrainDisabled(false);
ShowPlayerCrosshairIcons(true);

PlayMusic(inrto_cabin.ogg, false, 0, 1, 2, false);
}
}
} //Missing brace

void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("frontdoor", false, true);
RemoveItem(asItem);
}

//This is executed every time you enter the level. Can be executed several times. Can be used for playing music and adding checks.//
void OnEnter()
{

}

//This is executed every time you leave the level. Can be executed several times. Can be used for stopping music//
void OnLeave()
{

}
I still get the error! HELP!?HuhSadAngry

(03-01-2014, 09:12 PM)Amn Wrote: ShowPlayerCrosshairIcons(false);
Nope still get it it says line (58, 2) unexpected end of file! HELP?! Angry
(This post was last modified: 03-01-2014, 09:22 PM by xjonx.)
03-01-2014, 09:17 PM
Find
davide32 Offline
Junior Member

Posts: 27
Threads: 6
Joined: Nov 2013
Reputation: 0
#5
RE: Unnexpected end of file error CONTINUES!

but some errors can stay in another line in hps file for example if the error is in 200 line and there're 10 script it can report the error on line 195 or in another line. It oroblably report the error in the same line where is the err.
(This post was last modified: 03-01-2014, 09:33 PM by davide32.)
03-01-2014, 09:32 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#6
RE: Unnexpected end of file error CONTINUES!

Usually unexpected end of file, missing things, and extra things are SUPER hard to deal with because the error doesn't tell you where it's at. Instead it just shows you the lines OF THE ENTIRE SCRIPT.

Annoying.

"Veni, vidi, vici."
"I came, I saw, I conquered."
03-02-2014, 08:44 AM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#7
RE: Unnexpected end of file error CONTINUES!

Okay, on further analysis, on two occasions we have this:
PHP Code: (Select All)
PlayMusic(inrto_cabin.oggfalse012false); 

NOT SURE if inrto_cabin.ogg is spelt incorrectly (for now I'll assume it is okay), but the problem is that it is a string value, so it must be enclosed in two quotation marks (").

Replace the two (one in OnStart and the other a few lines up from void UseKeyOnDoor) with these respectively:
PHP Code: (Select All)
PlayMusic("inrto_cabin.ogg"false111false); 
PHP Code: (Select All)
PlayMusic("inrto_cabin.ogg"false012false); 

You could also...
Spoiler below!

Just for the sake of coding, although that having the volume at 0 to make the music mute is okay, can also use this instead of the second PlayMusic:
PHP Code: (Select All)
void StopMusic(float afFadeTimeint alPrio); 
Stops music.

afFadeTime - time in seconds until music stops
alPrio - the priority of the music that should stop


Edit: Oh and as Amn pointed out; in your OnStart(), you have forgotten the semi-colon at the end of this: ShowPlayerCrosshairIcons(false)

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 03-02-2014, 08:58 AM by Romulator.)
03-02-2014, 08:55 AM
Find
Putmalk Offline
Senior Member

Posts: 290
Threads: 13
Joined: Apr 2012
Reputation: 15
#8
RE: Unnexpected end of file error CONTINUES!

Unexpected end of file happens when you have syntax error in your code. Basically, you opened something up (parentheses, for example) and didn't close it. Please observe the following basic rule:

typing a ( { " ' requires a corresponding ' " } ) to close it.
examples:
  • function( ... )
  • if { ... }
  • "..."
  • '...'

Everything that I can see at first glance:

line 8: ShowPlayerCrosshairIcons(false);
line 10: AddTimer("fadein", 3, "TimerInroOutro");
line 12: PlayMusic("inrto_cabin.ogg", false, 1, 1, 1, false);
line 27: AddTimer("fadein", 1, "TimerIntroOutro");
line 38: PlayMusic("inrto_cabin.ogg", false, 0, 1, 2, false);

Please use proper indentation to ensure code clarity. This is what my edited file looks like:

//This is only executed when the map is loaded for the first time. Only happens once. Can be used for adding effects that should not repeat.//
void OnStart()
{  
    AddUseItemCallback("", "key1", "frontdoor", "UseKeyOnDoor", true);
    FadeOut(0);
    SetPlayerActive(false);
    SetSanityDrainDisabled(true);
    ShowPlayerCrosshairIcons(false);

    AddTimer("fadein", 3, "TimerInroOutro");

    PlayMusic("inrto_cabin.ogg", false, 1, 1, 1, false);
}           //Missing brace

void TimerInroOutro(string &in asTimer)
{
    if(GetLocalVarInt("Intro") < 3) {

        if(asTimer == "fadein") {
            TeleportPlayer("Intro_" + GetLocalVarInt("Intro"));
            FadeIn(1);
            AddTimer("fadeout", 4, "TimerIntroOutro");
        }

        if(asTimer == "fadeout") {
            FadeOut(1);
            AddTimer("fadein", 1, "TimerIntroOutro");
            AddLocalVarInt(Intro, 1);
        }
        else
        {
            TeleportPlayer("Spawn");
            FadeIn(2);
            SetPlayerActive(true);
            SetSanityDrainDisabled(false);
            ShowPlayerCrosshairIcons(true);

            PlayMusic("inrto_cabin.ogg", false, 0, 1, 2, false);
        }
    }
}       //Missing brace

void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("frontdoor", false, true);
    RemoveItem(asItem);
}

//This is executed every time you enter the level. Can be executed several times. Can be used for playing music and adding checks.//
void OnEnter()
{

}

//This is executed every time you leave the level. Can be executed several times. Can be used for stopping music//
void OnLeave()
{

}

(This post was last modified: 03-02-2014, 08:05 PM by Putmalk.)
03-02-2014, 07:59 PM
Find




Users browsing this thread: 5 Guest(s)