Shives
Member
Posts: 154
Threads: 41
Joined: Jan 2012
Reputation:
1
|
Unexpected end of file
Hi
I made a test for my script. The result
FATAL ERROR
main(80,1) :Unexpected end of file
I watched the script but I can't find the mistake.
My script
void OnStart()
{
if (GetEntityPlayerLookAtCallback("grunt_1", string& asCallback,false);
{
AddTimer("", 5, "Brucke");
}
void Brucke(string &in asTimer)
{
if (GetEntityPlayerLookAtCallback("grunt_1", string& asCallback,false);
{
ClearEnemyPatrolNodes("grunt_1");
}
AddUseItemCallback("", "Key_1", "mansion_1", "Schlussel", true);
SetEntityCallbackFunc("Key_1", "Grunt");
AddEntityCollideCallback("grunt_1", "ScriptArea_1", "Away", false, 1);
}
void Schlussel(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("Key_1");
}
void Grunt(string &in asEntity, string &in type)
{
SetEntityActive("Grunt_1", true);
AddEnemyPatrolNode("grunt_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_12", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_13", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_14", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_15", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_16", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_17", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_18", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_19", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_20", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_21", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_22", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_23", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_24", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_25", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_26", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_27", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_28", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_29", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_30", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_31", 0, "");
}
void Away(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Grunt_1", false);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
PlayMusic("06_amb.ogg", true, 0.7, 3, 0, true);
FadeOut(0);
FadeIn(8);
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
|
|
03-08-2012, 02:12 PM |
|
flamez3
Posting Freak
Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation:
57
|
RE: Unexpected end of file
void OnStart()
{
if (GetEntityPlayerLookAtCallback("grunt_1", string& asCallback,false);
{
AddTimer("", 5, "Brucke");
}
}
void Brucke(string &in asTimer)
{
if (GetEntityPlayerLookAtCallback("grunt_1", string& asCallback,false);
{
ClearEnemyPatrolNodes("grunt_1");
}
AddUseItemCallback("", "Key_1", "mansion_1", "Schlussel", true);
SetEntityCallbackFunc("Key_1", "Grunt");
AddEntityCollideCallback("grunt_1", "ScriptArea_1", "Away", false, 1);
}
void Schlussel(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("Key_1");
}
void Grunt(string &in asEntity, string &in type)
{
SetEntityActive("Grunt_1", true);
AddEnemyPatrolNode("grunt_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_12", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_13", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_14", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_15", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_16", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_17", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_18", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_19", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_20", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_21", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_22", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_23", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_24", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_25", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_26", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_27", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_28", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_29", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_30", 0, "");
AddEnemyPatrolNode("grunt_1", "PathNodeArea_31", 0, "");
}
void Away(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Grunt_1", false);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
PlayMusic("06_amb.ogg", true, 0.7, 3, 0, true);
FadeOut(0);
FadeIn(8);
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
I fixed it up a little for ya. Make sure you check all the open brackets to check if you closed them.
|
|
03-08-2012, 03:05 PM |
|
Shives
Member
Posts: 154
Threads: 41
Joined: Jan 2012
Reputation:
1
|
RE: Unexpected end of file
expected " ( "
expected " ( "
I can't find it
|
|
03-08-2012, 03:21 PM |
|
flamez3
Posting Freak
Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation:
57
|
RE: Unexpected end of file
I haven't had tremendous experience with IF statements. I'll let someone else have a try. C:
|
|
03-08-2012, 03:26 PM |
|
Shives
Member
Posts: 154
Threads: 41
Joined: Jan 2012
Reputation:
1
|
RE: Unexpected end of file
ThankYou anyway
By the way:
I've forgotten to script an else XD
|
|
03-08-2012, 03:29 PM |
|
Damascus
Senior Member
Posts: 646
Threads: 118
Joined: Mar 2012
Reputation:
29
|
RE: Unexpected end of file
if (GetEntityPlayerLookAtCallback("grunt_1", string& asCallback,false);
You have an open parentheses here. Same thing for the identical line further down.
|
|
03-09-2012, 07:15 AM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Unexpected end of file
(03-09-2012, 07:15 AM)Damascus Wrote: if (GetEntityPlayerLookAtCallback("grunt_1", string& asCallback,false);
You have an open parentheses here. Same thing for the identical line further down.
Also, the syntax of an if statement doesn't contain semicolons.
|
|
03-09-2012, 08:31 AM |
|
Shives
Member
Posts: 154
Threads: 41
Joined: Jan 2012
Reputation:
1
|
RE: Unexpected end of file
(03-09-2012, 08:31 AM)Your Computer Wrote: (03-09-2012, 07:15 AM)Damascus Wrote: if (GetEntityPlayerLookAtCallback("grunt_1", string& asCallback,false);
You have an open parentheses here. Same thing for the identical line further down.
Also, the syntax of an if statement doesn't contain semicolons. So whats the right syntax?
I tried it again. Same result
|
|
03-09-2012, 04:05 PM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Unexpected end of file
(03-09-2012, 04:05 PM)Shives Wrote: So whats the right syntax?
I tried it again. Same result
if (/* expressions */){ // code }
BTW, you also tried to call a function that doesn't exist.
|
|
03-09-2012, 09:16 PM |
|
Shives
Member
Posts: 154
Threads: 41
Joined: Jan 2012
Reputation:
1
|
RE: Unexpected end of file
It's the first time I use "if"
I don't know much about it.
So where are my mistakes.
I can't find them
(This post was last modified: 03-09-2012, 09:21 PM by Shives.)
|
|
03-09-2012, 09:21 PM |
|
|