McWane
Junior Member
Posts: 3
Threads: 1
Joined: Jul 2012
Reputation:
0
|
ERR : unexpected token '{'
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 ()
{
}
|
|
07-11-2012, 08:05 PM |
|
SilentStriker
Posting Freak
Posts: 950
Threads: 26
Joined: Jul 2011
Reputation:
43
|
RE: ERR : unexpected token '{'
it should be
OnStart()
OnEnter()
OnLeave()
not onStart etc
|
|
07-11-2012, 08:10 PM |
|
Adny
Posting Freak
Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation:
173
|
RE: ERR : unexpected token '{'
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.
I rate it 3 memes.
|
|
07-11-2012, 08:27 PM |
|
McWane
Junior Member
Posts: 3
Threads: 1
Joined: Jul 2012
Reputation:
0
|
RE: ERR : unexpected token '{'
Thanks no more script errors, but my door still won't open >.>
|
|
07-11-2012, 08:43 PM |
|
Adny
Posting Freak
Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation:
173
|
RE: ERR : unexpected token '{'
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.
I rate it 3 memes.
|
|
07-11-2012, 08:53 PM |
|
CookieMonster
Junior Member
Posts: 2
Threads: 0
Joined: Jul 2012
Reputation:
0
|
RE: ERR : unexpected token '{'
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 ()
{
}
|
|
07-12-2012, 03:26 AM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: ERR : unexpected token '{'
(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.
(This post was last modified: 07-12-2012, 03:35 AM by Your Computer.)
|
|
07-12-2012, 03:35 AM |
|
CookieMonster
Junior Member
Posts: 2
Threads: 0
Joined: Jul 2012
Reputation:
0
|
RE: ERR : unexpected token '{'
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
(This post was last modified: 07-12-2012, 12:45 PM by CookieMonster.)
|
|
07-12-2012, 11:58 AM |
|
McWane
Junior Member
Posts: 3
Threads: 1
Joined: Jul 2012
Reputation:
0
|
RE: ERR : unexpected token '{'
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
|
|
07-18-2012, 06:59 AM |
|
|