Frictional Games Forum (read-only)
[SCRIPT] Unexpected error on my script. - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Unexpected error on my script. (/thread-11623.html)



Unexpected error on my script. - Loveridge - 12-02-2011

I keep getting an unexpected error with my script... I have no idea what's wrong it says: main (51,2)
:ERR: Unexpected end of file.
Heres my script if you can help it would be much appreciated Smile


////////////////////////////
// Run when entering map
void OnEnter()

{
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_1", 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);
}
void OnStart()

{
AddUseItemCallback("","crowbar_1", "cdoor", "FUNCTION", true);
}

void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("cdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("crowbar_1");
void OnStart()

{
SetEntityConnectionStateChangeCallback("booklever", "func_shelf");
}


void func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("secret",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
}
}
////////////////////////////
// Run when leaving map
void OnLeave()
{

}


RE: Unexpected error on my script. - Khyrpa - 12-02-2011

////////////////////////////
// Run when entering map
void OnEnter()

{
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_1", 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);
}

void OnStart()
{
AddUseItemCallback("","crowbar_1", "cdoor", "FUNCTION", true);
}

void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("cdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("crowbar_1");
}

void OnStart()
{
SetEntityConnectionStateChangeCallback("booklever", "func_shelf");
}


void func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("secret",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
}
}
////////////////////////////
// Run when leaving map
void OnLeave()
{

}



are you sure you are using c++ language or the configs recommended in wiki for notepad++ or whatever youre using? It makes spotting those bracket errors a lot easier



RE: Unexpected error on my script. - Loveridge - 12-02-2011

(12-02-2011, 07:23 PM)Khyrpa Wrote: ////////////////////////////
// Run when entering map
void OnEnter()

{
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_1", 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);
}

void OnStart()
{
AddUseItemCallback("","crowbar_1", "cdoor", "FUNCTION", true);
}

void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("cdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("crowbar_1");
}

void OnStart()
{
SetEntityConnectionStateChangeCallback("booklever", "func_shelf");
}


void func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("secret",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
}
}
////////////////////////////
// Run when leaving map
void OnLeave()
{

}



are you sure you are using c++ language or the configs recommended in wiki for notepad++ or whatever youre using? It makes spotting those bracket errors a lot easier