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
Shives Offline
Member

Posts: 154
Threads: 41
Joined: Jan 2012
Reputation: 1
#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()
{

}

My Custom Story
http://www.frictionalgames.com/forum/thread-12587.html

Sorry for bad English


03-08-2012, 02:12 PM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#2
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
Find
Shives Offline
Member

Posts: 154
Threads: 41
Joined: Jan 2012
Reputation: 1
#3
RE: Unexpected end of file

expected " ( "
expected " ( "

I can't find it

My Custom Story
http://www.frictionalgames.com/forum/thread-12587.html

Sorry for bad English


03-08-2012, 03:21 PM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#4
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
Find
Shives Offline
Member

Posts: 154
Threads: 41
Joined: Jan 2012
Reputation: 1
#5
RE: Unexpected end of file

ThankYou anyway
By the way:
I've forgotten to script an else XD

My Custom Story
http://www.frictionalgames.com/forum/thread-12587.html

Sorry for bad English


03-08-2012, 03:29 PM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#6
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
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#7
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.

Tutorials: From Noob to Pro
03-09-2012, 08:31 AM
Website Find
Shives Offline
Member

Posts: 154
Threads: 41
Joined: Jan 2012
Reputation: 1
#8
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


My Custom Story
http://www.frictionalgames.com/forum/thread-12587.html

Sorry for bad English


03-09-2012, 04:05 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#9
RE: Unexpected end of file

(03-09-2012, 04:05 PM)Shives Wrote: So whats the right syntax?
I tried it again. Same result

PHP Code: (Select All)
if (/* expressions */){
    
// code



BTW, you also tried to call a function that doesn't exist.

Tutorials: From Noob to Pro
03-09-2012, 09:16 PM
Website Find
Shives Offline
Member

Posts: 154
Threads: 41
Joined: Jan 2012
Reputation: 1
#10
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 Undecided

My Custom Story
http://www.frictionalgames.com/forum/thread-12587.html

Sorry for bad English


(This post was last modified: 03-09-2012, 09:21 PM by Shives.)
03-09-2012, 09:21 PM
Find




Users browsing this thread: 1 Guest(s)