| 
		
	
		| willochill   Member
 
 Posts: 73
 Threads: 27
 Joined: Apr 2011
 Reputation: 
0
 | 
			| Script File crashing 
 
				so i just started scripting one of my maps and i went on it to test it and it's crashing and saying this error:FATAL ERROR: Could not load script file (blahbitty blah, map file name)
 main (5,1) :ERR :Unexpected token '{'
 
 Can you take a look at my script so far and see what ive done wrong?
 
 
 void OnStart()
 {
 PlayMusic("amb_guardian.ogg", true, 1.0f, 0, 0, true);
 }
 {
 AddUseItemCallback("", "bone_saw_2", "wooden_boards_block_1", "SawGruntAlert", true);
 }
 void SawGruntAlert(string &in asItem, string &in asEntity)
 {
 SetEntityActive("wooden_boards_block_1", false);
 SetEntityActive("wooden_boards_block_broken_1", true);
 PlaySoundAtEntity("", "23_saw2.snt", "Player", 0, false);
 AddTimer("", 1, "TimerFunc");
 AddTimer("", 1, "TimerFunc2");
 }
 void TimerFunc(string &in asTimer)
 {
 SetEntityActive("servant_grunt_1", true);
 }
 void TimerFunc2(string &in asTimer)
 {
 StopSound("23_saw2.snt", 0f);
 }
 
 |  |  
	| 05-28-2011, 02:28 AM |  |  
	
		| Tanshaydar   From Beyond
 
 Posts: 3,085
 Threads: 17
 Joined: Mar 2009
 Reputation: 
67
 | 
			| RE: Script File crashing 
 
				void OnStart(){
 PlayMusic("amb_guardian.ogg", true, 1.0f, 0, 0, true);
 }
 {
 AddUseItemCallback("", "bone_saw_2", "wooden_boards_block_1", "SawGruntAlert", true);
 }
 
 So, bold characters are completely needless. {'s are to open and close function blocks. Like in:
 void TimerFunc2(string &in asTimer)
 {
 StopSound("23_saw2.snt", 0f);
 }
 
 See, void TimerFunc2(string &in asTimer) is the header, and { & } is to open and close the function block.
 
 |  |  
	| 05-28-2011, 02:44 AM |  |  
	
		| willochill   Member
 
 Posts: 73
 Threads: 27
 Joined: Apr 2011
 Reputation: 
0
 | 
			| RE: Script File crashing 
 
				okay, well i deleted the bold characters there and understand your point but now its saying the same error except like this:main(20,32) : ERR : Expected ')' or ','
 help?!?!?!?
 |  |  
	| 05-28-2011, 03:31 AM |  |  
	
		| Tanshaydar   From Beyond
 
 Posts: 3,085
 Threads: 17
 Joined: Mar 2009
 Reputation: 
67
 | 
			| RE: Script File crashing 
 
				StopSound("23_saw2.snt", 0f);
 0.0f or just 0
 
 |  |  
	| 05-28-2011, 11:10 AM |  |  
	
		| willochill   Member
 
 Posts: 73
 Threads: 27
 Joined: Apr 2011
 Reputation: 
0
 | 
			| RE: Script File crashing 
 
				
  (05-28-2011, 11:10 AM)Tanshaydar Wrote:  StopSound("23_saw2.snt", 0f);
 0.0f or just 0
 
didn't do anything, just says the same error message.
			 
				
(This post was last modified: 05-28-2011, 03:59 PM by willochill.)
 |  |  
	| 05-28-2011, 03:58 PM |  |  
	
		| Tanshaydar   From Beyond
 
 Posts: 3,085
 Threads: 17
 Joined: Mar 2009
 Reputation: 
67
 | 
			| RE: Script File crashing 
 
				Can you post your script again?
			 
 |  |  
	| 05-28-2011, 03:58 PM |  |  
	
		| willochill   Member
 
 Posts: 73
 Threads: 27
 Joined: Apr 2011
 Reputation: 
0
 | 
			| RE: Script File crashing 
 
				void OnStart(){
 PlayMusic("amb_guardian.ogg", true, 1.0f, 0, 0, true);
 AddUseItemCallback("", "bone_saw_2", "wooden_boards_block_1", "SawGruntAlert", true);
 }
 void SawGruntAlert(string &in asItem, string &in asEntity)
 {
 SetEntityActive("wooden_boards_block_1", false);
 SetEntityActive("wooden_boards_block_broken_1", true);
 PlaySoundAtEntity("", "23_saw2.snt", "Player", 0, false);
 AddTimer("", 1.0f, "TimerFunc");
 AddTimer("", 1.0f, "TimerFunc2");
 }
 void TimerFunc(string &in asTimer)
 {
 SetEntityActive("servant_grunt_1", true);
 }
 void TimerFunc2(string &in asTimer)
 {
 StopSound("23_saw2.snt", 0f);
 }
 |  |  
	| 05-28-2011, 04:00 PM |  |  
	
		| Kyle   Posting Freak
 
 Posts: 911
 Threads: 36
 Joined: Sep 2010
 Reputation: 
7
 | 
			| RE: Script File crashing 
 
				Don't tell me, the StopSound command won't work. 
Give the PlaySoundAtEntity a name.
 
Example:
 
PlaySoundAtEntity("Sound01", "23_saw2.snt", "Player", 0, false);
 
Then the StopSound.
 
StopSound("Sound01", 0);
 
Try this:
 void OnStart(){
 PlayMusic("amb_guardian.ogg", true, 1, 0, 0, true);
 AddUseItemCallback("", "bone_saw_2", "wooden_boards_block_1", "SawGruntAlert", true);
 }
 void SawGruntAlert(string &in asItem, string &in asEntity)
 {
 SetEntityActive("wooden_boards_block_1", false);
 SetEntityActive("wooden_boards_block_broken_1", true);
 PlaySoundAtEntity("Sound01", "23_saw2.snt", "Player", 0, false);
 AddTimer("", 1.0f, "TimerFunc");
 }
 void TimerFunc(string &in asTimer)
 {
 SetEntityActive("servant_grunt_1", true);
 StopSound("Sound01", 0);
 }
 
				
(This post was last modified: 05-28-2011, 04:08 PM by Kyle.)
 |  |  
	| 05-28-2011, 04:04 PM |  |  
	
		| Kyle   Posting Freak
 
 Posts: 911
 Threads: 36
 Joined: Sep 2010
 Reputation: 
7
 | 
			| RE: Script File crashing 
 
				Try this: void OnStart(){
 PlayMusic("amb_guardian.ogg", true, 1, 0, 0, true);
 AddUseItemCallback("", "bone_saw_2", "wooden_boards_block_1", "SawGruntAlert", true);
 }
 void SawGruntAlert(string &in asItem, string &in asEntity)
 {
 SetEntityActive("wooden_boards_block_1", false);
 SetEntityActive("wooden_boards_block_broken_1", true);
 PlaySoundAtEntity("Sound01", "23_saw2.snt", "Player", 0, false);
 AddTimer("", 1.0f, "TimerFunc");
 }
 void TimerFunc(string &in asTimer)
 {
 SetEntityActive("servant_grunt_1", true);
 StopSound("Sound01", 0);
 }
 |  |  
	| 05-28-2011, 04:07 PM |  |  
	
		| willochill   Member
 
 Posts: 73
 Threads: 27
 Joined: Apr 2011
 Reputation: 
0
 | 
			| RE: Script File crashing 
 
				okay i get it, it works now. but im still having issues with another script, for a different map. this time the error message says:main (21,1) :ERR :Expected expression value
 main (27,1) :ERR :Expected expression value
 here's the script:
 void OnStart()
 {
 AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0.0f, "");
 AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0.0f, "");
 AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0.0f, "");
 AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 4.0f, "");
 AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0.0f, "");
 AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0.0f, "");
 AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0.0f, "");
 AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 2.0f, "");
 AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0.0f, "");
 AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0.0f, "");
 AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_14", 0.0f, "");
 AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_15", 2.0f, "");
 AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_16", 0.0f, "");
 AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_17", 2.0f, "");
 AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_18", 0.0f, "");
 AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_19", 0.0f, "");
 AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_20", 0.0f, "");
 AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_21", 2.0f, "");
 AddEntityCollideCallback("Player", "AreaActivateGrunt", "Func01", true, 1);
 AddEntityCollideCallback("servant_grunt_1", "AreaDisableGrunt", "Func02", false, 1);
 PlayMusic("00_creak.ogg", true, 1.0f, 0, 0, true);
 }
 void Func01(string &in asParent, string &in asChild, int alState)
 {
 if (HasItem("lantern_1") == true)
 {
 SetEntityActive("servant_grunt_1", true);
 }
 }
 void Func02(string &in asParent, string &in asChild, int alState)
 {
 SetEntityActive("servant_grunt_1", false);
 }
 
				
(This post was last modified: 05-28-2011, 04:17 PM by willochill.)
 |  |  
	| 05-28-2011, 04:12 PM |  |  |