how to delay counting speed? 
	 
	
		| Author | 
		Message | 
	 
		 
		ChenWei
 
 
 
    
		 | 
		
		
			
				  Posted: Thu Jan 13, 2011 10:07 am    Post subject: how to delay counting speed?  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Hi, Im making a game for some reason, and I dont know how to slow down my program's counting speed
 
I tried to use "delay", but it delayed entire program's speed
 
i want to make it count from 60 to 1(about 1 second for 1), so what can I do to it? | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	 
	 
		  | 
	 
				 
		TokenHerbz
 
  
 
    
		 | 
		
		
			
				  Posted: Thu Jan 13, 2011 10:41 am    Post subject: RE:how to delay counting speed?  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
					  | code: | 	 		  
 
var counter: int := 0
 
loop
 
    counter += 1
 
    put counter
 
    Time.Delay(1000)  %%Time FCN uses MILISECONDS, 1000 = 1 second.
 
    exit when counter = 60
 
end loop
 
put "HAS THIS BEEN CLOSE TO 1 MIN?"
 
  | 	 
  | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		DemonWasp
 
 
 
    
		 | 
		
		
			
				  Posted: Thu Jan 13, 2011 10:46 am    Post subject: RE:how to delay counting speed?  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				You really need to fill out the form:
 
 
What have you tried, what did it do, what did you want it to do, and what code did you use? | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		chrisbrown
 
  
 
    
		 | 
		
		
			
				  Posted: Thu Jan 13, 2011 11:00 am    Post subject: Re: how to delay counting speed?  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				Three things you need to know:
 
 
1) [A number of milliseconds] div 1000 is a number of seconds.
 
 
2) Time.Elapsed returns the number of milliseconds since your program started running.
 
 
3) If, somewhere in your program, you have 	  | code: | 	 		  var startTime : int := Time.Elapsed  | 	  
 
 then Time.Elapsed - startTime is the number of milliseconds that have elapsed since you set startTime.
 
 
 
This information and a bit of easy math is all you need, no delay necessary. | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		TokenHerbz
 
  
 
    
		 | 
		
		
			
				  Posted: Thu Jan 13, 2011 5:17 pm    Post subject: RE:how to delay counting speed?  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				lol do i win for creativity?
 
 
	  | code: | 	 		  
 
var sec: int := 0
 
loop
 
    if round(Time.Elapsed / 1000) > sec then
 
        sec += 1
 
        put sec
 
    end if
 
    exit when sec = 60
 
end loop
 
put "Thats a MIN!"
 
  | 	 
  | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		 | 
	 
 
	
	
	 
	
	 |