HappyMatt12345
Junior Member
Posts: 16
Threads: 6
Joined: Oct 2018
Reputation:
0
|
[SOLVED] Err: Unexpected end of file at (244, 2)
ok, I'm basically trying to make a puzzle where the player is supposed to put rocks on pressure plates as part of a combination to unlock a gate, except, I cant seem to get the mechanic with the rocks and pressure plates working. Since I added this one function (UnsetCurrentRock) I have been getting an error that says "Unexpected end of file" at the very end of the file. I would like some help as I have no clue what could be wrong with the code,
My entire code file:
// runs when a map is loaded for the first time
void OnStart(){
if(ScriptDebugOn()){
GiveItem("Lantern", "Lantern", "Lantern", "Lantern.tga", 1);
SetPlayerLampOil(100);
for(int i = 0; i <= 50; i++){
GiveItemFromFile("Tinderbox", "tinderbox.ent");
}
}
SetMapDisplayNameEntry("01ComplexOutsideSave");
// declare all local variables via SetLocalVar
SetLocalVarInt("LightsProgress", 0);
SetLocalVarInt("ComboMessageObtained", 0);
SetLocalVarInt("AreasFilled", 0); // used in PlaceRock func, determines how many rocks have been placed
SetLocalVarInt("Rock1Fills", 0); // used in PlaceRock func, determines which area CodeRock1 resides in
SetLocalVarInt("Rock2Fills", 0); // used in PlaceRock func, determines which area CodeRock2 resides in
SetLocalVarInt("Rock3Fills", 0); // used in PlaceRock func, determines which area CodeRock3 resides in
SetLocalVarInt("Rock4Fills", 0); // used in PlaceRock func, determines which area CodeRock4 resides in
SetLocalVarInt("Area1Filled", 0);
SetLocalVarInt("Area2Filled", 0);
SetLocalVarInt("Area3Filled", 0);
SetLocalVarInt("Area4Filled", 0);
SetLocalVarInt("CurrentRock", 0);
// x
// innit EventFunctions
AddEntityCollideCallback("Player", "EroTease1TriggerArea", "EroTease1", true, 1);
AddEntityCollideCallback("Player", "EroVoiceStop", "StopEroVoice", true, 1);
AddEntityCollideCallback("Player", "PressurePlatesMemTriggerArea", "PressurePlatesMem", true, 1);
for(int i = 1; i <= 4; i++){
AddEntityCollideCallback("CodeRock"+i, "ComboMessageArea", "ComboMessage", true, 1);
}
for(int a = 1; a <= 4; a++){
for(int b = 1; b <= 9; b++){
AddEntityCollideCallback("CodeRock"+a, "CodeRockPlaceArea_"+b, "PlaceRock", false, 1);
}
}
SetEntityPlayerInteractCallback("UnlockGate", "UnlockGateMem", true);
// x
}
int OwlSoundAreaNum = 24;
// runs when the player enters the map
void OnEnter(){
PlayMusic("Penumbra_BP_A1.ogg", true, 0.4, 1, 1, false);
AutoSave();
// innit RandomAmbientFunctions
AddTimer("OwlSoundsTimer", RandFloat(10, 20), "OwlSounds");
// x
}
///////////////////////////
//RandomAmbientFunctions://
///////////////////////////
void OwlSounds(string &in asTimer){
int OwlSoundPlaybaclLoc = RandInt(1, OwlSoundAreaNum);
PlaySoundAtEntity("OwlSounds", "OOTSOwlChirp.snt", "OwlSoundsPlaybackArea_"+OwlSoundPlaybaclLoc, 0.1, false);
AddTimer("OwlSoundsRecall", RandFloat(10, 20), "OwlSounds"); // call this function again in 10 - 20 seconds
}
///////////////////////////
//RandomAmbientFunctions://
///////////////////////////
///////////////////
//EventFunctions://
///////////////////
void EroTease1(string &in asParent, string &in asChild, int alState){
PlaySoundAtEntity("EroTease101", "OOTSCh103EroTease01", "EroTease1PlaybackArea", 0.1, false);
AddTimer("TimerEroTeaseContinue", RandFloat(10, 15), "EroTease1Continue");
SetLocalVarInt("EroTease1Num", 2);
}
void EroTease1Continue(string &in asTimer){
if(GetLocalVarInt("EroTease1Num") <= 5){
PlaySoundAtEntity("EroTease10"+GetLocalVarInt("EroTease1Num"), "OOTSCh103EroTease0"+GetLocalVarInt("EroTease1Num"), "EroTease1PlaybackArea", 0.1, false);
AddLocalVarInt("EroTease1Num", 1);
AddTimer("TimerEroTeaseContinue", RandFloat(10, 15), "EroTease1Continue"); // Call this function again in 20 - 30 seconds
}
}
void StopEroVoice(string &in asParent, string &in asChild, int alState){
RemoveTimer("TimerEroTeaseContinue");
}
void UnlockGateMem(string &in asEntity){
AddQuest("UnlockGate", "0103UnlockGate");
AutoSave();
}
void PressurePlatesMem(string &in asParent, string &in asChild, int alState){
AddQuest("PressurePlates", "0103PressurePlates");
}
void ComboMessage(string &in asParent, string &in asChild, int alState){
if(GetLocalVarInt("ComboMessageObtained") == 0){
SetMessage("MiscMessages", "0103Combo01", 0);
AddDebugMessage("Message '0103Combo01' desplayed", false);
AddLocalVarInt("ComboMessageObtained", 1);
}
}
void PlaceRock(string &in asParent, string &in asChild, int alState){
if(alState == 1){
PlaceEntityAtEntity(asParent, asChild, "", true);
SetEntityActive(asParent, false);
if(asParent == "CodeRock1"){
for(int i = 1; i <= 9; i++){
if(asChild == "CodeRockPlaceArea_"+i){
SetEntityActive("CodeRockPlaced"+i, true);
SetLocalVarInt("Rock1Fills", i);
}
}
RemoveEntityCollideCallback("CodeRock2", "CodeRockPlaceArea_"+GetLocalVarInt("Rock1Fills"));
RemoveEntityCollideCallback("CodeRock3", "CodeRockPlaceArea_"+GetLocalVarInt("Rock1Fills"));
RemoveEntityCollideCallback("CodeRock4", "CodeRockPlaceArea_"+GetLocalVarInt("Rock1Fills"));
if(GetLocalVarInt("Area1Filled") == 1){
for(int i = 1; i <= 9; i++){
RemoveEntityCollideCallback("CodeRock1", "CodeRockPlaceArea_"+i);
}
}
SetEntityPlayerInteractCallback("CodeRockPlaced"+GetLocalVarInt("Rock1Fills"), "UnsetRock", true);
}
else if(asParent == "CodeRock2"){
for(int i = 1; i <= 9; i++){
if(asChild == "CodeRockPlaceArea_"+i){
SetEntityActive("CodeRockPlaced"+i, true);
SetLocalVarInt("Rock1Fills", i);
}
}
RemoveEntityCollideCallback("CodeRock1", "CodeRockPlaceArea_"+GetLocalVarInt("Rock2Fills"));
RemoveEntityCollideCallback("CodeRock3", "CodeRockPlaceArea_"+GetLocalVarInt("Rock2Fills"));
RemoveEntityCollideCallback("CodeRock4", "CodeRockPlaceArea_"+GetLocalVarInt("Rock2Fills"));
if(GetLocalVarInt("Area2Filled") == 1){
for(int i = 1; i <= 9; i++){
RemoveEntityCollideCallback("CodeRock2", "CodeRockPlaceArea_"+i);
}
}
SetEntityPlayerInteractCallback("CodeRockPlaced"+GetLocalVarInt("Rock2Fills"), "UnsetRock", true);
}
else if(asParent == "CodeRock3"){
for(int i = 1; i <= 9; i++){
if(asChild == "CodeRockPlaceArea_"+i){
SetEntityActive("CodeRockPlaced"+i, true);
SetLocalVarInt("Rock1Fills", i);
}
}
RemoveEntityCollideCallback("CodeRock1", "CodeRockPlaceArea_"+GetLocalVarInt("Rock3Fills"));
RemoveEntityCollideCallback("CodeRock2", "CodeRockPlaceArea_"+GetLocalVarInt("Rock3Fills"));
RemoveEntityCollideCallback("CodeRock4", "CodeRockPlaceArea_"+GetLocalVarInt("Rock3Fills"));
if(GetLocalVarInt("Area3Filled") == 1){
for(int i = 1; i <= 9; i++){
RemoveEntityCollideCallback("CodeRock3", "CodeRockPlaceArea_"+i);
}
}
SetEntityPlayerInteractCallback("CodeRockPlaced"+GetLocalVarInt("Rock3Fills"), "UnsetRock", true);
}
else{
for(int i = 1; i <= 9; i++){
if(asChild == "CodeRockPlaceArea_"+i){
SetEntityActive("CodeRockPlaced"+i, true);
SetLocalVarInt("Rock1Fills", i);
}
}
RemoveEntityCollideCallback("CodeRock1", "CodeRockPlaceArea_"+GetLocalVarInt("Rock4Fills"));
RemoveEntityCollideCallback("CodeRock2", "CodeRockPlaceArea_"+GetLocalVarInt("Rock4Fills"));
RemoveEntityCollideCallback("CodeRock3", "CodeRockPlaceArea_"+GetLocalVarInt("Rock4Fills"));
if(GetLocalVarInt("Area4Filled") == 1){
for(int i = 1; i <= 9; i++){
RemoveEntityCollideCallback("CodeRock4", "CodeRockPlaceArea_"+i);
}
}
SetEntityPlayerInteractCallback("CodeRockPlaced"+GetLocalVarInt("Rock4Fills"), "UnsetCurrentRock", true);
}
}
}
void UnsetCurrentRock(string &in asEntity){
SetEntityActive(asEntity, false);
if{asEntity == "CodeRockPlaced"+GetLocalVarInt("Rock1Fills")){
SetEntityActive("CodeRock1", true);
SetLocalVarInt("CurrentRock", 1);
AddEntityCollideCallback("CodeRock1", "CodeRockPlaceArea_"+GetLocalVarInt("Rock1Fills"), "ReAddPlaceRock", true, -1);
}
else if{asEntity == "CodeRockPlaced"+GetLocalVarInt("Rock2Fills")){
SetEntityActive("CodeRock2", true);
SetLocalVarInt("CurrentRock", 2);
AddEntityCollideCallback("CodeRock2", "CodeRockPlaceArea_"+GetLocalVarInt("Rock2Fills"), "ReAddPlaceRock", true, -1);
}
else if{asEntity == "CodeRockPlaced"+GetLocalVarInt("Rock3Fills")){
SetEntityActive("CodeRock3", true);
SetLocalVarInt("CurrentRock", 3);
AddEntityCollideCallback("CodeRock3", "CodeRockPlaceArea_"+GetLocalVarInt("Rock3Fills"), "ReAddPlaceRock", true, -1);
}
else{
SetEntityActive("CodeRock4", true);
SetLocalVarInt("CurrentRock", 4);
AddEntityCollideCallback("CodeRock4", "CodeRockPlaceArea_"+GetLocalVarInt("Rock4Fills"), "ReAddPlaceRock", true, -1);
}
}
void ReAddPlaceRock(string &in asParent, string &in asChild, int alState){
for(int i = 1; i <= 9; i++){
AddEntityCollideCallback("CodeRock"+GetLocalVarInt("CurrentRock"), "CodeRockPlaceArea_"+i, "PlaceRock", true, 1);
}
}
///////////////////
//EventFunctions://
///////////////////
/////////////////////////////////////
//HappyMatt12345ExclusiveFunctions://
/////////////////////////////////////
// Project wide
void SetErocadosEncounterActive(string &in EntityName, bool Active){
SetLightVisible(EntityName+"_EroLight_1", Active);
SetLightVisible(EntityName+"_EroLight_2", Active);
SetLightVisible(EntityName+"_EroLight_3", Active);
SetLightVisible(EntityName+"_EroLight_4", Active);
SetLightVisible(EntityName+"_EroLight_5", Active);
SetLightVisible(EntityName+"_EroLight_6", Active);
SetLightVisible(EntityName+"_EroLight_7", Active);
SetEntityActive(EntityName, Active);
}
// Project wide
// Map Exclusive
// Map Exclusive
/////////////////////////////////////
//HappyMatt12345ExclusiveFunctions://
/////////////////////////////////////
// runs when the player leaves the map
void OnLeave(){
StopMusic(1, 1);
SetupLoadScreen("LoadingScreens", "LoadScreenCh103", 0, "LoadingScreen.jpg");
}
I know its got to be something to do with the UnsetCurrentRock function because when I comment out that whole function, the code runs fine, I don't know what could be wrong though so any help is appreciated.
(This post was last modified: 12-30-2018, 10:21 PM by HappyMatt12345.)
|
|
10-30-2018, 07:23 PM |
|
MatiCekuriel
Member
Posts: 79
Threads: 11
Joined: Aug 2012
Reputation:
3
|
RE: Err: Unexpected end of file at (244, 2)
void UnsetCurrentRock(string &in asEntity){
SetEntityActive(asEntity, false);
if{asEntity == "CodeRockPlaced"+GetLocalVarInt("Rock1Fills")){
You wrote a { instead of a (
(This post was last modified: 10-30-2018, 09:05 PM by MatiCekuriel.)
|
|
10-30-2018, 09:04 PM |
|
HappyMatt12345
Junior Member
Posts: 16
Threads: 6
Joined: Oct 2018
Reputation:
0
|
RE: Err: Unexpected end of file at (244, 2)
(10-30-2018, 09:04 PM)MatiCekuriel Wrote: void UnsetCurrentRock(string &in asEntity){
SetEntityActive(asEntity, false);
if{asEntity == "CodeRockPlaced"+GetLocalVarInt("Rock1Fills")){
You wrote a { instead of a (
Ok, I feel somewhat stupid now, but thanks, it works now. Much appreciated
|
|
10-31-2018, 12:08 AM |
|
Mudbill
Muderator
Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation:
179
|
RE: Err: Unexpected end of file at (244, 2)
If you're not already using one, I highly recommend a proper editor for coding. It'll help you avoid issues like these. I'll suggest Notepad++, Atom or Visual Studio Code.
Then you can see your function like so:
The fixed version looking like so (admittedly this particular case isn't an obvious find here):
I suggest you also format your code. Some prefer different styles, but it's a good habit to space things out because it makes it more readable and easier to debug.
See:
(This post was last modified: 10-31-2018, 12:59 AM by Mudbill.)
|
|
10-31-2018, 12:58 AM |
|
HappyMatt12345
Junior Member
Posts: 16
Threads: 6
Joined: Oct 2018
Reputation:
0
|
RE: Err: Unexpected end of file at (244, 2)
(10-31-2018, 12:58 AM)Mudbill Wrote: If you're not already using one, I highly recommend a proper editor for coding. It'll help you avoid issues like these. I'll suggest Notepad++, Atom or Visual Studio Code.
Then you can see your function like so:
The fixed version looking like so (admittedly this particular case isn't an obvious find here):
I suggest you also format your code. Some prefer different styles, but it's a good habit to space things out because it makes it more readable and easier to debug.
See:
I use Notepad++ already, but thanks
|
|
10-31-2018, 01:10 AM |
|
|