Frictional Games Forum (read-only)
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: UNEXPECTED END OF FILE ERROR? (/thread-17294.html)



UNEXPECTED END OF FILE ERROR? - taz251 - 07-27-2012

Hello! I'm new to making amnesia custom stories. I have been trying to code and I have been having tons of trouble. The problem that keeps coming up is when I try to add another unlock door code. I keep getting the "Unexpected End of File" Error.

Here is what I have down:

void OnStart()
{
SetEntityCallbackFunc("needle_1", "jump");
}

void jump(string &in asEntity, string &in type){
SetEntityActive("pig", true);
PlayGuiSound("21/21_scream10.ogg", 1.0f);
StartScreenShake(0.25f, 0.25, 0, 0.25);
{

}

void OnEnter()
{
AddUseItemCallback("", "hallwaykey_1", "mansion_2", "UsedKeyOnDoor", true);
}

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

AddUseItemCallback("", "needle_1", "mansion_4", "Needle", true);
{

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

}


RE: UNEXPECTED END OF FILE ERROR? - Adny - 07-27-2012

Fixed up some of the misplaced brackets and syntax; also placed the callbacks on start and added an "OnLeave" function.:


void OnStart()
{
SetEntityCallbackFunc("needle_1", "jump");
AddUseItemCallback("", "hallwaykey_1", "mansion_2", "UsedKeyOnDoor", true);
AddUseItemCallback("", "needle_1", "mansion_4", "Needle", true);
}

void jump(string &in asEntity, string &in asType)
{
SetEntityActive("pig", true);
PlayGuiSound("21/21_scream10.ogg", 1.0f);
StartScreenShake(0.25f, 0.25, 0, 0.25);
}

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

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

void OnEnter()
{

}

void OnLeave()
{

}

Hope that helped!


RE: UNEXPECTED END OF FILE ERROR? - taz251 - 07-27-2012

(07-27-2012, 09:59 AM)andyrockin123 Wrote: Fixed up some of the misplaced brackets and syntax; also placed the callbacks on start and added an "OnLeave" function.:


void OnStart()
{
SetEntityCallbackFunc("needle_1", "jump");
AddUseItemCallback("", "hallwaykey_1", "mansion_2", "UsedKeyOnDoor", true);
AddUseItemCallback("", "needle_1", "mansion_4", "Needle", true);
}

void jump(string &in asEntity, string &in asType)
{
SetEntityActive("pig", true);
PlayGuiSound("21/21_scream10.ogg", 1.0f);
StartScreenShake(0.25f, 0.25, 0, 0.25);
}

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

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

void OnEnter()
{

}

void OnLeave()
{

}

Hope that helped!
Can't thank you enough for re-writing it, yet I get a new error.
"No matching signatures to SetSwingDoorLocked (string@&, const bool)" at line (24,1)


RE: UNEXPECTED END OF FILE ERROR? - Adny - 07-27-2012

I see; set swing door locked needs a second Boolean (true/false) value to determine whether or not to use effects; these effects (depending on the type of door) are the unlocking sound played. Here, I corrected the entire function "Needle", and marked the new Boolean value false(you can change that though):


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


RE: UNEXPECTED END OF FILE ERROR? - taz251 - 07-27-2012

(07-27-2012, 10:15 AM)andyrockin123 Wrote: I see; set swing door locked needs a second Boolean (true/false) value to determine whether or not to use effects; these effects (depending on the type of door) are the unlocking sound played. Here, I corrected the entire function "Needle", and marked the new Boolean value false(you can change that though):


void Needle(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_4", false, false);
PlaySoundAtEntity("", "unlock_door", "mansion_4", 0, false);
RemoveItem("needle_1");
}
THANK YOU SO MUCH! Smile
It worked!