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
An "Unexpected end of file" error?
MissMarilynn Offline
Member

Posts: 77
Threads: 23
Joined: Oct 2011
Reputation: 1
#1
An "Unexpected end of file" error?

I keep getting an unexpected end of file error with my scripting and it says the problem is with the last line (which is just })

Any suggestions?


PHP Code: (Select All)
void OnStart() {     AddEntityCollideCallback("Player""monsterspawn""MonsterFunction"true1);    AddEntityCollideCallback("Player""clockbong""ClockScare"true1);        SetEntityPlayerInteractCallback("Girls_Dorm_First_Floor""IsItLocked3"true);    SetEntityPlayerInteractCallback("Boys_Dorm_First_Floor""IsItLocked4"true);    SetEntityPlayerInteractCallback("ra_office""IsItLocked5"true);    AddUseItemCallback("open_Girls_Dorm_First_Floor_door""girl_key""Girls_Dorm_First_Floor""openlevel"false);    }
void openlevel(string &in asItemstring &in asEntity){    SetSwingDoorLocked("Girls_Dorm_First_Floor"falsetrue);    PlaySoundAtEntity("""unlock_door""door1"0false);    RemoveItem("girl_key");    PlayMusic("02_puzzle.ogg"false0.7f010false);    GiveSanityBoostSmall();}
void MonsterFunction(string &in asParentstring &in asChildint alState){    SetEntityActive("servant_grunt_1"true);     AddEnemyPatrolNode("servant_grunt_1""PathNodeArea_1"4"");    AddEnemyPatrolNode("servant_grunt_1""PathNodeArea_2"1"");    AddEnemyPatrolNode("servant_grunt_1""PathNodeArea_3"1"");    AddEnemyPatrolNode("servant_grunt_1""PathNodeArea_4"4"");}
void ClockScare(string &in asParentstring &in asChildint alState){    PlaySoundAtEntity("brute""notice_long.snt""PosNodeArea_1"1.0ffalse);    PlaySoundAtEntity("""react_scare""Player"0false);    GiveSanityDamage(5.0ftrue);}
////LOCKED DOORS
///This is the RA's officevoid IsItLocked3(string &in entity){     if (GetSwingDoorLocked(entity)     && entity == "ra_door")     {          SetMessage("Doors", "LockedDoor5", 0);          AddQuest("open_ra_quest", "open_door");     }} 
///This is the girls dormvoid IsItLocked4(string &in entity){     if (GetSwingDoorLocked(entity)     && entity == "Girls_Dorm_First_Floor")     {          SetMessage("Doors", "LockedDoor3", 0);          AddQuest("open_girls_quest", "open_door");     }} 
///This is the boys dorm
void IsItLocked5(string &in entity){     if (GetSwingDoorLocked(entity)     && entity == ""Boys_Dorm_First_Floor")     {          SetMessage("Doors", "LockedDoor4", 0);          AddQuest("find_crowbar_quest", "open_door");     }} 
void OnEnter(){PlayMusic("
01_amb_darkness.ogg", true,1.0f, 2.0f, 0, true);}
void OnLeave(){    SetupLoadScreen("
LoadingText", "Loading_GirlsDorm", 1, "Rose.jpg");} 
(This post was last modified: 10-21-2011, 08:45 PM by MissMarilynn.)
10-21-2011, 08:42 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: An "Unexpected end of file" error?

You have an extra quotation mark for Boys_Dorm_First_Floor in the if statement.

BTW, when using php or code bbcode, it is best if you copy the code directly from your text editor when placing your code in between code or php bbcode.

Tutorials: From Noob to Pro
10-21-2011, 08:54 PM
Website Find
MissMarilynn Offline
Member

Posts: 77
Threads: 23
Joined: Oct 2011
Reputation: 1
#3
RE: An "Unexpected end of file" error?

(10-21-2011, 08:54 PM)Your Computer Wrote: You have an extra quotation mark for Boys_Dorm_First_Floor in the if statement.

BTW, when using php or code bbcode, it is best if you copy the code directly from your text editor when placing your code in between code or php bbcode.
Thank you! I was going over it so many times and I couldn't figure it out.

I tried but it didn't work...:/
10-21-2011, 08:55 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: An "Unexpected end of file" error?

(10-21-2011, 08:55 PM)MissMarilynn Wrote: I tried but it didn't work...:/

I always avoid the WYSIWYG editor of the forums. The source editor will never give you problems (if you understand bbcodes).

Tutorials: From Noob to Pro
10-21-2011, 08:59 PM
Website Find
MissMarilynn Offline
Member

Posts: 77
Threads: 23
Joined: Oct 2011
Reputation: 1
#5
RE: An "Unexpected end of file" error?

(10-21-2011, 08:59 PM)Your Computer Wrote:
(10-21-2011, 08:55 PM)MissMarilynn Wrote: I tried but it didn't work...:/

I always avoid the WYSIWYG editor of the forums. The source editor will never give you problems (if you understand bbcodes).
I understand bbcodes a little. I'm relatively new to forums. It's been a huge help though with my scripting!

I can't get my key code to work for some reason too...It's a level door I'm trying to unlock. My code right now is:


AddUseItemCallback("open_Girls_Dorm_First_Floor_door", "girl_key", "Girls_Dorm_First_Floor", "openlevel", false);


void openlevel(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Girls_Dorm_First_Floor", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("girl_key");
PlayMusic("02_puzzle.ogg", false, 0.7f, 0, 10, false);
GiveSanityBoostSmall();
}

It removes my key and give me the sanity boost and plays the music but it won't unlock.
10-21-2011, 09:08 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#6
RE: An "Unexpected end of file" error?

Level doors are unlocked with SetLevelDoorLocked, not SetSwingDoorLocked.

Tutorials: From Noob to Pro
10-21-2011, 09:31 PM
Website Find
MissMarilynn Offline
Member

Posts: 77
Threads: 23
Joined: Oct 2011
Reputation: 1
#7
RE: An "Unexpected end of file" error?

(10-21-2011, 09:31 PM)Your Computer Wrote: Level doors are unlocked with SetLevelDoorLocked, not SetSwingDoorLocked.
It gave me an error when I switched it out?

It said no matching signatures.

AddUseItemCallback("", "girl_key", "Girls_Dorm_First_Floor", "openlevel", false);


void openlevel(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("Girls_Dorm_First_Floor", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("girl_key");
PlayMusic("02_puzzle.ogg", false, 0.7f, 0, 10, false);
GiveSanityBoostSmall();
}
(This post was last modified: 10-21-2011, 09:35 PM by MissMarilynn.)
10-21-2011, 09:32 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#8
RE: An "Unexpected end of file" error?

That's because level doors don't have any applicable effects, and so there is no third parameter.

Always refer to this page when dealing with HPL2 script functions: http://wiki.frictionalgames.com/hpl2/amn..._functions

Tutorials: From Noob to Pro
10-21-2011, 09:37 PM
Website Find
MissMarilynn Offline
Member

Posts: 77
Threads: 23
Joined: Oct 2011
Reputation: 1
#9
RE: An "Unexpected end of file" error?

(10-21-2011, 09:37 PM)Your Computer Wrote: That's because level doors don't have any applicable effects, and so there is no third parameter.

Always refer to this page when dealing with HPL2 script functions: http://wiki.frictionalgames.com/hpl2/amn..._functions
Third parameter? So I would have to change my script to:

AddUseItemCallback("", "girl_key", "Girls_Dorm_First_Floor", "openlevel");


void openlevel(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("Girls_Dorm_First_Floor", false);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("girl_key");
PlayMusic("02_puzzle.ogg", false, 0.7f, 0, 10, false);
GiveSanityBoostSmall();
}

10-21-2011, 09:50 PM
Find




Users browsing this thread: 1 Guest(s)