Frictional Games Forum (read-only)
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: ERROR: Unexpected end of file (/thread-10855.html)



ERROR: Unexpected end of file - Wickedwrath - 10-19-2011

Hello! I need some help here with this script. It says "Unexpected end of file" and I just can't figure out what's wrong. Can anyone help and solve this, please?

Quote: ////////////////////////////
// Run first time starting map
void OnStart()

{
AddUseItemCallback("", "Key_1", "Door_1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "Key_2", "Door_2", "UsedKeyOnDoor_2", true);
AddUseItemCallback("", "Secretkey2", "metal_1", "UsedKeyOnDoor_3", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door_1", false, true);
PlaySoundEntity("", "unlock_door", "Door_1", 0, false);
RemoveItem("Key_1");
}

void UsedKeyOnDoor_2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door_2", false, true);
PlaySoundAtEntity("", "unlock_door", "Door_2", 0,false);
RemoveItem("Key_2");

void Message_1(string &in asEntity)
{
SetMessage("Message", "Message_1", 2);
}
void UsedKeyOnDoor_3(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("metal_1", false, true);
PlaySoundEntity("", "unlock_door", "metal_1", 0, false);
RemoveItem("Secretkey2");
}
/////////////////////////////
// Run when entering map
void OnEnter()
{

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

}



RE: ERROR: Unexpected end of file - jens - 10-19-2011

PHP Code:
////////////////////////////
// Run first time starting map
void OnStart()
{
  
AddUseItemCallback("""Key_1""Door_1""UsedKeyOnDoor"true);
  
AddUseItemCallback("""Key_2""Door_2""UsedKeyOnDoor_2"true);
  
AddUseItemCallback("""Secretkey2""metal_1""UsedKeyOnDoor_3"true);
}

void UsedKeyOnDoor(string &in asItemstring &in asEntity)
{
  
SetSwingDoorLocked("Door_1"falsetrue);
  
PlaySoundEntity("""unlock_door""Door_1"0false);
  
RemoveItem("Key_1");
}

void UsedKeyOnDoor_2(string &in asItemstring &in asEntity)
{
  
SetSwingDoorLocked("Door_2"falsetrue);
  
PlaySoundAtEntity("""unlock_door""Door_2"0,false);
  
RemoveItem("Key_2");
// <- THERE WAS A } MISSING.

void Message_1(string &in asEntity)
{
  
SetMessage("Message""Message_1"2);
}

void UsedKeyOnDoor_3(string &in asItemstring &in asEntity)
{
  
SetSwingDoorLocked("metal_1"falsetrue);
  
PlaySoundEntity("""unlock_door""metal_1"0false);
  
RemoveItem("Secretkey2");


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


}

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




There was a } missing, I added a comment in the code at the location.



RE: ERROR: Unexpected end of file - Wickedwrath - 10-19-2011

(10-19-2011, 03:10 PM)jens Wrote:
PHP Code:
////////////////////////////
// Run first time starting map
void OnStart()
{
  
AddUseItemCallback("""Key_1""Door_1""UsedKeyOnDoor"true);
  
AddUseItemCallback("""Key_2""Door_2""UsedKeyOnDoor_2"true);
  
AddUseItemCallback("""Secretkey2""metal_1""UsedKeyOnDoor_3"true);
}

void UsedKeyOnDoor(string &in asItemstring &in asEntity)
{
  
SetSwingDoorLocked("Door_1"falsetrue);
  
PlaySoundEntity("""unlock_door""Door_1"0false);
  
RemoveItem("Key_1");
}

void UsedKeyOnDoor_2(string &in asItemstring &in asEntity)
{
  
SetSwingDoorLocked("Door_2"falsetrue);
  
PlaySoundAtEntity("""unlock_door""Door_2"0,false);
  
RemoveItem("Key_2");
// <- THERE WAS A } MISSING.

void Message_1(string &in asEntity)
{
  
SetMessage("Message""Message_1"2);
}

void UsedKeyOnDoor_3(string &in asItemstring &in asEntity)
{
  
SetSwingDoorLocked("metal_1"falsetrue);
  
PlaySoundEntity("""unlock_door""metal_1"0false);
  
RemoveItem("Secretkey2");


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


}

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




There was a } missing, I added a comment in the code at the location.
Hm.. Strange. It's still not working. (I also deleted your "// <- THERE WAS A } MISSING."-text) and still not working.





RE: ERROR: Unexpected end of file - jens - 10-19-2011

Can't see anything that would cause an unexpected end of file. usually it is a {} )( ;, " that is missing or incorrect positioned.



RE: ERROR: Unexpected end of file - Wickedwrath - 10-19-2011

(10-19-2011, 03:32 PM)jens Wrote: Can't see anything that would cause an unexpected end of file. usually it is a {} )( ;, " that is missing or incorrect positioned.
Hm.. I solve it by removing:

Code:
PlaySoundEntity("", "unlock_door", "metal_1", 0, false);





RE: ERROR: Unexpected end of file - jens - 10-19-2011

Ah, that should be PlaySoundAtEntity not PlaySoundEntity!



RE: ERROR: Unexpected end of file - Wickedwrath - 10-19-2011

(10-19-2011, 03:36 PM)jens Wrote: Ah, that should be PlaySoundAtEntity not PlaySoundEntity!
I tryed to change it, but then I got the error again (unexpected end of file).
The strange thing is, that when I remove the whole "PlaySoundAtEntity("", "unlock_door", "metal_1", 0, false);", it still gives me a "key sound". Is it supose to do that?


(10-19-2011, 03:36 PM)jens Wrote: Ah, that should be PlaySoundAtEntity not PlaySoundEntity!
Ah, I got it to work now, with your "PlaySoundAtEntity"-script! I don't know what went wrong..
Thank you! Smile





RE: ERROR: Unexpected end of file - death5657 - 03-17-2013

Hi im stuck to and really don't know what to do can you help me??? all it says main (25,15) : ERR : Expected "{"
hear is my hps file:
////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "K_1", "door_1", "UsedKeyOnDoor", true);
}

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

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


}

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


RE: ERROR: Unexpected end of file - PutraenusAlivius - 03-17-2013

You are missing the { and } at void OnLeave().