Frictional Games Forum (read-only)
Amnesia Editor Unexpected { error - 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: Amnesia Editor Unexpected { error (/thread-13089.html)



Amnesia Editor Unexpected { error - AnnoyingIB - 02-04-2012

Hi!

I've started to make my own map in amnesia editor. But when I start it I get a meassage:

FATAL ERROR: Could not load script file 'custom_stories/The User/Maps/The User.hps'!
main (15,1): ERR : Unexpected token '{'
main (24,1): ERR : Unexpected token '{'
I've acctually seen a thread like this that solves the problem. But I didn't get what to do.
So here's the script:
____________________________________________________
////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "Bedroomkey_1", "Bedroom_1", "KeyOnDoor", true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Bedroom_1", false, true);
PlaySoundAtEntity("", "unlock_door", "Bedroom_1", 0, false);
RemoveItem("Bedroomkey_1");
}
{ *I think that it is this one that makes the (15,1) problem**
AddEntityCollideCallback("Player", "Area1", "CollideArea1", true, 1);
}
void CollideArea1(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_2", true, true);
}
{ *And also this one could be the (24,1) problem.*
AddUseItemCallback("", "key_1", "mansion_1", "KeyOnDoor", true);
AddEntityCollideCallback("Player", "AreaHelp", "CollideAreaHelp", false, 1);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("key_1");
}
////////////////////////////
// Run when entering map
void OnEnter ()
{
}
////////////////////////////
// Run when leaving map
void OnLeave ()
{
}
____________________________________________________

Any ideas? Other reflections of the script?




RE: Amnesia Editor Unexpected { error - Khyrpa - 02-04-2012

{
AddUseItemCallback("", "key_1", "mansion_1", "KeyOnDoor", true);
AddEntityCollideCallback("Player", "AreaHelp", "CollideAreaHelp", false, 1);
}
{
AddEntityCollideCallback("Player", "Area1", "CollideArea1", true, 1);
}

those can't just lay in the script file without giving info on when and from what they should be triggered.
I assume you want those to happen right when the game starts the first time so inside void OnStart like this:

////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "Bedroomkey_1", "Bedroom_1", "KeyOnDoor", true);
AddUseItemCallback("", "key_1", "mansion_1", "KeyOnDoor", true);
AddEntityCollideCallback("Player", "AreaHelp", "CollideAreaHelp", false, 1);
AddEntityCollideCallback("Player", "Area1", "CollideArea1", true, 1);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Bedroom_1", false, true);
PlaySoundAtEntity("", "unlock_door", "Bedroom_1", 0, false);
RemoveItem("Bedroomkey_1");
}

void CollideArea1(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_2", true, true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("key_1");
}
////////////////////////////
// Run when entering map
void OnEnter ()
{
}
////////////////////////////
// Run when leaving map
void OnLeave ()
{
}



RE: Amnesia Editor Unexpected { error - AnnoyingIB - 02-04-2012

(02-04-2012, 12:42 PM)Khyrpa Wrote: {
AddUseItemCallback("", "key_1", "mansion_1", "KeyOnDoor", true);
AddEntityCollideCallback("Player", "AreaHelp", "CollideAreaHelp", false, 1);
}
{
AddEntityCollideCallback("Player", "Area1", "CollideArea1", true, 1);
}

those can't just lay in the script file without giving info on when and from what they should be triggered.
I assume you want those to happen right when the game starts the first time so inside void OnStart like this:

////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "Bedroomkey_1", "Bedroom_1", "KeyOnDoor", true);
AddUseItemCallback("", "key_1", "mansion_1", "KeyOnDoor", true);
AddEntityCollideCallback("Player", "AreaHelp", "CollideAreaHelp", false, 1);
AddEntityCollideCallback("Player", "Area1", "CollideArea1", true, 1);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Bedroom_1", false, true);
PlaySoundAtEntity("", "unlock_door", "Bedroom_1", 0, false);
RemoveItem("Bedroomkey_1");
}

void CollideArea1(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_2", true, true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("key_1");
}
////////////////////////////
// Run when entering map
void OnEnter ()
{
}
////////////////////////////
// Run when leaving map
void OnLeave ()
{
}
Thanks for taking your time.
Now I got the error that said that (22,5) still existed (or something like that). It was the *void KeyOnDoor(string &in asItem, string &in asEntity)*.
So I removed it, but then I got the error that said: main (22,1): ERR Unexpected token '{'
What have I done wrong?

EDIT: Now I finally got what you said. And now it works! Thank you very much! Big Grin