Frictional Games Forum (read-only)
[SCRIPT] Error - Unexpected end of file - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Error - Unexpected end of file (/thread-17154.html)



Error - Unexpected end of file - KingCrimson - 07-21-2012

It gives me FATAL ERROR:
203,2 Unexpected end of file.

I don't know what might be wrong. I've marked in red the last script i added, because it could be caused by that...
Quote:////////////////////////////
// Run when the map starts
void OnStart()
{
AddEntityCollideCallback("Player", "explode_scare", "Explode", true, 1);

SetEntityConnectionStateChangeCallback("palanca", "desbloquear");

SetLocalVarInt("Var1", 0);
SetEntityPlayerInteractCallback("bot1", "func1", true);
SetEntityPlayerInteractCallback("bot2", "func2", true);
SetEntityPlayerInteractCallback("bot3", "func3", true);
SetEntityPlayerInteractCallback("bot4", "func4", true);

AddUseItemCallback("", "secret1", "door3", "unlock", true);

AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);

AddUseItemCallback("", "crowbar1", "crowdoor", "UsedCrowbarOnDoor", true);
AddEntityCollideCallback("crowbar2", "area1", "CollideAreaBreakDoor", true, 1);

AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);

SetEntityActive("crowbar_broken", true);

AddEntityCollideCallback("Player", "KillTheLights", "LightsOut", true, 1);
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door2", true, true);

PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false);

PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);

GiveSanityDamage(5.0f, true);
}

void unlock(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
}

void UsedCrowbarOnDoor(string &in asItem, string &in asEntity)
{
AddTimer("", 0.2, "TimerSwitchShovel");
RemoveItem("crowbar1");
}


void TimerSwitchShovel(string &in asTimer)
{
PlaySoundAtEntity("","puzzle_place_jar.snt", "", 0, false);
SetEntityActive("crowbar2", true);
}

void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
AddPlayerSanity(25);
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
SetSwingDoorLocked("crowdoor", false, true);
AddPropImpulse("crowdoor", 0, 0, -50, "World");
SetSwingDoorDisableAutoClose("crowdoor", true);
SetSwingDoorClosed("crowdoor", false, false);
SetMoveObjectState("crowdoor", 1);
PlaySoundAtEntity("","break_wood_metal", "area2", 0, false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "area2", false);
SetEntityActive("crowbar2", false);
SetLocalVarInt("Door", 1);
}

void lockedoor(string &in entity)

{
if(GetSwingDoorLocked("locked1") == true)
{

SetMessage("Messages", "Broken", 1);

}
}

void LightsOut(string &in asParent, string &in asChild, int alState)
{
SetLampLit("light_1", false, true);
AddTimer("", 2, "Out2");
}


void Out2(string &in asTimer)
{
SetLampLit("light_2", false, true);
AddTimer("", 2, "Out3");
}


void Out3(string &in asTimer)
{
SetLampLit("light_3", false, true);
AddTimer("", 2, "Out4");
}


void Out4(string &in asTimer)
{
SetLampLit("light_4", false, true);
AddTimer("", 2, "Out5");
}


void Out5(string &in asTimer)
{
SetLampLit("light_5", false, true);
AddTimer("", 2, "Out6");
}


void Out6(string &in asTimer)
{
SetLampLit("light_6", false, true);
}

void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "");
}
void func1(string &in asEntity)
{
AddLocalVarInt("Var1", 1);
func5();
}

void func2(string &in asEntity)
{
AddLocalVarInt("Var1", 1);
func5();
}

void func3(string &in asEntity)
{
AddLocalVarInt("Var1", 1);
func5();
}

void func4(string &in asEntity)
{
AddLocalVarInt("Var1", 1);
func5();
}

void func5()
{
if(GetLocalVarInt("Var1") == 4)
{
SetSwingDoorLocked("button1", false, false);
PlaySoundAtEntity("", "unlock_door.snt", "door1", 0.5f, false);
}
}

void Explode (string &in asParent, string &in asChild, int alState)
{
SetPropHealth("pot_explode", 0);
}

void desbloquear(string &in asEntity, int alState)
{
if(alState == 1 || alState == -1) //Pull lever up or down to open the door
{
SetSwingDoorLocked("ENTER_DOOR_NAME", false, false); //unlocks the door
SetEntityActive("ENTER_MONSTERNAME", true);
}
else
{
//Nothing, what happens if the lever is in the middle
}


////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
Thanks in advance


RE: Error - Unexpected end of file - Adny - 07-21-2012

You missed a "}" on the end of the function desbloquear, I added it:


void desbloquear(string &in asEntity, int alState)
{
if(alState == 1 || alState == -1) //Pull lever up or down to open the door
{
SetSwingDoorLocked("ENTER_DOOR_NAME", false, false); //unlocks the door
SetEntityActive("ENTER_MONSTERNAME", true);
}
else
{
//Nothing, what happens if the lever is in the middle
}
}


RE: Error - Unexpected end of file - KingCrimson - 07-21-2012

It worked.

Thanks Big Grin