GetSecondsPassed

Revision as of 08:27, 15 June 2006 by imported>JOG

Syntax:

GetSecondsPassed 

Returns the number of seconds passed since the last game frame (in float). Extremely useful for running a timer within a script. Each script has its own counter for GetSecondsPassed and when the function is called, this counter is automatically reset to 0. Thus, all subsequent calls within the same frame and script will return 0.


Example:

float timer

begin gamemode

if timer > 0
   set timer to timer - GetSecondsPassed
else
   ; time's up! Do something.
endif

end


Example Two:

 float timer1
 float timer2
 
 begin gamemode
 set timer1 to getsecondspassed  ;This returns the time passed since the last frame
 set timer2 to getsecondspassed  ;This returns zero

 end