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
Unexpected Token
Aglowglint11 Offline
Junior Member

Posts: 31
Threads: 8
Joined: Mar 2014
Reputation: 0
#1
Unexpected Token

Having some problems with the Error Unexpected Token (94,1)
'{'

===========


// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "SoundArea_1", "Sound_1", true, 1);
AddEntityCollideCallback("Player", "fallarea", "fall", true, 1);
AddEntityCollideCallback("Player", "SoundArea_2", "Sound_2", true, 1);
AddEntityCollideCallback("Player", "SoundArea_3", "Sound_3", true, 1);
AddEntityCollideCallback("Player", "SoundArea_4", "Sound_4", true, 1);
AddEntityCollideCallback("Player", "SoundArea_5", "Sound_5", true, 1);
AddEntityCollideCallback("Player", "SoundArea_6", "Sound_5", true, 1);
AddEntityCollideCallback("Player", "SoundArea_7", "Sound_5", true, 1);
AddUseItemCallback("", "Key", "Door", "UsedKeyonDoor", true);
}
void fall(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("2", true);
SetEntityActive("3", true);
SetEntityActive("4", true);
SetEntityActive("5", true);
SetEntityActive("6", true);
}

void Sound_1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "24_rock.snt", "Player", 0, false);
}
void UsedKeyonDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door", false,true);
PlaySoundAtEntity("", "unlock_door", "Door", 0, false);
RemoveItem("Key");
}

void Sound_2(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "24_iron_maiden.snt", "Player", 0, false);
}

void Sound_3(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
}

void Sound_4(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
}

void Sound_5(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "24_mb_04.snt", "Player", 0, false);
}

void Sound_6(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "18_blow_wind.snt", "Player", 0, false);
}

void Sound_7(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "guardian_idle.snt", "Player", 0, false);
AddEntityCollideCallback("Player", "AreaCollide", "EventCollide", true, 1);
}

void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Grunt", true);

AddEnemyPatrolNode("Grunt", "Node_1", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_2", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_3", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_4", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_5", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_6", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_7", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_8", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_9", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_10", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_11", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_12", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_13", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_14", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_15", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_16", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_17", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_18", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_19", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_20", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_21", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_22", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_23", 0.001f, "");
}

{
AddEntityCollideCallback("Handle", "AreaConnect", "AttachLever", true, 1);
}

void AttachLever(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Lever", true);
PlaySoundAtEntity("", "pickaxe_charge.snt", "Lever", 0, false);
SetEntityActive(asParent, false);
SetEntityActive("Mount", false);
}

void UnlockDoor(string &in asEntity, int LeverState)
{
if(LeverState == 1) {
SetSwingDoorLocked("Door", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "Door", 0, false);
SetLeverStuckState(asEntity, LeverState, true);
}
}

void Puzzle(string &in asEntity, int LeverState)
{
if(GetLeverState("Lever1") == -1
&& GetLeverState("Lever2") == 1)
{
SetPropHealth("Door", 0);
SetLeverStuckState("Lever1", -1, true);
SetLeverStuckState("Lever2", 1, true);
}
}
05-29-2014, 08:35 PM
Find
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#2
RE: Unexpected Token

At first glance, these lines are wrong:
PHP Code: (Select All)
{
AddEntityCollideCallback("Handle""AreaConnect""AttachLever"true1);


You should put that callback inside a function.

05-29-2014, 08:56 PM
Find
Aglowglint11 Offline
Junior Member

Posts: 31
Threads: 8
Joined: Mar 2014
Reputation: 0
#3
RE: Unexpected Token

Oh? How would I do that? Sorry, I'm a n00b lol.
05-29-2014, 09:06 PM
Find
Aglowglint11 Offline
Junior Member

Posts: 31
Threads: 8
Joined: Mar 2014
Reputation: 0
#4
RE: Unexpected Token

If you don't mind showing me.
05-29-2014, 10:42 PM
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#5
RE: Unexpected Token

// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "SoundArea_1", "Sound_1", true, 1);
AddEntityCollideCallback("Player", "fallarea", "fall", true, 1);
AddEntityCollideCallback("Player", "SoundArea_2", "Sound_2", true, 1);
AddEntityCollideCallback("Player", "SoundArea_3", "Sound_3", true, 1);
AddEntityCollideCallback("Player", "SoundArea_4", "Sound_4", true, 1);
AddEntityCollideCallback("Player", "SoundArea_5", "Sound_5", true, 1);
AddEntityCollideCallback("Player", "SoundArea_6", "Sound_5", true, 1);
AddEntityCollideCallback("Player", "SoundArea_7", "Sound_5", true, 1);
AddEntityCollideCallback("Handle", "AreaConnect", "AttachLever", true, 1);
AddEntityCollideCallback("Player", "AreaCollide", "EventCollide", true, 1);
AddUseItemCallback("", "Key", "Door", "UsedKeyonDoor", true);
}
void fall(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("2", true);
SetEntityActive("3", true);
SetEntityActive("4", true);
SetEntityActive("5", true);
SetEntityActive("6", true);
}

void Sound_1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "24_rock.snt", "Player", 0, false);
}
void UsedKeyonDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door", false,true);
PlaySoundAtEntity("", "unlock_door", "Door", 0, false);
RemoveItem("Key");
}

void Sound_2(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "24_iron_maiden.snt", "Player", 0, false);
}

void Sound_3(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
}

void Sound_4(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
}

void Sound_5(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "24_mb_04.snt", "Player", 0, false);
}

void Sound_6(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "18_blow_wind.snt", "Player", 0, false);
}

void Sound_7(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "guardian_idle.snt", "Player", 0, false);
}

void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Grunt", true);

AddEnemyPatrolNode("Grunt", "Node_1", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_2", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_3", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_4", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_5", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_6", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_7", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_8", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_9", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_10", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_11", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_12", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_13", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_14", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_15", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_16", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_17", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_18", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_19", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_20", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_21", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_22", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_23", 0.001f, "");
}

void AttachLever(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Lever", true);
PlaySoundAtEntity("", "pickaxe_charge.snt", "Lever", 0, false);
SetEntityActive(asParent, false);
SetEntityActive("Mount", false);
}

void UnlockDoor(string &in asEntity, int LeverState)
{
if(LeverState == 1) {
SetSwingDoorLocked("Door", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "Door", 0, false);
SetLeverStuckState(asEntity, LeverState, true);
}
}

void Puzzle(string &in asEntity, int LeverState)
{
if(GetLeverState("Lever1") == -1
&& GetLeverState("Lever2") == 1)
{
SetPropHealth("Door", 0);
SetLeverStuckState("Lever1", -1, true);
SetLeverStuckState("Lever2", 1, true);
}
}

This might solve most stuff.

Derp.
(This post was last modified: 05-29-2014, 10:56 PM by Neelke.)
05-29-2014, 10:55 PM
Find
Aglowglint11 Offline
Junior Member

Posts: 31
Threads: 8
Joined: Mar 2014
Reputation: 0
#6
RE: Unexpected Token

I'm also having the same problem with this file of script

======

// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "SoundArea_1", "Sound_1", true, 1);
AddEntityCollideCallback("Player", "fallarea", "fall", true, 1);
AddEntityCollideCallback("Player", "SoundArea_2", "Sound_2", true, 1);
AddEntityCollideCallback("Player", "SoundArea_3", "Sound_3", true, 1);
AddEntityCollideCallback("Player", "SoundArea_4", "Sound_4", true, 1);
AddEntityCollideCallback("Player", "SoundArea_5", "Sound_5", true, 1);
AddEntityCollideCallback("Player", "SoundArea_6", "Sound_5", true, 1);
AddEntityCollideCallback("Player", "SoundArea_7", "Sound_5", true, 1);
AddUseItemCallback("", "Key", "Door", "UsedKeyonDoor", true);
}
void fall(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("2", true);
SetEntityActive("3", true);
SetEntityActive("4", true);
SetEntityActive("5", true);
SetEntityActive("6", true);
}

void Sound_1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "24_rock.snt", "Player", 0, false);
}
void UsedKeyonDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door", false,true);
PlaySoundAtEntity("", "unlock_door", "Door", 0, false);
RemoveItem("Key");
}

void Sound_2(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "24_iron_maiden.snt", "Player", 0, false);
}

void Sound_3(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
}

void Sound_4(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false);
}

void Sound_5(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "24_mb_04.snt", "Player", 0, false);
}

void Sound_6(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "18_blow_wind.snt", "Player", 0, false);
}

void Sound_7(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "guardian_idle.snt", "Player", 0, false);
AddEntityCollideCallback("Player", "AreaCollide", "EventCollide", true, 1);
AddEntityCollideCallback("Player", "AreaCollide_2", "EventCollide", true, 1);
}
}

void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Grunt", true);

AddEnemyPatrolNode("Grunt", "Node_1", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_2", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_3", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_4", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_5", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_6", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_7", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_8", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_9", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_10", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_11", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_12", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_13", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_14", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_15", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_16", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_17", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_18", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_19", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_20", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_21", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_22", 0.001f, "");
AddEnemyPatrolNode("Grunt", "Node_23", 0.001f, "");
}

void EventCollide(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Demon", true);

AddEnemyPatrolNode("Demon", "Path_1", 0.001f, "");
AddEnemyPatrolNode("Demon", "Path_2", 0.001f, "");
AddEnemyPatrolNode("Demon", "Path_3", 0.001f, "");
AddEnemyPatrolNode("Demon", "Path_4", 0.001f, "");
AddEnemyPatrolNode("Demon", "Path_5", 0.001f, "");
AddEnemyPatrolNode("Demon", "Path_6", 0.001f, "");
AddEnemyPatrolNode("Demon", "Path_7", 0.001f, "");
AddEnemyPatrolNode("Demon", "Path_8", 0.001f, "");
AddEnemyPatrolNode("Demon", "Path_9", 0.001f, "");
AddEnemyPatrolNode("Demon", "Path_10", 0.001f, "");
AddEnemyPatrolNode("Demon", "Path_11", 0.001f, "");
AddEnemyPatrolNode("Demon", "Path_12", 0.001f, "");
}
05-30-2014, 07:51 PM
Find
Straxedix Offline
Senior Member

Posts: 426
Threads: 52
Joined: Mar 2014
Reputation: 5
#7
RE: Unexpected Token

Spoilers are amazing Smile

type [spooiler] with one "o" letter and for better type [spooiler][phpp] (1 "p" and all that but on end [/spooiler] nad stuff)

05-30-2014, 07:55 PM
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#8
RE: Unexpected Token

One extra } that's not supposed to be there.

void Sound_7(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "guardian_idle.snt", "Player", 0, false);
AddEntityCollideCallback("Player", "AreaCollide", "EventCollide", true, 1);
AddEntityCollideCallback("Player", "AreaCollide_2", "EventCollide", true, 1);
}

Derp.
05-30-2014, 08:58 PM
Find
Aglowglint11 Offline
Junior Member

Posts: 31
Threads: 8
Joined: Mar 2014
Reputation: 0
#9
RE: Unexpected Token

Now it's telling me that instead of '}' it's '{'
05-31-2014, 01:30 AM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#10
RE: Unexpected Token

(05-29-2014, 08:56 PM)Amn Wrote: At first glance, these lines are wrong:
PHP Code: (Select All)
{
AddEntityCollideCallback("Handle""AreaConnect""AttachLever"true1);


You should put that callback inside a function.

What our sexy Amn means is!;
put that addent.callback in OnStart.
so you can remove the 2 { }
then no error will popup.
(This post was last modified: 05-31-2014, 01:47 AM by DnALANGE.)
05-31-2014, 01:46 AM
Find




Users browsing this thread: 1 Guest(s)