Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help ERR : unexpected token '{'
McWane Offline
Junior Member

Posts: 3
Threads: 1
Joined: Jul 2012
Reputation: 0
#1
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
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#2
RE: ERR : unexpected token '{'

it should be

OnStart()

OnEnter()

OnLeave()

not onStart etc

07-11-2012, 08:10 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#3
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
Find
McWane Offline
Junior Member

Posts: 3
Threads: 1
Joined: Jul 2012
Reputation: 0
#4
RE: ERR : unexpected token '{'

Thanks Big Grin no more script errors, but my door still won't open >.>
07-11-2012, 08:43 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#5
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
Find
CookieMonster Offline
Junior Member

Posts: 2
Threads: 0
Joined: Jul 2012
Reputation: 0
#6
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
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#7
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.

Tutorials: From Noob to Pro
(This post was last modified: 07-12-2012, 03:35 AM by Your Computer.)
07-12-2012, 03:35 AM
Website Find
CookieMonster Offline
Junior Member

Posts: 2
Threads: 0
Joined: Jul 2012
Reputation: 0
#8
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 ? Smile
(yes, i'm new to this)
nevermind, i figured it out Smile
(This post was last modified: 07-12-2012, 12:45 PM by CookieMonster.)
07-12-2012, 11:58 AM
Find
McWane Offline
Junior Member

Posts: 3
Threads: 1
Joined: Jul 2012
Reputation: 0
#9
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
Find




Users browsing this thread: 2 Guest(s)