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
Script Error unexpected end of file! Please help
hiippari Offline
Junior Member

Posts: 31
Threads: 4
Joined: Mar 2012
Reputation: 1
#1
Script Error unexpected end of file! Please help

So i get this error when i try to go in my map : Error: ........Cant open The Prison 2.map Unexpected end of file 125,2

Here is my script. Please help, thanks


void OnStart()
{
SetLocalVarInt("Var1", 0);
AddEntityCollideCallback("Player", "explode_scare", "Explode", true, 1);
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
AddUseItemCallback("", "key_1", "door_3", "UsedKeyOnDoor", true);
AddUseItemCallback("", "needle_1", "door_4", "Needle", true);
AddUseItemCallback("bottleEcon", "glass_container_1", "acid_container_1", "UseBottle", true);
AddUseItemCallback("bottleFcon", "glass_container_filled", "acid_container_1", "UseBottle", false);
AddUseItemCallback("AcidOnDoor", "glass_container_filled", "AcidDoor", "UseAcidDoor", true);
}


void Explode(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("pot_explode", 0);
GiveSanityDamage(20.0f, true);
}


void func1(string &in asEntity)
{
AddLocalVarInt("Var1", 1);
func4();
}

void func2(string &in asEntity)
{
AddLocalVarInt("Var1", 1);
func4();
}

void func3(string &in asEntity)
{
AddLocalVarInt("Var1", 1);
func4();
}


void func4()
{
if(GetLocalVarInt("Var1") == 3)
{
/////add what ever you want to happen after you press all 3 buttons here.
SetSwingDoorLocked("door1", false, false);
PlaySoundAtEntity("", "unlock_door.snt", "door1", 0.5f, false);
}
}

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

SetSwingDoorLocked("door_1", false, true);

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

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

GiveSanityDamage(10.0f, true);
}

void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("brute_1", true);
ShowEnemyPlayerPosition("brute_1");
AddEnemyPatrolNode("brute_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("brute_1", "PathNodeArea_6", 0, "");
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_3", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "door_3", 0, false);
RemoveItem("key_3");
}

void Needle(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_4", false, true);
PlaySoundAtEntity("", "unlock_door", "door_4", 0, false);
RemoveItem("needle_1");
}


void UseBottle(string &in asItem, string &in asEntity)
{
if(asItem == "glass_container_1")
PlaySoundAtEntity("fillbottle", "puzzle_acid_success", asEntity, 1.0f, false);

RemoveItem(asItem);
GiveItemFromFile("glass_container_filled", "glass_container_filled.ent");

GiveSanityBoostSmall();
}

void UseAcidDoor (string &in asItem, string &in asEntity)
{
if(asItem == "glass_container_filled")
{
PlaySoundAtEntity("burnlock", "puzzle_acid", "AcidDoor", 1.0f, false);
CreateParticleSystemAtEntityExt("AcidSteam","ps_steam_puff","AcidDoor", false, 0.0f, 0.35f, 0.0f, 1.0f, false, 10, 10, 10, 10);
CreateParticleSystemAtEntity("AcidBubbles","ps_acid_container_bubbles","AcidDoor", false);
SetSwingDoorLocked("AcidDoor", false, false);
CompleteQuest("AcidLock", "AcidLock");
GiveSanityBoost();
RemoveItem("glass_container_filled");

}


void TimerPartKill(string &in asTimer)
{
DestroyParticleSystem("AcidBubbles");
DestroyParticleSystem("AcidSteam");
}

void OnLeave()
{

}
04-06-2012, 10:52 AM
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#2
RE: Script Error unexpected end of file! Please help

(04-06-2012, 10:52 AM)hiippari Wrote: void UseAcidDoor (string &in asItem, string &in asEntity)
{
---if(asItem == "glass_container_filled")
---{
------PlaySoundAtEntity("burnlock", "puzzle_acid", "AcidDoor", 1.0f, false);
------CreateParticleSystemAtEntityExt("AcidSteam","ps_steam_puff","AcidDoor", false, 0.0f, 0.35f, 0.0f, 1.0f, false, 10, 10, 10, 10);
------CreateParticleSystemAtEntity("AcidBubbles","ps_acid_container_bubbles","AcidDoor", false);
------SetSwingDoorLocked("AcidDoor", false, false);
------CompleteQuest("AcidLock", "AcidLock");
------GiveSanityBoost();
------RemoveItem("glass_container_filled");
------
---}
*** ---> } <--- ***


Noob scripting tutorial: From Noob to Pro

04-06-2012, 11:17 AM
Find
hiippari Offline
Junior Member

Posts: 31
Threads: 4
Joined: Mar 2012
Reputation: 1
#3
RE: Script Error unexpected end of file! Please help

(04-06-2012, 11:17 AM)Cranky Old Man Wrote: Still doesnt work same error Sad
(04-06-2012, 10:52 AM)hiippari Wrote: void UseAcidDoor (string &in asItem, string &in asEntity)
{
---if(asItem == "glass_container_filled")
---{
------PlaySoundAtEntity("burnlock", "puzzle_acid", "AcidDoor", 1.0f, false);
------CreateParticleSystemAtEntityExt("AcidSteam","ps_steam_puff","AcidDoor", false, 0.0f, 0.35f, 0.0f, 1.0f, false, 10, 10, 10, 10);
------CreateParticleSystemAtEntity("AcidBubbles","ps_acid_container_bubbles","AcidDoor", false);
------SetSwingDoorLocked("AcidDoor", false, false);
------CompleteQuest("AcidLock", "AcidLock");
------GiveSanityBoost();
------RemoveItem("glass_container_filled");
------
---}
*** ---> } <--- ***

04-06-2012, 11:54 AM
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#4
RE: Script Error unexpected end of file! Please help

(04-06-2012, 11:54 AM)hiippari Wrote: Still doesnt work same error Sad
I don't believe you. Did you forget to save the file? ...because "unexpected end of file" means that you forgot a bracket. If you type the correct number of brackets, you should at least get another error.

Hold on, there was something else in the code as well...

Edit:
These lines look odd:
if(asItem == "glass_container_1")
PlaySoundAtEntity("fillbottle", "puzzle_acid_success", asEntity, 1.0f, false);

...because I've only seen if statements as either
if(asItem == "glass_container_1") PlaySoundAtEntity("fillbottle", "puzzle_acid_success", asEntity, 1.0f, false);

...or:

if(asItem == "glass_container_1")
{
   PlaySoundAtEntity("fillbottle", "puzzle_acid_success", asEntity, 1.0f, false);
}


Noob scripting tutorial: From Noob to Pro

(This post was last modified: 04-06-2012, 12:30 PM by Cranky Old Man.)
04-06-2012, 12:25 PM
Find
hiippari Offline
Junior Member

Posts: 31
Threads: 4
Joined: Mar 2012
Reputation: 1
#5
RE: Script Error unexpected end of file! Please help

(04-06-2012, 12:25 PM)Cranky Old Man Wrote:
(04-06-2012, 11:54 AM)hiippari Wrote: Still doesnt work same error Sad
I don't believe you. Did you forget to save the file? ...because "unexpected end of file" means that you forgot a bracket. If you type the correct number of brackets, you should at least get another error.

Hold on, there was something else in the code as well...

Edit:
These lines look odd:
if(asItem == "glass_container_1")
PlaySoundAtEntity("fillbottle", "puzzle_acid_success", asEntity, 1.0f, false);

...because I've only seen if statements as either
if(asItem == "glass_container_1") PlaySoundAtEntity("fillbottle", "puzzle_acid_success", asEntity, 1.0f, false);

...or:

if(asItem == "glass_container_1")
{
   PlaySoundAtEntity("fillbottle", "puzzle_acid_success", asEntity, 1.0f, false);
}
I will try it Smile


04-06-2012, 12:58 PM
Find
Cranky Old Man Offline
Posting Freak

Posts: 986
Threads: 20
Joined: Apr 2012
Reputation: 38
#6
RE: Script Error unexpected end of file! Please help

Of course, judging by the context, what you REALLY want to write is this:

void UseBottle(string &in asItem, string &in asEntity)
{
if(asItem == "glass_container_1")
{
PlaySoundAtEntity("fillbottle", "puzzle_acid_success", asEntity, 1.0f, false);
RemoveItem(asItem);
GiveItemFromFile("glass_container_filled", "glass_container_filled.ent");
GiveSanityBoostSmall();
}
}

Noob scripting tutorial: From Noob to Pro

(This post was last modified: 04-06-2012, 01:02 PM by Cranky Old Man.)
04-06-2012, 01:01 PM
Find
hiippari Offline
Junior Member

Posts: 31
Threads: 4
Joined: Mar 2012
Reputation: 1
#7
RE: Script Error unexpected end of file! Please help

It works thank u so much Smile))
04-06-2012, 01:46 PM
Find




Users browsing this thread: 2 Guest(s)