![]() |
[SCRIPT] 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] ERR : unexpected token '{' (/thread-16896.html) |
ERR : unexpected token '{' - McWane - 07-11-2012 Yes I know there are other threads with this same problem. But I don't get how they were able to fix theirs. So telling me what i'm doing wrong and telling me how to fix it would be nice(This is my first script BTW) Here it is, nice and short. void onStart () { AddUseItemCallback("", "key_1", "locked_door1", "UsedKeyOnDoor", true); SetEntityCallbackfunc("key_1","OnPickup"); } void UsedKeyOnDoor(string &in asItem, string &asEntity); { SetSwingDoorLocked("locked_door1",false,true); PlaySoundAtEntity("","unlock_door.snt","locked_door1",0,false); RemoveItem("key_1"); } void onLeave () { } RE: ERR : unexpected token '{' - SilentStriker - 07-11-2012 it should be OnStart() OnEnter() OnLeave() not onStart etc RE: ERR : unexpected token '{' - Adny - 07-11-2012 In addition to what Silent said, this line is incorrect: void UsedKeyOnDoor(string &in asItem, string &asEntity); Any line that starts with "void" does not need a semicolon ";" on the end. It should be: void UsedKeyOnDoor(string &in asItem, string &asEntity) Hope that helped. RE: ERR : unexpected token '{' - McWane - 07-11-2012 Thanks ![]() RE: ERR : unexpected token '{' - Adny - 07-11-2012 Doh. Try revising the syntax of "UsedKeyOnDoor" from (string &in asItem, string &asEntity) to : (string &in asItem, string &in asEntity) Also, where is the function "OnPickup"? You have a callback for it, but no function. RE: ERR : unexpected token '{' - CookieMonster - 07-12-2012 anyone who could help me with this one ? error is at main(6,1) "unexpected token" '{' have tried for hours to find it void OnStart() { AddUseItemCallback("", "Awesomekey_1", "doorone", "KeyOnDoor", true); } void Keyondoor(string &in asItem, string &in asEntity); { SetSwingDoorLocked("doorone", false, true); PlaySoundAtEntity("", "unlock_door.snt", "doorone", 0, false) RemoveItem("Awesomekey_1"); } //////////////////////////// // Run when entering map void OnEnter () { } //////////////////////////// // Run when leaving map void OnLeave () { } RE: ERR : unexpected token '{' - Your Computer - 07-12-2012 (07-12-2012, 03:26 AM)CookieMonster Wrote: anyone who could help me with this one ? error is at main(6,1) "unexpected token" '{' have tried for hours to find it You've made the same mistake as the topic starter with the semicolon. You're also missing a semicolon for PlaySoundAtEntity. RE: ERR : unexpected token '{' - CookieMonster - 07-12-2012 thank you, i've been blind not to see that But the door won't open now, anyone who know why ? ![]() (yes, i'm new to this) nevermind, i figured it out ![]() RE: ERR : unexpected token '{' - McWane - 07-18-2012 Thanks! I ragequited so I havnt touched the game for a week lol..... You will probably see more of my idiotic posts for help XD |