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



Unexpected end of file?? - Twitchez - 04-18-2012

Hey again!

Just as I was programming a script event, I started to get the error "Unexpected end of file ')'", which normally isn't a hard problem, usually a typo. The only catch this time was that it said the typo was in the "OnLeave" function which is empty!



////////////////////////////
// Run first time starting map
void OnStart()
{
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");

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


SetEntityConnectionStateChangeCallback("elevator_lever_1", "func_drop");
SetEntityActive("servant_brute_1", false);
SetLocalVarInt("Door_Final", 0);

AddEntityCollideCallback("safety_normal_vert_1", "Door_Collide, "Stop_Moving", true, 1);

}


void Used_Lever_On_Door(string &in asTimer)
{
if(GetLocalVarInt("Door_Final") == 1)
{
//Do Nothing
}
else
{
AddPropForce("safety_normal_vert_1", 0.0, 1000, 0, "world");
}
}


void Stop_Moving(string &in asParent, string &in asChild, int alState)
{
//========Stop Moving the Door============

SetLocalVarInt("Door_Final", 1);

}



void func_drop(string &in asEntity, int alState)
{
if (alState == 1)
{
AddTimer("", 0.01, "Used_Lever_On_Door");
PlaySoundAtEntity("", "quest_completed.snt", "elevator_lever_1", 0, false);
return;
}
}


//===========================================
// This runs when the player enters the map
void OnEnter()
{
}

//===========================================
// This runs when the player leaves the map
void OnLeave()
{
}


Could any of my other code have affected this? That would certainly be a very weird error Huh


//Kind Regards,
Twitchez


RE: Unexpected end of file?? - Datguy5 - 04-18-2012

I dont know about if functions much,but there seems to be another ")" after the first if function.


RE: Unexpected end of file?? - Cranky Old Man - 04-18-2012

Code:
AddEntityCollideCallback("safety_normal_vert_1", "Door_Collide, "Stop_Moving", true, 1);



RE: Unexpected end of file?? - Twitchez - 04-18-2012

Thank you Cranky Old Man Smile Found it.

Datguy5, in the "if(ScriptDebugOn())" you have to type "ScriptDebugOn()" because you are litteraly calling a function.


//All the best