| 
		
	
		| Neatherblade   Junior Member
 
 Posts: 19
 Threads: 5
 Joined: Jan 2011
 Reputation: 
0
 | 
			| Error: Unexpected token { 
 
				After i have made this script
 
 
 void OnStart()
 {
 AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
 }
 void MonsterFunc1(string &in asParent , string &in asChild , int alState)
 {
 SetEntityActive("servant_grunt_1" , true);
 }
 
 
 
 
 {   <------- Complain about this one
 
 AddUseItemCallback("", "Elevator_key", "elevator_door_1", "KeyOnDoor", true);
 
 }
 
 void KeyOnDoor(string &in asItem, string &in asEntity)
 {
 SetSwingDoorLocked("elevator_door_1", false, true);
 PlaySoundAtEntity("", "unlock_door.snt", "elevator_door_1", 0.0f, true);
 }
 
 I get this Error: Unexpected token { and if i remove the script for the door and key it works, but why wont it work with the key script?
 |  |  
	| 01-05-2011, 11:27 PM |  |  
	
		| ModManDann   Member
 
 Posts: 61
 Threads: 6
 Joined: Dec 2010
 Reputation: 
0
 | 
			| RE: Error: Unexpected token { 
 
				try putting void OnEnter()above it
 
 |  |  
	| 01-05-2011, 11:49 PM |  |  
	
		| Mofo   Member
 
 Posts: 71
 Threads: 4
 Joined: Sep 2010
 Reputation: 
2
 | 
			| RE: Error: Unexpected token { 
 
				Quote:void OnStart(){
 AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
 }
 void MonsterFunc1(string &in asParent , string &in asChild , int alState)
 {
 SetEntityActive("servant_grunt_1" , true);
 }
 
 
 
 
 { <------- remove
 
 AddUseItemCallback("", "Elevator_key", "elevator_door_1", "KeyOnDoor", true); <------- put inside OnStart or OnEnter.
 
 } <------- remove
 
 void KeyOnDoor(string &in asItem, string &in asEntity)
 {
 SetSwingDoorLocked("elevator_door_1", false, true);
 PlaySoundAtEntity("", "unlock_door.snt", "elevator_door_1", 0.0f, true);
 }
 
				
(This post was last modified: 01-05-2011, 11:56 PM by Mofo.)
 |  |  
	| 01-05-2011, 11:51 PM |  |  
	
		| Neatherblade   Junior Member
 
 Posts: 19
 Threads: 5
 Joined: Jan 2011
 Reputation: 
0
 | 
			| RE: Error: Unexpected token { 
 
				None of that did work, all i get is new errors.Either i already have a void OnStart() or it want indentifiers when i remove { and use void onEnter() or that i should use , or ; efter ()
 but none of that work.
 
 Did remove the key and door for the moment, and was going to try this
 
 
 void OnEnter();
 AddEntityCollideCallback("Player" , "ScriptArea_3" , true , 1);
 
 
 SetEntityActive("wind_1" , true);
 SetEntityActive("wind_sound" , true);
 PlaySoundAtEntity("wind_sound", "ambience_wind_eerie.snt", "player", 2.0f, false);
 
 
 I have not added any { }, if i do it says i should remove them or i should add them.
 |  |  
	| 01-06-2011, 12:18 PM |  |  
	
		| Russ Money   Senior Member
 
 Posts: 360
 Threads: 25
 Joined: Dec 2010
 Reputation: 
4
 | 
			| RE: Error: Unexpected token { 
 
				If you intend on using like this
 void OnEnter();
 AddEntityCollideCallback("Player" , "ScriptArea_3" , true , 1);
 
 You'll need to add { and }
 
 Like this
 
 void OnEnter();
 {
 AddEntityCollideCallback("Player" , "ScriptArea_3" , true , 1);
 }
 
				
(This post was last modified: 01-06-2011, 12:22 PM by Russ Money.)
 |  |  
	| 01-06-2011, 12:22 PM |  |  
	
		| Neatherblade   Junior Member
 
 Posts: 19
 Threads: 5
 Joined: Jan 2011
 Reputation: 
0
 | 
			| RE: Error: Unexpected token { 
 
				But if i do like you did i get the error unexpected token { and expected indentifier.
			 |  |  
	| 01-06-2011, 12:38 PM |  |  
	
		| ModManDann   Member
 
 Posts: 61
 Threads: 6
 Joined: Dec 2010
 Reputation: 
0
 | 
			| RE: Error: Unexpected token { 
 
				void OnEnter();{
 AddEntityCollideCallback("Player" , "ScriptArea_3" , true , 1);
 }
 
 remove the ; from void onEnter(), when you create a function you NEVER put ; behind that. This is also the case for if statements, for loops etc.
 
 It should look like:
 
 void OnEnter()
 {
 AddEntityCollideCallback("Player" , "ScriptArea_3" , true , 1);
 }
 
 |  |  
	| 01-06-2011, 12:45 PM |  |  
	
		| ThePaSch   Member
 
 Posts: 108
 Threads: 11
 Joined: Sep 2010
 Reputation: 
0
 | 
			| RE: Error: Unexpected token { 
 
				void OnStart(){
 AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
 AddUseItemCallback("", "Elevator_key", "elevator_door_1", "KeyOnDoor", true);
 }
 
 void MonsterFunc1(string &in asParent , string &in asChild , int alState)
 {
 SetEntityActive("servant_grunt_1" , true);
 }
 
 void KeyOnDoor(string &in asItem, string &in asEntity)
 {
 SetSwingDoorLocked("elevator_door_1", false, true);
 PlaySoundAtEntity("", "unlock_door.snt", "elevator_door_1", 0.0f, true);
 }
 |  |  
	| 01-06-2011, 03:10 PM |  |  
	
		| Neatherblade   Junior Member
 
 Posts: 19
 Threads: 5
 Joined: Jan 2011
 Reputation: 
0
 | 
			| RE: Error: Unexpected token { 
 
				Its working now, thanks all    |  |  
	| 01-06-2011, 03:45 PM |  |  |