Frictional Games Forum (read-only)
An "Unexpected end of file" error? - 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: An "Unexpected end of file" error? (/thread-10909.html)



An "Unexpected end of file" error? - MissMarilynn - 10-21-2011

I keep getting an unexpected end of file error with my scripting and it says the problem is with the last line (which is just })

Any suggestions?


PHP Code:
void OnStart() {     AddEntityCollideCallback("Player""monsterspawn""MonsterFunction"true1);    AddEntityCollideCallback("Player""clockbong""ClockScare"true1);        SetEntityPlayerInteractCallback("Girls_Dorm_First_Floor""IsItLocked3"true);    SetEntityPlayerInteractCallback("Boys_Dorm_First_Floor""IsItLocked4"true);    SetEntityPlayerInteractCallback("ra_office""IsItLocked5"true);    AddUseItemCallback("open_Girls_Dorm_First_Floor_door""girl_key""Girls_Dorm_First_Floor""openlevel"false);    }
void openlevel(string &in asItemstring &in asEntity){    SetSwingDoorLocked("Girls_Dorm_First_Floor"falsetrue);    PlaySoundAtEntity("""unlock_door""door1"0false);    RemoveItem("girl_key");    PlayMusic("02_puzzle.ogg"false0.7f010false);    GiveSanityBoostSmall();}
void MonsterFunction(string &in asParentstring &in asChildint alState){    SetEntityActive("servant_grunt_1"true);     AddEnemyPatrolNode("servant_grunt_1""PathNodeArea_1"4"");    AddEnemyPatrolNode("servant_grunt_1""PathNodeArea_2"1"");    AddEnemyPatrolNode("servant_grunt_1""PathNodeArea_3"1"");    AddEnemyPatrolNode("servant_grunt_1""PathNodeArea_4"4"");}
void ClockScare(string &in asParentstring &in asChildint alState){    PlaySoundAtEntity("brute""notice_long.snt""PosNodeArea_1"1.0ffalse);    PlaySoundAtEntity("""react_scare""Player"0false);    GiveSanityDamage(5.0ftrue);}
////LOCKED DOORS
///This is the RA's officevoid IsItLocked3(string &in entity){     if (GetSwingDoorLocked(entity)     && entity == "ra_door")     {          SetMessage("Doors", "LockedDoor5", 0);          AddQuest("open_ra_quest", "open_door");     }} 
///This is the girls dormvoid IsItLocked4(string &in entity){     if (GetSwingDoorLocked(entity)     && entity == "Girls_Dorm_First_Floor")     {          SetMessage("Doors", "LockedDoor3", 0);          AddQuest("open_girls_quest", "open_door");     }} 
///This is the boys dorm
void IsItLocked5(string &in entity){     if (GetSwingDoorLocked(entity)     && entity == ""Boys_Dorm_First_Floor")     {          SetMessage("Doors", "LockedDoor4", 0);          AddQuest("find_crowbar_quest", "open_door");     }} 
void OnEnter(){PlayMusic("
01_amb_darkness.ogg", true,1.0f, 2.0f, 0, true);}
void OnLeave(){    SetupLoadScreen("
LoadingText", "Loading_GirlsDorm", 1, "Rose.jpg");} 



RE: An "Unexpected end of file" error? - Your Computer - 10-21-2011

You have an extra quotation mark for Boys_Dorm_First_Floor in the if statement.

BTW, when using php or code bbcode, it is best if you copy the code directly from your text editor when placing your code in between code or php bbcode.



RE: An "Unexpected end of file" error? - MissMarilynn - 10-21-2011

(10-21-2011, 08:54 PM)Your Computer Wrote: You have an extra quotation mark for Boys_Dorm_First_Floor in the if statement.

BTW, when using php or code bbcode, it is best if you copy the code directly from your text editor when placing your code in between code or php bbcode.
Thank you! I was going over it so many times and I couldn't figure it out.

I tried but it didn't work...:/


RE: An "Unexpected end of file" error? - Your Computer - 10-21-2011

(10-21-2011, 08:55 PM)MissMarilynn Wrote: I tried but it didn't work...:/

I always avoid the WYSIWYG editor of the forums. The source editor will never give you problems (if you understand bbcodes).


RE: An "Unexpected end of file" error? - MissMarilynn - 10-21-2011

(10-21-2011, 08:59 PM)Your Computer Wrote:
(10-21-2011, 08:55 PM)MissMarilynn Wrote: I tried but it didn't work...:/

I always avoid the WYSIWYG editor of the forums. The source editor will never give you problems (if you understand bbcodes).
I understand bbcodes a little. I'm relatively new to forums. It's been a huge help though with my scripting!

I can't get my key code to work for some reason too...It's a level door I'm trying to unlock. My code right now is:


AddUseItemCallback("open_Girls_Dorm_First_Floor_door", "girl_key", "Girls_Dorm_First_Floor", "openlevel", false);


void openlevel(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Girls_Dorm_First_Floor", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("girl_key");
PlayMusic("02_puzzle.ogg", false, 0.7f, 0, 10, false);
GiveSanityBoostSmall();
}

It removes my key and give me the sanity boost and plays the music but it won't unlock.


RE: An "Unexpected end of file" error? - Your Computer - 10-21-2011

Level doors are unlocked with SetLevelDoorLocked, not SetSwingDoorLocked.


RE: An "Unexpected end of file" error? - MissMarilynn - 10-21-2011

(10-21-2011, 09:31 PM)Your Computer Wrote: Level doors are unlocked with SetLevelDoorLocked, not SetSwingDoorLocked.
It gave me an error when I switched it out?

It said no matching signatures.

AddUseItemCallback("", "girl_key", "Girls_Dorm_First_Floor", "openlevel", false);


void openlevel(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("Girls_Dorm_First_Floor", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("girl_key");
PlayMusic("02_puzzle.ogg", false, 0.7f, 0, 10, false);
GiveSanityBoostSmall();
}



RE: An "Unexpected end of file" error? - Your Computer - 10-21-2011

That's because level doors don't have any applicable effects, and so there is no third parameter.

Always refer to this page when dealing with HPL2 script functions: http://wiki.frictionalgames.com/hpl2/amnesia/script_functions


RE: An "Unexpected end of file" error? - MissMarilynn - 10-21-2011

(10-21-2011, 09:37 PM)Your Computer Wrote: That's because level doors don't have any applicable effects, and so there is no third parameter.

Always refer to this page when dealing with HPL2 script functions: http://wiki.frictionalgames.com/hpl2/amnesia/script_functions
Third parameter? So I would have to change my script to:

AddUseItemCallback("", "girl_key", "Girls_Dorm_First_Floor", "openlevel");


void openlevel(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("Girls_Dorm_First_Floor", false);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("girl_key");
PlayMusic("02_puzzle.ogg", false, 0.7f, 0, 10, false);
GiveSanityBoostSmall();
}