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?!? plz help..
Jumpman Offline
Junior Member

Posts: 31
Threads: 10
Joined: May 2011
Reputation: 0
#1
Unexpected end of file?!? plz help..

Plz help me and se if you can find the problem.. becouse right now Im lost... The error when I try to start the map say...

---------------------------------------
main (81,2) ERR : Unexpected end of file
---------------------------------------

The (81,2) show the last '}' (example: void OnLeave()
{
----> } <----)
And I dont know whats the problem then...
Here is the full script...

void OnStart()
{
AddEntityCollideCallback("Player", "GruntTrigger", "CollideGruntTrigger", true, 0);
}



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

SetEntityPlayerInteractCallback("Reddoor", "InteractReddoor", true);

AddUseItemCallback("","StorageKey_1", "StorageDoor", "UsedStorageKey_1", true);

AddUseItemCallback("","UpperDoorKey_1", "UpperDoor", "UsedUpperDoorKey_1", true);

AddUseItemCallback("","ChestCrowbar_1", "DoorChest", "UsedChestCrowbar_1", true);

AddUseItemCallback("","EasterEggKey_1", "EasterEggDoor", "UsedEasterEggKey_1", true);

AddUseItemCallback("","ReddoorKey_1", "Reddoor", "UsedReddoorKey_1", true);
}

void CollideGruntTrigger(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servantgrunt", true);
GiveSanityDamage(20, true);
}


void UsedStorageKey_1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("StorageDoor", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "StorageDoor", 0.0f, true);
RemoveItem("StorageKey_1");
}

void UsedUpperDoorKey_1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("UpperDoor", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "UpperDoor", 0.0f, true);
RemoveItem("UpperDoorKey_1");
}

void UsedChestCrowbar_1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("DoorChest", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "DoorChest", 0.0f, true);
RemoveItem("ChestCrowbar_1");
}

void UsedEasterEggKey_1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("EasterEggDoor", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "EasterEggDoor", 0.0f, true);
RemoveItem("EasterEggKey_1");
}

void UsedReddoorKey_1(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("Reddoor", false");
PlaySoundAtEntity("", "unlock_door.snt", "Reddoor", 0.0f, true);
RemoveItem("ReddoorKey_1");
}

void InteractReddoor(string &in asEntity)
{
if("SetLevelDoorLocked ("Reddoor") == true");
SetMessage("mapone", "ReddoorMessage", 5.0f);
}

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

}
05-11-2011, 04:49 PM
Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#2
RE: Unexpected end of file?!? plz help..

(05-11-2011, 04:49 PM)Jumpman Wrote: Plz help me and se if you can find the problem.. becouse right now Im lost... The error when I try to start the map say...

---------------------------------------
main (81,2) ERR : Unexpected end of file
---------------------------------------

The (81,2) show the last '}' (example: void OnLeave()
{
----> } <----)
And I dont know whats the problem then...
Here is the full script...

void OnStart()
{
AddEntityCollideCallback("Player", "GruntTrigger", "CollideGruntTrigger", true, 0);
}



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

SetEntityPlayerInteractCallback("Reddoor", "InteractReddoor", true);

AddUseItemCallback("","StorageKey_1", "StorageDoor", "UsedStorageKey_1", true);

AddUseItemCallback("","UpperDoorKey_1", "UpperDoor", "UsedUpperDoorKey_1", true);

AddUseItemCallback("","ChestCrowbar_1", "DoorChest", "UsedChestCrowbar_1", true);

AddUseItemCallback("","EasterEggKey_1", "EasterEggDoor", "UsedEasterEggKey_1", true);

AddUseItemCallback("","ReddoorKey_1", "Reddoor", "UsedReddoorKey_1", true);
}

void CollideGruntTrigger(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servantgrunt", true);
GiveSanityDamage(20, true);
}


void UsedStorageKey_1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("StorageDoor", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "StorageDoor", 0.0f, true);
RemoveItem("StorageKey_1");
}

void UsedUpperDoorKey_1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("UpperDoor", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "UpperDoor", 0.0f, true);
RemoveItem("UpperDoorKey_1");
}

void UsedChestCrowbar_1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("DoorChest", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "DoorChest", 0.0f, true);
RemoveItem("ChestCrowbar_1");
}

void UsedEasterEggKey_1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("EasterEggDoor", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "EasterEggDoor", 0.0f, true);
RemoveItem("EasterEggKey_1");
}

void UsedReddoorKey_1(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("Reddoor", false);
PlaySoundAtEntity("", "unlock_door.snt", "Reddoor", 0.0f, true);
RemoveItem("ReddoorKey_1");
}

void InteractReddoor(string &in asEntity)
{
if("SetLevelDoorLocked ("Reddoor") == true);
SetMessage("mapone", "ReddoorMessage", 5.0f);
}

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

}

Try the script in quotes. You left quotation marks after a true and a false.
05-11-2011, 05:01 PM
Find
Jumpman Offline
Junior Member

Posts: 31
Threads: 10
Joined: May 2011
Reputation: 0
#3
RE: Unexpected end of file?!? plz help..

Changed it, But still same error
But if I remove the SetLvevelDoorLocked part it works.. so I guess the problem is there but I just cant see it.
dont worry.. I found the problem! Smile But Thx for the help Smile
(This post was last modified: 05-11-2011, 05:44 PM by Jumpman.)
05-11-2011, 05:14 PM
Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#4
RE: Unexpected end of file?!? plz help..

Yea, there's a quote before SetLevelDoorLocked as well, I just noticed.
05-11-2011, 06:29 PM
Find
GTalbot Offline
Junior Member

Posts: 3
Threads: 1
Joined: Jul 2011
Reputation: 0
#5
RE: Unexpected end of file?!? plz help..

i was having the same problem do you see an error in this.

void OnStart()

{
AddUseItemCallback("", "key", "door", "KeyOnDoor", true);
SetEntityPlayerInteractCallback("note", "MonsterSpawn_1", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door", false, true);
PlaySoundAtEntity("", "unlock_door", "door", 0, false);
RemoveItem("key");
}
void MonsterSpawn_1(string &in asEntity)
{
SetEntityActive("grunt", true);
AddEnemyPatrolNode(grunt", "PathNodeArea_1", 3.5f, "");
AddEnemyPatrolNode(grunt", "PathNodeArea_2", 3.5f, "");
AddEnemyPatrolNode(grunt", "PathNodeArea_3", 3.5f, "");
}
////////////////////////////
// Run when leaving map
void OnLeave()

{

}
07-17-2011, 10:24 PM
Find
Ouroboros Offline
Junior Member

Posts: 20
Threads: 0
Joined: Jul 2011
Reputation: 0
#6
RE: Unexpected end of file?!? plz help..

(07-17-2011, 10:24 PM)GTalbot Wrote: i was having the same problem do you see an error in this.

void OnStart()

{
AddUseItemCallback("", "key", "door", "KeyOnDoor", true);
SetEntityPlayerInteractCallback("note", "MonsterSpawn_1", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door", false, true);
PlaySoundAtEntity("", "unlock_door", "door", 0, false);
RemoveItem("key");
}
void MonsterSpawn_1(string &in asEntity)
{
SetEntityActive("grunt", true);
AddEnemyPatrolNode(grunt", "PathNodeArea_1", 3.5f, "");
AddEnemyPatrolNode(grunt", "PathNodeArea_2", 3.5f, "");
AddEnemyPatrolNode(grunt", "PathNodeArea_3", 3.5f, "");
}
////////////////////////////
// Run when leaving map
void OnLeave()

{

}

You forgot to put the first " when adding the enemy patrol nodes in MonsterSpawn_1.
07-18-2011, 04:17 AM
Find
eagledude4 Offline
Member

Posts: 144
Threads: 14
Joined: Dec 2011
Reputation: 0
#7
RE: Unexpected end of file?!? plz help..

Fixed.

Its hard to see the truth when you've been blinded by lies.
(This post was last modified: 01-01-2012, 02:18 AM by eagledude4.)
01-01-2012, 02:17 AM
Find
Loquendostrogg Offline
Junior Member

Posts: 4
Threads: 1
Joined: Apr 2012
Reputation: 0
#8
RE: Unexpected end of file?!? plz help..

I've got an error like that one with my file, don't know what's wrong.

Please hel this noob

Here's the file



//===========================================
// Starter's Script File!
//===========================================

//===========================================
// This runs when the map first starts


void TimerDoneLookAt(string &in asTimer)
{
StopPlayerLookAt();
}

////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "scareArea1", "func_slam", true, 1);

StartPlayerLookAt("LookArea1", 2, 2, "");


AddTimer("donelook", 2.5f, "TimerDoneLookAt");
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Mansiondoor1", true, true);

PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);

GiveSanityDamage(5.0f, true);

AddEntityCollideCallback("Player","areascripta", "function1", true,1);

AddEntityCollideCallback("Player","sremarea","function2", true,1);
}


////////// Callback Functions!!!

void function1(string &in asParent, string &in asChild, int alState)
{
if (alState == 1)
{
GiveSanityDamage(100.0f, true);
}
if (alState == -1)
{

}

///Function 2

void function2 (string &in asParent, string &in asChild, int alState)

{
if (alState == 1)
{
PreloadSound("15_the_big_scream1.snt");
}
if (alState == -1)
{

}
}
////////////////////////////
// Run when map is loaded
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{
SetupLoadScreen("Loading", "", 1,"Loading_Level_Picture.jpg");
}
05-18-2012, 12:29 AM
Find
Putmalk Offline
Senior Member

Posts: 290
Threads: 13
Joined: Apr 2012
Reputation: 15
#9
RE: Unexpected end of file?!? plz help..

You're getting another unexpected end of file error?

I'm not going to go through the code line by line and fix it, you have to do it yourself. But unexpected end of file errors happen because you forgot to close something, or end the line correctly.

Be sure whenever you make a bracket, quotation, or paratheses, you close it.

For example, you write something with (, there also has to be a ) at the end, so it looks like ().

Of course, you can put stuff inside of it, as appropriate, so you might have something like:
("", "", "", ""). whatever.

It can get as complicated as it can, but it will always be the same.

something()
{
  anotherthing("", "", "", "");
  for(loop conditions here, not writing that out)
  {
    if((random condition)||(another condition)) //that "||" means OR
    {
    }
  }

}

etc.

Basically:

Make sure you close everything. If you type (( there better be a )) at the end of it somewhere
End every line (minus specific ones like loop declarations, { and }, and function declarations (i.e. void myFunc()) with a ";".

Go ahead and debug yourself, though. Don't expect us to fix everything for you, because an unexpected end of file problem isn't a complicated issue, it's a syntax error.

Good luck and hope this helped.

And I wouldn't recommend for anyone to fix it for him, or he won't learn a thing.


Anywho, I found the error. You're missing a "}", but I'll let you find it.

(This post was last modified: 05-18-2012, 12:44 AM by Putmalk.)
05-18-2012, 12:42 AM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#10
RE: Unexpected end of file?!? plz help..

Hello everyone, i'm making a test map, just with one monster. By the moment i'm learning, but i need help, when i run "The chasing" appears a window saying:
FATAL ERROR: Could not load script file "custom_stories/The chasing/Maps/The chasing.hps"!
main (19, 14): ERR : Expected identifier

This is the script:

void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "ActivateMonster", true, 1);

}
void OnEnter ()

{

}

Void OnLeave ()
{

}

void ActivateMonster(string &in asParent, string &in asChild, int alState);

SetNPCActive("Main", true);

Before i used to put a "}" in the final, but it said "unexpected end of file". I tried to see the syntaxis error, but i couldn't find it. I would like a lot a bit of help, i've been stuck in here for a long time.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
06-27-2012, 06:36 PM
Find




Users browsing this thread: 2 Guest(s)