Wickedwrath
Junior Member
Posts: 13
Threads: 3
Joined: Oct 2011
Reputation:
0
|
ERROR: Unexpected end of file
Hello! I need some help here with this script. It says "Unexpected end of file" and I just can't figure out what's wrong. Can anyone help and solve this, please?
Quote: ////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "Key_1", "Door_1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "Key_2", "Door_2", "UsedKeyOnDoor_2", true);
AddUseItemCallback("", "Secretkey2", "metal_1", "UsedKeyOnDoor_3", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door_1", false, true);
PlaySoundEntity("", "unlock_door", "Door_1", 0, false);
RemoveItem("Key_1");
}
void UsedKeyOnDoor_2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door_2", false, true);
PlaySoundAtEntity("", "unlock_door", "Door_2", 0,false);
RemoveItem("Key_2");
void Message_1(string &in asEntity)
{
SetMessage("Message", "Message_1", 2);
}
void UsedKeyOnDoor_3(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("metal_1", false, true);
PlaySoundEntity("", "unlock_door", "metal_1", 0, false);
RemoveItem("Secretkey2");
}
/////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
(This post was last modified: 10-20-2011, 05:26 PM by Wickedwrath.)
|
|
10-19-2011, 03:08 PM |
|
jens
Frictional Games
Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation:
202
|
RE: ERROR: Unexpected end of file
//////////////////////////// // Run first time starting map void OnStart() { AddUseItemCallback("", "Key_1", "Door_1", "UsedKeyOnDoor", true); AddUseItemCallback("", "Key_2", "Door_2", "UsedKeyOnDoor_2", true); AddUseItemCallback("", "Secretkey2", "metal_1", "UsedKeyOnDoor_3", true); }
void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("Door_1", false, true); PlaySoundEntity("", "unlock_door", "Door_1", 0, false); RemoveItem("Key_1"); }
void UsedKeyOnDoor_2(string &in asItem, string &in asEntity) { SetSwingDoorLocked("Door_2", false, true); PlaySoundAtEntity("", "unlock_door", "Door_2", 0,false); RemoveItem("Key_2"); } // <- THERE WAS A } MISSING.
void Message_1(string &in asEntity) { SetMessage("Message", "Message_1", 2); }
void UsedKeyOnDoor_3(string &in asItem, string &in asEntity) { SetSwingDoorLocked("metal_1", false, true); PlaySoundEntity("", "unlock_door", "metal_1", 0, false); RemoveItem("Secretkey2"); }
///////////////////////////// // Run when entering map void OnEnter() {
}
//////////////////////////// // Run when leaving map void OnLeave() {
}
There was a } missing, I added a comment in the code at the location.
(This post was last modified: 10-19-2011, 03:12 PM by jens.)
|
|
10-19-2011, 03:10 PM |
|
Wickedwrath
Junior Member
Posts: 13
Threads: 3
Joined: Oct 2011
Reputation:
0
|
RE: ERROR: Unexpected end of file
(10-19-2011, 03:10 PM)jens Wrote: //////////////////////////// // Run first time starting map void OnStart() { AddUseItemCallback("", "Key_1", "Door_1", "UsedKeyOnDoor", true); AddUseItemCallback("", "Key_2", "Door_2", "UsedKeyOnDoor_2", true); AddUseItemCallback("", "Secretkey2", "metal_1", "UsedKeyOnDoor_3", true); }
void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("Door_1", false, true); PlaySoundEntity("", "unlock_door", "Door_1", 0, false); RemoveItem("Key_1"); }
void UsedKeyOnDoor_2(string &in asItem, string &in asEntity) { SetSwingDoorLocked("Door_2", false, true); PlaySoundAtEntity("", "unlock_door", "Door_2", 0,false); RemoveItem("Key_2"); } // <- THERE WAS A } MISSING.
void Message_1(string &in asEntity) { SetMessage("Message", "Message_1", 2); }
void UsedKeyOnDoor_3(string &in asItem, string &in asEntity) { SetSwingDoorLocked("metal_1", false, true); PlaySoundEntity("", "unlock_door", "metal_1", 0, false); RemoveItem("Secretkey2"); }
///////////////////////////// // Run when entering map void OnEnter() {
}
//////////////////////////// // Run when leaving map void OnLeave() {
}
There was a } missing, I added a comment in the code at the location. Hm.. Strange. It's still not working. (I also deleted your "// <- THERE WAS A } MISSING."-text) and still not working.
|
|
10-19-2011, 03:18 PM |
|
jens
Frictional Games
Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation:
202
|
RE: ERROR: Unexpected end of file
Can't see anything that would cause an unexpected end of file. usually it is a {} )( ;, " that is missing or incorrect positioned.
|
|
10-19-2011, 03:32 PM |
|
Wickedwrath
Junior Member
Posts: 13
Threads: 3
Joined: Oct 2011
Reputation:
0
|
RE: ERROR: Unexpected end of file
(10-19-2011, 03:32 PM)jens Wrote: Can't see anything that would cause an unexpected end of file. usually it is a {} )( ;, " that is missing or incorrect positioned. Hm.. I solve it by removing:
PlaySoundEntity("", "unlock_door", "metal_1", 0, false);
|
|
10-19-2011, 03:33 PM |
|
jens
Frictional Games
Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation:
202
|
RE: ERROR: Unexpected end of file
Ah, that should be PlaySoundAtEntity not PlaySoundEntity!
|
|
10-19-2011, 03:36 PM |
|
Wickedwrath
Junior Member
Posts: 13
Threads: 3
Joined: Oct 2011
Reputation:
0
|
RE: ERROR: Unexpected end of file
(10-19-2011, 03:36 PM)jens Wrote: Ah, that should be PlaySoundAtEntity not PlaySoundEntity! I tryed to change it, but then I got the error again (unexpected end of file).
The strange thing is, that when I remove the whole "PlaySoundAtEntity("", "unlock_door", "metal_1", 0, false);", it still gives me a "key sound". Is it supose to do that?
(10-19-2011, 03:36 PM)jens Wrote: Ah, that should be PlaySoundAtEntity not PlaySoundEntity! Ah, I got it to work now, with your "PlaySoundAtEntity"-script! I don't know what went wrong..
Thank you!
(This post was last modified: 10-19-2011, 03:52 PM by Wickedwrath.)
|
|
10-19-2011, 03:40 PM |
|
death5657
Junior Member
Posts: 1
Threads: 0
Joined: Mar 2013
Reputation:
0
|
RE: ERROR: Unexpected end of file
Hi im stuck to and really don't know what to do can you help me??? all it says main (25,15) : ERR : Expected "{"
hear is my hps file:
////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "K_1", "door_1", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "door_1", 0, false);
RemoveItem("K_1");
}
/////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
|
|
03-17-2013, 02:38 PM |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
RE: ERROR: Unexpected end of file
You are missing the { and } at void OnLeave().
"Veni, vidi, vici."
"I came, I saw, I conquered."
|
|
03-17-2013, 03:27 PM |
|
|