Frictional Games Forum (read-only)

Full Version: Unexpected end of file?!? plz help..
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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)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.
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
Yea, there's a quote before SetLevelDoorLocked as well, I just noticed.
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)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.
Fixed.
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");
}
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.

Code:
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.
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.
Pages: 1 2