Frictional Games Forum (read-only)
Unexpected err { - 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: Unexpected err { (/thread-22147.html)

Pages: 1 2 3


Unexpected err { - mrjoshy12 - 07-16-2013

Once I go to play my map this comes up!Huh
FATAL ERROR:Could not load script file
'custom_stories/Tutorial/maps/maps1.hps'!
main (14, 1) :ERR :Unexpected token '{'

Heres the map1.hps

////////////////////////////
// This runs when the player enters the map
void OnEnter()
{
AddUseItemCallback("", "escape_door_key1", "escape_room_door1", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("escape_room_door1", false, true);
PlaySoundAtEntity("", "unlock_door", "escape_room_door1", 0, false);
RemoveItem("escape_door_key1");
}
{
AddUseItemCallback("", "lol_key1", "lol_door1", "UsedKeyOnDoor2", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("lol_door1", false, true);
PlaySoundAtEntity("", "unlock_door", "lol_door1", 0, false);
RemoveItem("lol_key1");
PlayMusic("Without_You_.ogg", false, 1, 0, true);
}
//===========================================
// This runs when the player leaves the map
void OnLeave()
{
}

HELP ME!!! Sad


RE: Unexpected err { - No Author - 07-16-2013

(07-16-2013, 10:35 AM)mrjoshy12 Wrote: Once I go to play my map this comes up!Huh
FATAL ERROR:Could not load script file
'custom_stories/Tutorial/maps/maps1.hps'!
main (14, 1) :ERR :Unexpected token '{'

Heres the map1.hps

////////////////////////////
// This runs when the player enters the map
void OnEnter()
{
AddUseItemCallback("", "escape_door_key1", "escape_room_door1", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("escape_room_door1", false, true);
PlaySoundAtEntity("", "unlock_door", "escape_room_door1", 0, false);
RemoveItem("escape_door_key1");
}
{
AddUseItemCallback("", "lol_key1", "lol_door1", "UsedKeyOnDoor2", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("lol_door1", false, true);
PlaySoundAtEntity("", "unlock_door", "lol_door1", 0, false);
RemoveItem("lol_key1");
PlayMusic("Without_You_.ogg", false, 1, 0, true);
}
//===========================================
// This runs when the player leaves the map
void OnLeave()
{
}

HELP ME!!! Sad

PHP Code:
void UsedKeyOnDoor(string &in asItemstring &in asEntity)
{
     
SetSwingDoorLocked("escape_room_door1"falsetrue);
 
PlaySoundAtEntity("""unlock_door""escape_room_door1"0false);
 
RemoveItem("escape_door_key1");
}
{
      
AddUseItemCallback("""lol_key1""lol_door1""UsedKeyOnDoor2"true);


There's another "{" after the first "}" . There's suppose to be a void thingy before the "{" .


RE: Unexpected err { - Artyom - 07-16-2013

Try this. (Tell me if i missed something, did this from my phone)
Oh and just so you know, one of the Callbacks didn't match the function.
Code:
Void OnStart()
{
    AddUseItemCallback("", "escape_door_key1", "escape_room_door1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "lol_key1", "lol_door1", "UsedKeyOnDoor2", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("escape_room_door1", false, true);
PlaySoundAtEntity("", "unlock_door", "escape_room_door1", 0, false);
RemoveItem("escape_door_key1");
}

void UsedKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("lol_door1", false, true);
PlaySoundAtEntity("", "unlock_door", "lol_door1", 0, false);
RemoveItem("lol_key1");
PlayMusic("Without_You_.ogg", false, 1, 0, true);
}



RE: Unexpected err { - PutraenusAlivius - 07-16-2013

Code:
////////////////////////////
// This runs when the player enters the map
void OnEnter()
{
     AddUseItemCallback("", "escape_door_key1", "escape_room_door1", "UsedKeyOnDoor", true);
AddUseItemCallback("", "lol_key1", "lol_door1", "UsedKeyOnDoor2", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
     SetSwingDoorLocked("escape_room_door1", false, true);
     PlaySoundAtEntity("", "unlock_door", "escape_room_door1", 0, false);
     RemoveItem("escape_door_key1");
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
     SetSwingDoorLocked("lol_door1", false, true);
     PlaySoundAtEntity("", "unlock_door", "lol_door1", 0, false);
     RemoveItem("lol_key1");
     PlayMusic("Without_You_.ogg", false, 1, 0, true);
}
//===========================================
// This runs when the player leaves the map
void OnLeave()
{
}

Fixed. The reason why you got an error is because this code
Code:
{
      AddUseItemCallback("", "lol_key1", "lol_door1", "UsedKeyOnDoor2", true);
}

is not defined in a function.


RE: Unexpected err { - Artyom - 07-16-2013

Dammit No Author! You code to faaaast! Wink


RE: Unexpected err { - No Author - 07-16-2013

Wow. I left for a minute and there's already 3 replies.
Lol ofc I am

And if that doesn't fix the problem, maybe the adduseitemcallback isn't suppose to be there.


RE: Unexpected err { - Artyom - 07-16-2013

(07-16-2013, 10:53 AM)No Author Wrote: Wow. I left for a minute and there's already 3 replies.

And if that doesn't fix the problem, maybe the adduseitemcallback isn't suppose to be there.

Yeah It's all about the reps man all about em!


RE: Unexpected err { - PutraenusAlivius - 07-16-2013

Wow. No Author just ninja'd two people. Nice job dude.


RE: Unexpected err { - mrjoshy12 - 07-16-2013

wow all these comments, i actually forgot to say i started doing this scripting yesterday,
so yeah i dont actually get what most of you are sayin


RE: Unexpected err { - No Author - 07-16-2013

The adduseitemcallback script on Lolkey_1 to loldoor_1 doesn't have a void before the "{"
Edit : I meant lol_key1 and lol_door1