Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unexpected end of file??
Twitchez Offline
Member

Posts: 67
Threads: 17
Joined: Mar 2012
Reputation: 1
#1
Unexpected end of file??

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
(This post was last modified: 04-18-2012, 06:03 PM by Twitchez.)
04-18-2012, 05:43 PM
Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#2
RE: Unexpected end of file??

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

04-18-2012, 05:51 PM
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#3
RE: Unexpected end of file??

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

Noob scripting tutorial: From Noob to Pro

04-18-2012, 05:52 PM
Find
Twitchez Offline
Member

Posts: 67
Threads: 17
Joined: Mar 2012
Reputation: 1
#4
RE: Unexpected end of file??

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
04-18-2012, 05:57 PM
Find




Users browsing this thread: 1 Guest(s)