| 
		
	
		| Obsolete   Junior Member
 
 Posts: 5
 Threads: 3
 Joined: Jul 2015
 Reputation: 
0
 | 
			| Script crash 
 
				Hi,
 I edited a script file for my custom story, but now it crashes.
 There seems to be something wrong with my Addtimer functions, but I have no idea what's the cause.
 
 ERROR:
 
 main (33,2): ERR : No matching signatures to 'AddTimer(string@&, const uint, TeleportToArea1)'
 main (40,2): ERR : No matching signatures to 'AddTimer(string@&, const uint, TeleportToArea2)'
 
 Script File:
 
 void OnStart()
 {
 AddUseItemCallback("", "Cellarkey", "Cellardoor", "UseCellarkeyOnCellardoor", true);
 
 PlayMusic("amb_tomb.ogg", true, 0.6, 4, 1, false);
 
 AddEntityCollideCallback("Player", "AreaMemento1", "AddMemento1", true, 1);
 AddEntityCollideCallback("Player", "AreaMemento2", "AddMemento2", true, 1);
 AddEntityCollideCallback("Player", "FinishQuest", "Reward", true, 1);
 SetEntityPlayerInteractCallback("LadderInteractArea1", "Teleport1", false);
 SetEntityPlayerInteractCallback("LadderInteractArea2", "Teleport2", false);
 }
 
 void UseCellarkeyOnCellardoor(string &in asItem, string &in asEntity)
 {
 SetSwingDoorLocked("Cellardoor", false, true);
 RemoveItem(asItem);
 }
 
 void AddMemento1(string &in asParent, string &in asChild, int alState)
 {
 AddQuest("area1", "enterarea1");
 }
 
 void AddMemento2(string &in asParent, string &in asChild, int alState)
 {
 AddQuest("area2", "enterarea2");
 }
 
 void Teleport1(string &in asEntity)
 {
 FadeOut(1);
 AddTimer("Timer1", 2, TeleportToArea1);
 
 }
 
 void Teleport2(string &in asEntity)
 {
 FadeOut(1);
 AddTimer("Timer2", 2, TeleportToArea2);
 }
 
 void TeleportToArea1(string &in asTimer)
 {
 TeleportPlayer("Area1");
 FadeIn(1);
 RemoveTimer("Timer1");
 }
 
 void TeleportToArea2(string &in asTimer)
 {
 TeleportPlayer("Area2");
 FadeIn(1);
 RemoveTimer("Timer2");
 }
 
 void Reward(string &in asParent, string &in asChild, int alState)
 {
 CompleteQuest("area1", "enterarea1");
 CompleteQuest("area2", "enterarea2");
 GiveSanityBoost();
 }
 
 Can someone please help me with this?
 |  |  
	| 08-15-2015, 10:50 AM |  |  
	
		| Spelos  Banned
 
 Posts: 231
 Threads: 19
 Joined: Sep 2014
 | 
			| RE: Script crash 
 
				You need to have the third parameter of the timer script in quotation marks AddTimer("Timer1", 2, TeleportToArea1); 
Change it to
 AddTimer("Timer1", 2, "TeleportToArea1"); 
And do that for all of your timers.
			 |  |  
	| 08-15-2015, 11:21 AM |  |  
	
		| Obsolete   Junior Member
 
 Posts: 5
 Threads: 3
 Joined: Jul 2015
 Reputation: 
0
 | 
			| RE: Script crash 
 
				 (08-15-2015, 11:21 AM)Spelos Wrote:  You need to have the third parameter of the timer script in quotation marks
 
 AddTimer("Timer1", 2, TeleportToArea1); 
Change it to
 
 
 AddTimer("Timer1", 2, "TeleportToArea1"); 
And do that for all of your timers.
 
Lol that I did not see that mistake. Anyways, thank you very much!    |  |  
	| 08-15-2015, 12:28 PM |  |  
	
		| 7heDubz   Posting Freak
 
 Posts: 1,329
 Threads: 40
 Joined: Feb 2013
 Reputation: 
41
 | 
			| RE: Script crash 
 
				So that you can try to figure out the error on your own from now on,  
These two lines, 
 main (33,2): ERR : No matching signatures to 'AddTimer(string@&, const uint, TeleportToArea1)'main (40,2): ERR : No matching signatures to 'AddTimer(string@&, const uint, TeleportToArea2)'
Tell you where your error is.   Line 33, 2 characters over, is one error. and line 40 2 characters over is another.
			
 |  |  
	| 08-15-2015, 07:20 PM |  |  
	
		| FlawlessHappiness   Posting Freak
 
 Posts: 3,980
 Threads: 145
 Joined: Mar 2012
 Reputation: 
171
 | 
			| RE: Script crash 
 
				 (08-15-2015, 07:20 PM)7heDubz Wrote:  So that you can try to figure out the error on your own from now on, 
 These two lines,
 
 Tell you where your error is.   Line 33, 2 characters over, is one error. and line 40 2 characters over is another.main (33,2): ERR : No matching signatures to 'AddTimer(string@&, const uint, TeleportToArea1)'main (40,2): ERR : No matching signatures to 'AddTimer(string@&, const uint, TeleportToArea2)'
 
Adding to this: 
Sometimes the error shows a place later than where the actual error is. This is because that's where the script registered the error. 
So it's not always exactly there, but close by.
 
...unless you get the "Unexpected end of file". This error always shows in the end of the script, because something has been opened and not closed again.
 
This could be:
 
A bracket: { 
Closed with: }
 
Quotation mark: " 
Closed with: "
 
Parenthesies: ( 
Closed with: )
			 
 Trying is the first step to success. |  |  
	| 08-15-2015, 07:26 PM |  |  |