Frictional Games Forum (read-only)
[SCRIPT] Unexpected End of File Crash Report...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] Unexpected End of File Crash Report...HELP! (/thread-13540.html)



Unexpected End of File Crash Report...HELP! - DrOctoganapus8 - 02-24-2012

Hey guys, I'm getting an error message on my script saying that there is an unexpected error...
How do I fix this?

Here is the crash report--

FATAL ERROR: Could not load script file 'custom_stories/My Custom Story(The Landlord)/maps/map02.hps'!
main (139, 2) : ERR : Unexpected end of file

Here is my FULL script, just incase there is a strange error in there somewhere...

////////////////////////////////////////
//Script Start
void OnStart()

{
//////////////////////////////////////////////////////////////////////////////
//Add the Lantern and 10 Tinderboxes when in Debug mode, LET THERE BE LIGHT!!!
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");

for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
}

{
AddUseItemCallback("", "bedroom_key", "locked_bedroom", "func_unlock", true);
AddEntityCollideCallback("Player", "killlights_script", "func_killlights", true, 1);
SetEntityPlayerInteractCallback("therentor_note", "func_enable", true);
AddEntityCollideCallback("Player", "gruntspawn_script", "spawn_grunt", true, 1);
AddEntityCollideCallback("Player", "redlight_script1", "func_redlight", true, 1);
AddEntityCollideCallback("Player", redlight_script2", "func_redlight2", true, 1);
}
}

//////////////////////////////
//script for unlocking bedroom
void func_unlock(string &in item, string &in door)
{
SetSwingDoorLocked("locked_bedroom", false, true);
PlaySoundAtEntity("", "unlock_door", door, 0, false);
RemoveItem("bedroom_key");
}

//////////////////////////////////////////////////////
//Script for enabling light script after grabbing note
void func_enable(string &in item)
{
SetEntityActive("killlights_script", true);
SetEntityActive("gruntspawn_script", true);
}

///////////////////////////////
//Script for killing the lights
void func_killlights(string &in asParent, string &in asChild, int alState)
{
SetLampLit("lightoff01", false, false);
SetLampLit("lightoff02", false, false);
SetLampLit("lightoff03", false, false);
SetLampLit("lightoff04", false, false);
SetLampLit("lightoff05", false, false);
SetLampLit("lightoff06", false, false);
SetLampLit("lightoff07", false, false);
SetLampLit("lightoff08", false, false);
SetLampLit("lightoff09", false, false);
SetLampLit("lightoff10", false, false);

SetEntityActive("red_light1", true);
SetEntityActive("red_light2", true);
SetEntityActive("armor_spawn1", true);
SetEntityActive("armor_spawn2", true);

SetSwingDoorClosed("slam_scare", true, true);

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

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

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

PlayMusic("21_event_pit.ogg", false, 1.00, 0, 0, false);
GiveSanityDamage(10.0f, true);
}

////////////////////////////////
//Script for spawning REAL grunt
void spawn_grunt(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("grunt_spawn", true);
AddEnemyPatrolNode("grunt_spawn", "PathNodeArea_3", 5, "");
AddEnemyPatrolNode("grunt_spawn", "PathNodeArea_4", 3, "");
AddEnemyPatrolNode("grunt_spawn", "PathNodeArea_5", 3, "");
AddEnemyPatrolNode("grunt_spawn", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("grunt_spawn", "PathNodeArea_7", 3, "");
AddEnemyPatrolNode("grunt_spawn", "PathNodeArea_8", 3, "");
AddEnemyPatrolNode("grunt_spawn", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("grunt_spawn", "PathNodeArea_10", 3, "");
AddEnemyPatrolNode("grunt_spawn", "PathNodeArea_11", 5, "");
}

///////////////////////////////////
//Script for redlights/creepy doors
void func_redlight(string &in asParent, string &in asChild, int alState)
{
SetPlayerActive(false);
StartPlayerLookAt("lock_door", 2, 6, "");
AddTimer("look01", 1.5f, "look01");
}
void look01(string&in asTimer)
{
SetEntityActive("redlight_spawn1", true);
SetEntityActive("redlight_spawn2", true);

SetEntityActive("burntout1", false);

SetEntityActive("burntout2", false);
GiveSanityDamage(2.5f, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
SetEntityActive("redlight_script2", true);
SetSwingDoorClosed("lock_door", true, true);
SetSwingDoorLocked("lock_door", true, true);
{
SetPlayerActive(true);
StopPlayerLookAt();
}
}

void func_redlight2(string &in asParent, straing &in asChild, int alState)
{
SetPlayerActive(false);
StartPlayerLookAt("smash_door", 2, 6, "");
AddTimer("look02", 1.5f, "look02");
}

void look02(string&in asTimer)
{
SetEntityActive("redlight_spawn3", true);
SetEntityActive("redlight_spawn4", true);
SetEntityActive("burntout3", false);
SetEntityActive("burntout4", false);
GiveSanityDamage(2.5f, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
{
SetEntityActive("explode_script", true);
SetPlayerActive(true);
StopPlayerLookAt();
}
}

//////////////
//Script End
void OnLeave()

Can someone please help? Thanks a bunch! Big Grin



RE: Unexpected End of File Crash Report...HELP! - Obliviator27 - 02-24-2012

AddEntityCollideCallback("Player", redlight_script2", "func_redlight2", true, 1);

It's missing a quotation mark. Usually "unexpected end of file" errors are due to not closing strings correctly (missing one of the quotation marks)



RE: Unexpected End of File Crash Report...HELP! - DrOctoganapus8 - 02-25-2012

Awesome, thanks a bunch! I'll fix it as soon as I can get on my computer with all my scripts, etc.



RE: Unexpected End of File Crash Report...HELP! - DrOctoganapus8 - 03-01-2012

Hey, thanks for the help last time, but I have another error, and I can't seem to figure out how to fix it.
I added a new function that calls a timer, which calls another timer.
The error is:

FATAL ERROR: Could not load script file 'custom_stories/My Custom Stroy(The Landlord)/maps/map02.hps'!
main (149, 26) : ERR : Expected ')' or ','
main (156, 26) : ERR : Expected ')' or ','

What I added to the script was:

void func_doorboom(string &in asParent, string &in asChild, int alState)
{
SetPlayerActive(false);
StartPlayerLookAt("smash_door", 2, 6, "");
AddTimer("look03", 1.5f, "look03");
}

void look03(string&in as Timer)
{
PlaySoundAtEntity("", "12_girl_scream.snt", "Player", 0, false);
PlaySoundAtEntity("", "scare_steps_big1.ogg", "Player", 0, false);
AddTimer("look04", 1.5f, "look04");
}

void look04(string&in as Timer)
{
SetPropHealth("smash_door", 0.0f);
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);
SetPlayerActive(true);
StopPlayerLookAt();
}

Which makes the full script:

////////////////////////////////////////
//Script Start
void OnStart()

{
//////////////////////////////////////////////////////////////////////////////
//Add the Lantern and 10 Tinderboxes when in Debug mode, LET THERE BE LIGHT!!!
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");

for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
}

{
AddUseItemCallback("", "bedroom_key", "locked_bedroom", "func_unlock", true);
AddEntityCollideCallback("Player", "killlights_script", "func_killlights", true, 1);
SetEntityPlayerInteractCallback("therentor_note", "func_enable", true);
AddEntityCollideCallback("Player", "gruntspawn_script", "spawn_grunt", true, 1);
AddEntityCollideCallback("Player", "redlight_script1", "func_redlight", true, 1);
AddEntityCollideCallback("Player", "redlight_script2", "func_redlight2", true, 1);
AddEntityCollideCallback("Player", "explode_script", "func_doorboom", true, 1);
}
}

//////////////////////////////
//script for unlocking bedroom
void func_unlock(string &in item, string &in door)
{
SetSwingDoorLocked("locked_bedroom", false, true);
PlaySoundAtEntity("", "unlock_door", door, 0, false);
RemoveItem("bedroom_key");
}

//////////////////////////////////////////////////////
//Script for enabling light script after grabbing note
void func_enable(string &in item)
{
SetEntityActive("killlights_script", true);
SetEntityActive("gruntspawn_script", true);
}

///////////////////////////////
//Script for killing the lights
void func_killlights(string &in asParent, string &in asChild, int alState)
{
SetLampLit("lightoff01", false, false);
SetLampLit("lightoff02", false, false);
SetLampLit("lightoff03", false, false);
SetLampLit("lightoff04", false, false);
SetLampLit("lightoff05", false, false);
SetLampLit("lightoff06", false, false);
SetLampLit("lightoff07", false, false);
SetLampLit("lightoff08", false, false);
SetLampLit("lightoff09", false, false);
SetLampLit("lightoff10", false, false);

SetEntityActive("red_light1", true);
SetEntityActive("red_light2", true);
SetEntityActive("armor_spawn1", true);
SetEntityActive("armor_spawn2", true);

SetSwingDoorClosed("slam_scare", true, true);

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

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

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

PlayMusic("21_event_pit.ogg", false, 1.00, 0, 0, false);
GiveSanityDamage(10.0f, true);
}

////////////////////////////////
//Script for spawning REAL grunt
void spawn_grunt(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("grunt_spawn", true);
AddEnemyPatrolNode("grunt_spawn", "PathNodeArea_3", 5, "");
AddEnemyPatrolNode("grunt_spawn", "PathNodeArea_4", 3, "");
AddEnemyPatrolNode("grunt_spawn", "PathNodeArea_5", 3, "");
AddEnemyPatrolNode("grunt_spawn", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("grunt_spawn", "PathNodeArea_7", 3, "");
AddEnemyPatrolNode("grunt_spawn", "PathNodeArea_8", 3, "");
AddEnemyPatrolNode("grunt_spawn", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("grunt_spawn", "PathNodeArea_10", 3, "");
AddEnemyPatrolNode("grunt_spawn", "PathNodeArea_11", 5, "");
}

///////////////////////////////////
//Script for redlights/creepy doors
void func_redlight(string &in asParent, string &in asChild, int alState)
{
SetPlayerActive(false);
StartPlayerLookAt("lock_door", 2, 6, "");
AddTimer("look01", 1.5f, "look01");
}
void look01(string&in asTimer)
{
SetEntityActive("redlight_spawn1", true);
SetEntityActive("redlight_spawn2", true);

SetEntityActive("burntout1", false);

SetEntityActive("burntout2", false);
GiveSanityDamage(2.5f, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
SetEntityActive("redlight_script2", true);
SetSwingDoorClosed("lock_door", true, true);
SetSwingDoorLocked("lock_door", true, true);
{
SetPlayerActive(true);
StopPlayerLookAt();
}
}

void func_redlight2(string &in asParent, string &in asChild, int alState)
{
SetPlayerActive(false);
StartPlayerLookAt("smash_door", 2, 6, "");
AddTimer("look02", 1.5f, "look02");
}

void look02(string&in asTimer)
{
SetEntityActive("redlight_spawn3", true);
SetEntityActive("redlight_spawn4", true);

SetEntityActive("burntout3", false);

SetEntityActive("burntout4", false);
GiveSanityDamage(2.5f, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
{
SetEntityActive("explode_script", true);
SetPlayerActive(true);
StopPlayerLookAt();
}
}

void func_doorboom(string &in asParent, string &in asChild, int alState)
{
SetPlayerActive(false);
StartPlayerLookAt("smash_door", 2, 6, "");
AddTimer("look03", 1.5f, "look03");
}

void look03(string&in as Timer)
{
PlaySoundAtEntity("", "12_girl_scream.snt", "Player", 0, false);
PlaySoundAtEntity("", "scare_steps_big1.ogg", "Player", 0, false);
AddTimer("look04", 1.5f, "look04");
}

void look04(string&in as Timer)
{
SetPropHealth("smash_door", 0.0f);
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);
SetPlayerActive(true);
StopPlayerLookAt();
}

Please help!! Thanks!~



RE: Unexpected End of File Crash Report...HELP! - flamez3 - 03-01-2012

Your syntax's are wrong for the 2 timers. Change them to this:

(string &in asTimer)


and I don't think your .hps file is in the correct place.


RE: Unexpected End of File Crash Report...HELP! - DrOctoganapus8 - 03-01-2012

Thanks a bunch flamez3!!!
Works perfectly now!



RE: Unexpected End of File Crash Report...HELP! - flamez3 - 03-01-2012

np Smile