Frictional Games Forum (read-only)
[SCRIPT] Amnesia Custom Story main(7,19): ERR Unexpected identifier - 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] Amnesia Custom Story main(7,19): ERR Unexpected identifier (/thread-22739.html)



Amnesia Custom Story main(7,19): ERR Unexpected identifier - lalakakaka - 09-06-2013

Hi!
I thought to make amnesia the dark descent custom story.
But i have a script error. (Sorry my bad english)
I launch my Custom Story and i get this message: FATAL ERROR:Could not load script file 'custom_stories/Hospital/maps/01.hps'!
main(7,19) :ERR Unexpected identifier
main(8,1) :ERR Unexpected token '{'

My script file:

////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "key_1", "door_1", "UsedKeyOnDoor", true);
}
AddUseItemCallback("", "kulcs_2", "ajto_2", "UsedKeyOnDoor", true);
{
AddUseItemCallback("", "key_3", "kinyitas_3", "UsedKeyOnDoor", true);
}
void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem("key_1");
}
void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("ajto_2", false, true);
PlaySoundAtEntity("", "unlock_door", "ajto_2", 0, false);
RemoveItem("kulcs_2");
}
void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("kinyitas_3", false, true);
PlaySoundAtEntity("", "unlock_door", "kinyitas_3", 0, false);
RemoveItem("key_3");
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

What is the problem?
I need help. Thanks for everyone.


RE: Amnesia Custom Story main(7,19): ERR Unexpected identifier - summit - 09-06-2013

I edited the code. There were errors. Try this one:

Code:
////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "key_1", "door_1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "kulcs_2", "ajto_2", "UsedKeyOnDoor", true);
AddUseItemCallback("", "key_3", "kinyitas_3", "UsedKeyOnDoor", true);
}
void UseKeyOnDoor(string &in asItem, string &in asEntity);
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem("key_1");
}
void UseKeyOnDoor(string &in asItem, string &in asEntity);
{
SetSwingDoorLocked("ajto_2", false, true);
PlaySoundAtEntity("", "unlock_door", "ajto_2", 0, false);
RemoveItem("kulcs_2");
}
void UseKeyOnDoor(string &in asItem, string &in asEntity);
{
SetSwingDoorLocked("kinyitas_3", false, true);
PlaySoundAtEntity("", "unlock_door", "kinyitas_3", 0, false);
RemoveItem("key_3");
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

This should work.


RE: Amnesia Custom Story main(7,19): ERR Unexpected identifier - lalakakaka - 09-06-2013

(09-06-2013, 03:36 PM)Arbies Wrote: I edited the code. There were errors. Try this one:

Code:
////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "key_1", "door_1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "kulcs_2", "ajto_2", "UsedKeyOnDoor", true);
AddUseItemCallback("", "key_3", "kinyitas_3", "UsedKeyOnDoor", true);
}
void UseKeyOnDoor(string &in asItem, string &in asEntity);
{
SetSwingDoorLocked("door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);
RemoveItem("key_1");
}
void UseKeyOnDoor(string &in asItem, string &in asEntity);
{
SetSwingDoorLocked("ajto_2", false, true);
PlaySoundAtEntity("", "unlock_door", "ajto_2", 0, false);
RemoveItem("kulcs_2");
}
void UseKeyOnDoor(string &in asItem, string &in asEntity);
{
SetSwingDoorLocked("kinyitas_3", false, true);
PlaySoundAtEntity("", "unlock_door", "kinyitas_3", 0, false);
RemoveItem("key_3");
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

This should work.

Just i get this message: main(10,1) :ERR : Unexpected token'{'
main(16,1) :ERR : Unexpected token '{'
main(22,1) :ERR : Unexpected token '{'


RE: Amnesia Custom Story main(7,19): ERR Unexpected identifier - Tomato Cat - 09-06-2013

Function declaration doesn't require a semicolon.

Code:
void UseKeyOnDoor(string &in asItem, string &in asEntity);
//Should be
void UseKeyOnDoor(string &in asItem, string &in asEntity)



RE: Amnesia Custom Story main(7,19): ERR Unexpected identifier - summit - 09-06-2013

(09-06-2013, 06:26 PM)Tomato Cat Wrote: Function declaration doesn't require a semicolon.

Code:
void UseKeyOnDoor(string &in asItem, string &in asEntity);
//Should be
void UseKeyOnDoor(string &in asItem, string &in asEntity)
You are right, I couldn't see that.

I send a PM to lalakakaka so problem solved.