Frictional Games Forum (read-only)

Full Version: Unexpected end to file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
I have gotten my map all done and I have almost all scripting done with multiple tests done to see if if each step works and everystep has worked until now. I recently added a new script which has nothing wrong with it, but somehow it has corrupted the file into getting a "ERR. Unexpected end to file (224,1). I have not touched the end of the script and i have tried removing the recent update to the file to see if that solves the problem which it hasn't.
Can someone please look into what may be causing this because i've worked really hard to get this far then it just craps out on me, kinda sucks...
Show us the script file in question please.
It wouldn't give you that error if there was nothing wrong with it. Level editor has nothing to do with script errors. Unexpected end of file is a human-caused error.

BTW, i'm going to change the topic title (not sure why you decided on that title).
I've found, typically, that the reason for the "Unexpected end of file" errors is due to my not closing off a string properly, due to missing the last set of quotation marks. Double check all of your lines requiring strings.

////////////////////////////
// Run when entering map
void OnStart()
{
AddUseItemCallback("", "doorkey_1", "locked_door", "UnlockDoor", true);
AddEntityCollideCallback("Player", "onlight", "OnLightActivate", true, 1);
SetEntityPlayerInteractCallback("lantern_1", "OnPickup", true);
AddEntityCollideCallback("Player", "Time", "ActivateSequence", true, 1);
}
void UnlockDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("locked_door", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "locked_door", 0, false);
RemoveItem("doorkey_1");
}
void OnPickup(string &in asEntity)
{
SetEntityPlayerInteractCallback("latern_1", "Music", true);
PlayMusic("01_puzzle_passage.ogg", false, 3, 2, 1, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
SetEntityPlayerLookAtCallback("swing_door_1", "SwingDoor", true);
}
void SwingDoor(string &in asEntity, int alState)
{
SetSwingDoorDisableAutoClose("swing_door_1", true);
SetSwingDoorClosed("swing_door_1", false, true);
AddPropForce("swing_door_1", 0, 0, 2000, "world");
CreateParticleSystemAtEntity("", "ps_dust_whirl.ps", "swing_door_1", false);
PlaySoundAtEntity("", "general_wind_whirl.snt", "swing_door_1", 0, false);
PlaySoundAtEntity("", "door_mansion_open.snt", "Player", 0, false);
}
void ActivateSequence(string &in asParent, string &in asChild, int alState)
{
AddTimer("T8", 0, "Scare_1");
AddTimer("T9", 1, "Scare_1");
AddTimer("T10", 5, "Scare_1");
AddTimer("T11", 9, "Scare_1");
AddTimer("T12", 7, "Scare_1");
AddTimer("T13", 11, "Scare_1");
AddTimer("T14", 13, "Scare_1");
AddEntityCollideCallback("Player", "Area_1", "ScareShitless", true, 1);
AddEntityCollideCallback("Player", "Area_2", "ScareShitless", true, 1);
AddEntityCollideCallback("Player", "Area_3", "HolyShit", true, 1);
AddEntityCollideCallback("Player", "Area_4", "HolyShit", true, 1);
AddEntityCollideCallback("Player", "Area_5", "HolyShit", true, 1);
}
void Scare_1(string &in asTimer)
{
string x = asTimer;
if (x == "T8")
{
SetLampLit("shrine_candle_2", true, true);
SetLampLit("shrine_candle_1", true, true);
SetPlayerMoveSpeedMul(0.3);
StartPlayerLookAt("LookAt", 2, 2, "");
PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
FadePlayerFOVMulTo(0.5, 1.5);
StopMusic(1, 1);
}
else if (x == "T9")
{
PlayMusic("15_the_big_scream3.ogg", false, 4, 1, 0, true);
StopPlayerLookAt();
FadePlayerFOVMulTo(1, 1.5);
}
else if (x == "T10")
{
StartPlayerLookAt("LookAt_2", 2, 2, "");
}
else if (x == "T12")
{
StopPlayerLookAt();
PlaySoundAtEntity("", "scare_wood_creak_walk.snt", "creak", 0, false);
}
else if (x == "T11")
{
SetEntityActive("brute_1", true);
PlaySoundAtEntity("", "24_iron_maiden.snt", "brute_1", 0, false);
PlaySoundAtEntity("", "24_iron_maiden.snt", "brute_1", 0, false);
StartPlayerLookAt("brute_1", 4, 4, "");
ShowEnemyPlayerPosition("brute_1");
}
else if (x == "T13")
{
SetPlayerMoveSpeedMul(1);
}
else if (x == "T14")
{
FadeEnemyToSmoke("brute_1", true);
StopPlayerLookAt();
}
void ScaredShitless(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("brute_2", true);
PlaySoundAtEntity("", "24_iron_maiden.snt", "brute_2", 0, false);
PlaySoundAtEntity("", "24_iron_maiden.snt", "brute_2", 0, false);
ShowEnemyPlayerPosition("brute_2");
AddTimer("T15", 1, "Scare_2");
AddTimer("T16", 5, "Scare_2");
}
void Scare_2(string &in asTimer)
{
string x = asTimer;
if (x == "T15")
{
StartPlayerLookAt("brute_2", 4, 4, "");
}
if (x == "T16")
{
FadeEnemyToSmoke("brute_2", true);
StopPlayerLookAt();
}
void ScaredShitless(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("brute_3", true);
PlaySoundAtEntity("", "24_iron_maiden.snt", "brute_3", 0, false);
PlaySoundAtEntity("", "24_iron_maiden.snt", "brute_3", 0, false);
ShowEnemyPlayerPosition("brute_3");
AddTimer("T117", 1, "Scare_3");
AddTimer("T18", 5, "Scare_3");
}
void Scare_3(string &in asTimer)
{
string x = asTimer;
if (x == "T17")
{
StartPlayerLookAt("brute_3", 4, 4, "");
}
if (x == "T18")
{
FadeEnemyToSmoke("brute_3", true);
StopPlayerLookAt();
}
}
////////////////////////////
// Run when entering map
void OnEnter()
{
PlaySoundAtEntity("", "notice.snt", "Player", 0, false);
SetPlayerActive(false);
SetPlayerCrouching(true);
FadeOut(0);
FadeIn(3);
AddTimer("T1", 3, "Intro");
AddTimer("T2", 6, "Intro");
AddTimer("T3", 8, "Intro");
AddTimer("T4", 10, "Intro");
AddTimer("T5", 12, "Intro");
AddTimer("T6", 20, "Intro");
AddTimer("T7", 23, "Intro");
SetLightVisible("onlight_1", false);
SetLightVisible("onlight_2", false);
SetLightVisible("onlight_3", false);
SetLightVisible("onlight_4", false);
SetLightVisible("onlight_5", false);
SetLightVisible("onlight_6", false);
AddEntityCollideCallback("Player", "scare_1", "ScareOne", true, 1);
}

void Intro(string &in asTimer)
{
string x = asTimer;
if (x == "T1")
{
PlayMusic("insanity_monster_roar02.ogg", false, 3, 1, 0, true);
FadeOut(3);
}
else if (x == "T2")
{
FadeIn(3);
PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
StartPlayerLookAt("ScriptArea_1", 2, 2, "");
}
else if (x == "T3")
{
PlayMusic("insanity_monster_roar01.ogg", false, 3, 1, 0, true);
StopPlayerLookAt();
StartPlayerLookAt("ScriptArea_2", 2, 2, "");
}
else if (x == "T4")
{
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
StopPlayerLookAt();
}
else if (x == "T5")
{
SetPlayerCrouching(false);
SetPlayerActive(true);
}
else if (x == "T6")
{
StartScreenShake(0.1, 2, 1, 1);
PlayMusic("insanity_monster_roar03.ogg", false, 5, 1, 0, true);
}
else if (x == "T7")
{
PlayMusic("ambience_haunting.ogg", true, 2, 1, 1, true);
}
}

void OnLightActivate(string &in asParent, string &in asChild, int alState)
{
SetLightVisible("onlight_1", true);
SetLightVisible("onlight_2", true);
SetLightVisible("onlight_3", true);
SetLightVisible("onlight_4", true);
SetLightVisible("onlight_5", true);
SetLightVisible("onlight_6", true);
SetLampLit("ontorch_1", true, true);
SetLampLit("ontorch_2", true, true);
SetLampLit("ontorch_3", true, true);
SetLampLit("ontorch_4", true, true);
SetLampLit("ontorch_5", true, true);
SetLampLit("ontorch_6", true, true);
PlaySoundAtEntity("", "27_thump.snt", "onlight", 0, false);
}
////////////////////////////
// Run when leaving map
void OnLeave()
{

}

I checked it over and i cant see anything, it says the errors on line 224 which is the last one on here, any advice?
On my first skim i see that Scare_1 wasn't properly closed (i.e. is missing a closing bracket).
Im still getting the error, on the pop up it says that the missing end is the final brack on the hps file.
Scare_2 seems to also be missing a closing bracket.
I must be honest i dont see what you are referring to. this is what i see and i cant find any missing closing brackets
void Scare_1(string &in asTimer)

AddTimer("T8", 0, "Scare_1");
AddTimer("T9", 1, "Scare_1");
AddTimer("T10", 5, "Scare_1");
AddTimer("T11", 9, "Scare_1");
AddTimer("T12", 7, "Scare_1");
AddTimer("T13", 11, "Scare_1");
AddTimer("T14", 13, "Scare_1");



AddTimer("T15", 1, "Scare_2");

AddTimer("T16", 5, "Scare_2");

void Scare_2(string &in asTimer)

You're not going to find what's not there. You have to add it in.
Pages: 1 2 3 4 5