[SCRIPT] Fatal Error : ERR : Unexpected token '{' - 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] Fatal Error : ERR : Unexpected token '{' (/thread-15598.html) |
Fatal Error : ERR : Unexpected token '{' - Clear - 05-24-2012 Hey guys, I have been working on a custom story and i wanted to add a door slam script, but when i added it to the .hps file it gave me an error saying Unexpected token "{" , I have no clue what to do in order to fix it, i'd appreciate any help. //////////////////////////// // Run first time starting map void OnStart() { AddUseItemCallback("", "key1", "DoorName01", "UsedKeyOnDoor", true); } void UsedKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked("DoorName01", false, true); PlaySoundAtEntity("", "unlock_door", "DoorName01", 0, false); RemoveItem("key1"); } { AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1); } void func_slam(string &in asParent, string &in asChild, int alState) { SetSwingDoorClosed("DoorName01", 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); } Image of the Error: http://gyazo.com/aba925b567f80c526ccc156c420efce7 RE: Fatal Error : ERR : Unexpected token '{' - Stepper321 - 05-24-2012 Check it yourself! 14 is the line and 1 is the location in that line. { AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1); } Theres no void etc... RE: Fatal Error : ERR : Unexpected token '{' - Clear - 05-24-2012 (05-24-2012, 12:56 PM)Stepper321 Wrote: Check it yourself! Soory if the problem is way obvious than i expected but i'm new at scripting and making custom stories in amnesia, can you please explain me how to fix it? Like, where to put the void and such. Thanks! RE: Fatal Error : ERR : Unexpected token '{' - Stepper321 - 05-24-2012 (05-24-2012, 01:01 PM)Clear Wrote:First i need to know WHEN you want to enable that part of the script.(05-24-2012, 12:56 PM)Stepper321 Wrote: Check it yourself! RE: Fatal Error : ERR : Unexpected token '{' - Clear - 05-24-2012 (05-24-2012, 01:05 PM)Stepper321 Wrote:http://gyazo.com/c66a95e14f81787915194e1c29bc7208(05-24-2012, 01:01 PM)Clear Wrote:First i need to know WHEN you want to enable that part of the script.(05-24-2012, 12:56 PM)Stepper321 Wrote: Check it yourself! My goal is to make the door slam as soon as i walk infront of the area, i have a key & door script on the top and the script with error, the slam script, if that's what you wanted to know RE: Fatal Error : ERR : Unexpected token '{' - Stepper321 - 05-24-2012 Put Code: AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1); put it here! } RE: Fatal Error : ERR : Unexpected token '{' - Datguy5 - 05-24-2012 Nevermind RE: Fatal Error : ERR : Unexpected token '{' - Clear - 05-24-2012 (05-24-2012, 01:41 PM)Datguy5 Wrote: NevermindDo you have any clue what do i need to do in order to solve this error? RE: Fatal Error : ERR : Unexpected token '{' - Cranky Old Man - 05-24-2012 (05-24-2012, 02:23 PM)Clear Wrote: Do you have any clue what do i need to do in order to solve this error?You cannot declare functions inside other functions. Read up on basic curly bracket ( "{" and "}" ) use. |