Frictional Games Forum (read-only)
Script Error unexpected end of file! Please help - 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! Please help (/thread-14530.html)



Script Error unexpected end of file! Please help - hiippari - 04-06-2012

So i get this error when i try to go in my map : Error: ........Cant open The Prison 2.map Unexpected end of file 125,2

Here is my script. Please help, thanks


void OnStart()
{
SetLocalVarInt("Var1", 0);
AddEntityCollideCallback("Player", "explode_scare", "Explode", true, 1);
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
AddUseItemCallback("", "key_1", "door_3", "UsedKeyOnDoor", true);
AddUseItemCallback("", "needle_1", "door_4", "Needle", true);
AddUseItemCallback("bottleEcon", "glass_container_1", "acid_container_1", "UseBottle", true);
AddUseItemCallback("bottleFcon", "glass_container_filled", "acid_container_1", "UseBottle", false);
AddUseItemCallback("AcidOnDoor", "glass_container_filled", "AcidDoor", "UseAcidDoor", true);
}


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


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

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

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


void func4()
{
if(GetLocalVarInt("Var1") == 3)
{
/////add what ever you want to happen after you press all 3 buttons here.
SetSwingDoorLocked("door1", false, false);
PlaySoundAtEntity("", "unlock_door.snt", "door1", 0.5f, false);
}
}

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

SetSwingDoorLocked("door_1", false, true);

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

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

GiveSanityDamage(10.0f, true);
}

void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("brute_1", true);
ShowEnemyPlayerPosition("brute_1");
AddEnemyPatrolNode("brute_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_6", 0, "");
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_3", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "door_3", 0, false);
RemoveItem("key_3");
}

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


void UseBottle(string &in asItem, string &in asEntity)
{
if(asItem == "glass_container_1")
PlaySoundAtEntity("fillbottle", "puzzle_acid_success", asEntity, 1.0f, false);

RemoveItem(asItem);
GiveItemFromFile("glass_container_filled", "glass_container_filled.ent");

GiveSanityBoostSmall();
}

void UseAcidDoor (string &in asItem, string &in asEntity)
{
if(asItem == "glass_container_filled")
{
PlaySoundAtEntity("burnlock", "puzzle_acid", "AcidDoor", 1.0f, false);
CreateParticleSystemAtEntityExt("AcidSteam","ps_steam_puff","AcidDoor", false, 0.0f, 0.35f, 0.0f, 1.0f, false, 10, 10, 10, 10);
CreateParticleSystemAtEntity("AcidBubbles","ps_acid_container_bubbles","AcidDoor", false);
SetSwingDoorLocked("AcidDoor", false, false);
CompleteQuest("AcidLock", "AcidLock");
GiveSanityBoost();
RemoveItem("glass_container_filled");

}


void TimerPartKill(string &in asTimer)
{
DestroyParticleSystem("AcidBubbles");
DestroyParticleSystem("AcidSteam");
}

void OnLeave()
{

}



RE: Script Error unexpected end of file! Please help - Cranky Old Man - 04-06-2012

(04-06-2012, 10:52 AM)hiippari Wrote: void UseAcidDoor (string &in asItem, string &in asEntity)
{
---if(asItem == "glass_container_filled")
---{
------PlaySoundAtEntity("burnlock", "puzzle_acid", "AcidDoor", 1.0f, false);
------CreateParticleSystemAtEntityExt("AcidSteam","ps_steam_puff","AcidDoor", false, 0.0f, 0.35f, 0.0f, 1.0f, false, 10, 10, 10, 10);
------CreateParticleSystemAtEntity("AcidBubbles","ps_acid_container_bubbles","AcidDoor", false);
------SetSwingDoorLocked("AcidDoor", false, false);
------CompleteQuest("AcidLock", "AcidLock");
------GiveSanityBoost();
------RemoveItem("glass_container_filled");
------
---}
*** ---> } <--- ***




RE: Script Error unexpected end of file! Please help - hiippari - 04-06-2012

(04-06-2012, 11:17 AM)Cranky Old Man Wrote: Still doesnt work same error Sad
(04-06-2012, 10:52 AM)hiippari Wrote: void UseAcidDoor (string &in asItem, string &in asEntity)
{
---if(asItem == "glass_container_filled")
---{
------PlaySoundAtEntity("burnlock", "puzzle_acid", "AcidDoor", 1.0f, false);
------CreateParticleSystemAtEntityExt("AcidSteam","ps_steam_puff","AcidDoor", false, 0.0f, 0.35f, 0.0f, 1.0f, false, 10, 10, 10, 10);
------CreateParticleSystemAtEntity("AcidBubbles","ps_acid_container_bubbles","AcidDoor", false);
------SetSwingDoorLocked("AcidDoor", false, false);
------CompleteQuest("AcidLock", "AcidLock");
------GiveSanityBoost();
------RemoveItem("glass_container_filled");
------
---}
*** ---> } <--- ***




RE: Script Error unexpected end of file! Please help - Cranky Old Man - 04-06-2012

(04-06-2012, 11:54 AM)hiippari Wrote: Still doesnt work same error Sad
I don't believe you. Did you forget to save the file? ...because "unexpected end of file" means that you forgot a bracket. If you type the correct number of brackets, you should at least get another error.

Hold on, there was something else in the code as well...

Edit:
These lines look odd:
Code:
if(asItem == "glass_container_1")
PlaySoundAtEntity("fillbottle", "puzzle_acid_success", asEntity, 1.0f, false);

...because I've only seen if statements as either
Code:
if(asItem == "glass_container_1") PlaySoundAtEntity("fillbottle", "puzzle_acid_success", asEntity, 1.0f, false);

...or:

Code:
if(asItem == "glass_container_1")
{
   PlaySoundAtEntity("fillbottle", "puzzle_acid_success", asEntity, 1.0f, false);
}




RE: Script Error unexpected end of file! Please help - hiippari - 04-06-2012

(04-06-2012, 12:25 PM)Cranky Old Man Wrote:
(04-06-2012, 11:54 AM)hiippari Wrote: Still doesnt work same error Sad
I don't believe you. Did you forget to save the file? ...because "unexpected end of file" means that you forgot a bracket. If you type the correct number of brackets, you should at least get another error.

Hold on, there was something else in the code as well...

Edit:
These lines look odd:
Code:
if(asItem == "glass_container_1")
PlaySoundAtEntity("fillbottle", "puzzle_acid_success", asEntity, 1.0f, false);

...because I've only seen if statements as either
Code:
if(asItem == "glass_container_1") PlaySoundAtEntity("fillbottle", "puzzle_acid_success", asEntity, 1.0f, false);

...or:

Code:
if(asItem == "glass_container_1")
{
   PlaySoundAtEntity("fillbottle", "puzzle_acid_success", asEntity, 1.0f, false);
}
I will try it Smile





RE: Script Error unexpected end of file! Please help - Cranky Old Man - 04-06-2012

Of course, judging by the context, what you REALLY want to write is this:

Code:
void UseBottle(string &in asItem, string &in asEntity)
{
if(asItem == "glass_container_1")
{
PlaySoundAtEntity("fillbottle", "puzzle_acid_success", asEntity, 1.0f, false);
RemoveItem(asItem);
GiveItemFromFile("glass_container_filled", "glass_container_filled.ent");
GiveSanityBoostSmall();
}
}



RE: Script Error unexpected end of file! Please help - hiippari - 04-06-2012

It works thank u so much Smile))