  | 
	
	
	
		takke Beginner
 
  Joined: 11 Oct 2002 Posts: 29 Location: Sweden
  | 
		
		  
			
			   Posted: Sun May 25, 2003 2:13 pm   
  Timer   | 
			 
			
				Last time and posted a mess I was unclear on my problem. This time I have the mess will explain what I want the timer to do.
 
 
I have a protectionspell that I want to keep track of the duration of the spell. Like:
 
You glow with a red glow (on mess) Now I want a timer that counts the second that the spell is active.
 
The glow fades away(off mess) Stop the timer and put the value in a variable.
 
In zmud 6.16 this worked:
 
You mumble the lost mantra of 'Dent Frote' and tune yourself in spiritually.
 
#math dentt %time( hhmm)*60-%time( hh)*2400+%time( ss)-1
 
#var denttime 1
 
#var dent ON
 
ppas >> Shit: [ON] <<
 
 
You feel more tuned to this world.
 
#math current %time( hhmm)*60-%time( hh)*2400+%time( ss)
 
#math denttime @current-@dentt
 
#math dentlast @denttime
 
ppas >> Shit: [OFF] Lasted [@denttime] seconds <<
 
#var denttime OFF
 
 
the timetrigger look like this:
 
*(trigger)
 
#math current %time( hhmm)*60-%time( hh)*2400+%time( ss)
 
#if (@wctime <> "OFF") {#math wctime @current-@wc}
 
#if (@denttime <> "OFF") {#math denttime @current-@dentt}
 
#if (@iwtime <> "OFF") {#math iwtime @current-@iw}
 
#if (@paintime <> "OFF") {#math paintime @current-@pain}
 
#if (@phystime <> "OFF") {#math phystime @current-@phys}
 
 
I hope some1 understands this. | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		Vijilante SubAdmin
  
  Joined: 18 Nov 2001 Posts: 5187
 
  | 
		
		  
			
			   Posted: Sun May 25, 2003 2:56 pm      | 
			 
			
				Since your just looking to record the start of the spell, and display the duration you can use a very simple trigger and variable.
 
 
#VAR ProtStart {0} {0}
 
#TR {You glow with a red glow} {ProtStart=%ctime}
 
#TR {The glow fades away} {ProtDur=%eval((%ctime-@ProtStart));ProtStart=0}
 
 
The variable is set to have a default of 0.  It would be reset to this value when you connect.  If start is non-zero then the spell is active.  So a displaying test would be something like
 
#IF (@ProtStart) {#ECHO Protection lasts another %eval(@ProtDur-%ctime+@ProtStart) seconds.} | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		LightBulb MASTER
 
  Joined: 28 Nov 2000 Posts: 4817 Location: USA
  | 
		
		  
			
			   Posted: Sun May 25, 2003 4:35 pm      | 
			 
			
				The #MATH command in the current version doesn't evaluate the %time function. You have to use %eval.
 
#math dentt %eval( %time( hhmm)*60-%time( hh)*2400+%time( ss)-1)
 
 
Using %ctime, as Vijilante suggests, is probably better.
 
 
 
 
LightBulb
 
Advanced Member | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		| 
		
		 | 
	
	
		 |