| 
		
	
		| Icaab2607   Junior Member
 
 Posts: 34
 Threads: 13
 Joined: Mar 2013
 Reputation: 
0
 | 
			|  Where 
 
				Where here error?    
void OnStart() 
{ 
    AddEntityCollideCallback("Player", "InsanityHall", "FuncInsanityHall", false, 0); 
}
 
void FuncInsanityHall(string &in asParent, string &in asChild, int alState) 
{ 
    if(alState == 1) { 
        SetLocalVarFloat("init_sanity", GetPlayerSanity()); 
        AddTimer("start_drain", 0.01, "SanityDrain"); 
    } 
    if(alState == -1) { 
        SetPlayerSanity(GetLocalvarFloat("init_sanity")); 
        RemoveTimer("drain_loop"); 
        RemoveTimer("start_drain"); 
    } 
}
 
void SanityDrain(string &in asTimer) 
{ 
    if(asTimer == "start_drain") return; 
    if(GetPlayerSanity() > 20) GiveSanityDamage(5, false); 
    AddTimer("drain_loop", 1, "SanityDrain"); 
}
			 |  |  
	| 04-26-2013, 01:14 PM |  |  
	
		| xxxxxxxxxxxxxxxx   Posting Freak
 
 Posts: 935
 Threads: 0
 Joined: Jun 2012
 Reputation: 
54
 | 
			| RE: Where 
 
				Well, what does the error message say? It usually tells you which line doesn't work and what kind of error it is.
			 |  |  
	| 04-26-2013, 01:27 PM |  |  
	
		| PutraenusAlivius   Posting Freak
 
 Posts: 4,713
 Threads: 75
 Joined: Dec 2012
 Reputation: 
119
 | 
			| RE: Where 
 
				You should get an error message saying what line that's wrong.
			 
 "Veni, vidi, vici.""I came, I saw, I conquered."
 |  |  
	| 04-26-2013, 01:45 PM |  |  
	
		| Romulator   Not Tech Support ;-)
 
 Posts: 3,628
 Threads: 63
 Joined: Jan 2013
 Reputation: 
195
 | 
			| RE: Where 
 
				 (04-26-2013, 01:14 PM)Icaab2607 Wrote:  void SanityDrain(string &in asTimer){
 if(asTimer == "start_drain") return;
 if(GetPlayerSanity() > 20) GiveSanityDamage(5, false);
 AddTimer("drain_loop", 1, "SanityDrain");
 }
 
You have an if that is not bracketed.  
Try changing it to this:
 void SanityDrain(string &in asTimer){
 if(asTimer == "start_drain") return;
 if(GetPlayerSanity() > 20)
 {
 GiveSanityDamage(5, false);
 AddTimer("drain_loop", 1, "SanityDrain");
 }
 }
 
And also, in your 12th line, where it says
 Quote:if(alState == -1) 
You can make it "else". So it looks like this:
 
 Discord: Romulator#0001
![[Image: 3f6f01a904.png]](https://puu.sh/zOxJg/3f6f01a904.png) |  |  
	| 04-26-2013, 02:07 PM |  |  
	
		| Tomato Cat   Senior Member
 
 Posts: 287
 Threads: 2
 Joined: Sep 2012
 Reputation: 
20
 | 
			| RE: Where 
 
				Quote:And also, in your 12th line, where it says
 Quote:if(alState == -1) You can make it "else". So it looks like this:
 
 
 
You're thinking of else if. =p An else if statement will execute if the condition before it isn't true.
 
An else statement will execute if no previous condition is true.
 
*edit*
 
Just replace it with this.
 void FuncInsanityHall(string &in asParent, string &in asChild, int alState){
 if(alState == 1)
 {
 SetLocalVarFloat("init_sanity", GetPlayerSanity());
 AddTimer("start_drain", 0.01, "SanityDrain");
 AddDebugMessage("Adding start_drain",false);
 }
 
 else if(alState == -1)
 {
 SetPlayerSanity(GetLocalVarFloat("init_sanity"));
 RemoveTimer("drain_loop");
 RemoveTimer("start_drain");
 AddDebugMessage("Removing timers",false);
 }
 }
 
 void SanityDrain(string &in asTimer)
 {
 if(asTimer == "start_drain")
 {
 if(GetPlayerSanity() > 20)
 {
 GiveSanityDamage(5, false);
 AddDebugMessage("Giving sanity damage",false);
 }
 }
 
 else if(asTimer == "drain_loop")
 {
 if(GetPlayerSanity() > 20)
 {
 GiveSanityDamage(5, false);
 AddDebugMessage("Giving sanity damage",false);
 AddDebugMessage("Player sanity at "+GetPlayerSanity(),false);
 }
 }
 AddTimer("drain_loop", 1, "SanityDrain");
 AddDebugMessage("Adding drain_loop",false);
 }
 
 
 RAISE YOUR DONGERS ヽ༼ຈل͜ຈ༽ノ 
				
(This post was last modified: 04-26-2013, 03:49 PM by Tomato Cat.)
 |  |  
	| 04-26-2013, 03:22 PM |  |  
	
		| Icaab2607   Junior Member
 
 Posts: 34
 Threads: 13
 Joined: Mar 2013
 Reputation: 
0
 |  |  
	| 04-28-2013, 08:55 AM |  |  
	
		| Tomato Cat   Senior Member
 
 Posts: 287
 Threads: 2
 Joined: Sep 2012
 Reputation: 
20
 | 
			| RE: Where 
 
				Uh, what is it you're trying to do exactly?
			 
 RAISE YOUR DONGERS ヽ༼ຈل͜ຈ༽ノ |  |  
	| 04-28-2013, 02:33 PM |  |  
	
		| PutraenusAlivius   Posting Freak
 
 Posts: 4,713
 Threads: 75
 Joined: Dec 2012
 Reputation: 
119
 | 
			| RE: Where 
 
				 (04-28-2013, 02:33 PM)Mr Credits Wrote:  Uh, what is it you're trying to do exactly? 
I think he wants to swim.
			 
 "Veni, vidi, vici.""I came, I saw, I conquered."
 |  |  
	| 04-28-2013, 02:39 PM |  |  
	
		| Tomato Cat   Senior Member
 
 Posts: 287
 Threads: 2
 Joined: Sep 2012
 Reputation: 
20
 | 
			| RE: Where 
 
				 (04-28-2013, 02:39 PM)JustAnotherPlayer Wrote:   (04-28-2013, 02:33 PM)Mr Credits Wrote:  Uh, what is it you're trying to do exactly? I think he wants to swim.
 
Can that even be done? o.o
			 
 RAISE YOUR DONGERS ヽ༼ຈل͜ຈ༽ノ |  |  
	| 04-28-2013, 02:43 PM |  |  
	
		| Icaab2607   Junior Member
 
 Posts: 34
 Threads: 13
 Joined: Mar 2013
 Reputation: 
0
 | 
			| RE: Where 
 
				Я море знаем, не получилось   .
 
 
I speak that does not work
			
				
(This post was last modified: 04-28-2013, 06:20 PM by Icaab2607.)
 |  |  
	| 04-28-2013, 06:18 PM |  |  |