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
xjonx Offline
Junior Member

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

I get a crash when starting my custom story, error is in .hps and I cant find the problem Huh (58, 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);
    
    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);
    }
}

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-01-2014, 01:49 AM by xjonx.)
03-01-2014, 01:47 AM
Find
Romulator Offline
Not Tech Support ;-)

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

You were missing two closing braces. Try this now, but if it still doesn't work, then something else is causing errors as well:

PHP Code: (Select All)
//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""TimerInroOutro");

    
PlayMusic(inrto_cabin.oggfalse111false);
 }           
//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""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()




Discord: Romulator#0001
[Image: 3f6f01a904.png]
03-01-2014, 02:59 AM
Find




Users browsing this thread: 1 Guest(s)