Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help I cant find the unexpected token! Help please :)
Author Message
Loveridge Offline
Junior Member

Posts: 21
Joined: Nov 2011
Reputation: 0
Post: #1
I cant find the unexpected token! Help please :)
Okay ive gone through this a million times xD but all i get when running is "Unexpected token "{" it seems to be near the end by the "void func" but i cant get it to work. If you can show me whats wrong itll be much appreciated Smile




////////////////////////////
// Run when entering map
void OnEnter()

{
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_1", true, true);

PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);






GiveSanityDamage(50.0f, true);
}

void OnStart()
{
AddUseItemCallback("","crowbar_1", "cdoor", "FUNCTION", true);
}

void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("cdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("crowbar_1");
}
{

AddEntityCollideCallback("Player", "doorslam2", "func_slam", true, 1);
}
void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("slamdoor2", true, true);

PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);

GiveSanityDamage(50.0f, true);
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
12-06-2011 09:20 PM
Find all posts by this user Quote this message in a reply
triadtimes Offline
Senior Member

Posts: 451
Joined: Jan 2011
Reputation: 19
Post: #2
RE: I cant find the unexpected token! Help please :)
Spoiler below!
(12-06-2011 09:20 PM)Loveridge Wrote:  ////////////////////////////
// Run when entering map
void OnEnter()

{
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_1", true, true);

PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);






GiveSanityDamage(50.0f, true);
}

void OnStart()
{
AddUseItemCallback("","crowbar_1", "cdoor", "FUNCTION", true);
}

void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("cdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("crowbar_1");
}
{

AddEntityCollideCallback("Player", "doorslam2", "func_slam", true, 1);
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("slamdoor2", true, true);

PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);

GiveSanityDamage(50.0f, true);
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}


My guess would be to check the bold-ed area, there is no function preceding it. You should probably move that to the OnStart or OnEnter area.

Escape
Alone
(Г°ω°)Г

(This post was last modified: 12-06-2011 09:58 PM by triadtimes.)
12-06-2011 09:57 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Statyk Offline
Modmau5

Posts: 3,609
Joined: Sep 2011
Reputation: 198
Post: #3
RE: I cant find the unexpected token! Help please :)
////////////////////////////
// Run when entering map
void OnEnter()
{
AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1);
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("Door_1", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(50.0f, true);
}

void OnStart()
{
AddUseItemCallback("","crowbar_1", "cdoor", "FUNCTION", true);
AddEntityCollideCallback("Player", "doorslam2", "func_slam", true, 1);
}

void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("cdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("crowbar_1");
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("slamdoor2", true, true);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);
GiveSanityDamage(50.0f, true);
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

//___________________________

Just copy and paste all of that... You had an extra set of
"{
}"

Also... Your tabbing is very spaced and confusing. Try to keep it a little tidy so you can find issues easier =]

By the way triadtimes... I love your signature. haha

(This post was last modified: 12-06-2011 10:01 PM by Statyk.)
12-06-2011 10:00 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)