Difference between revisions of "GetSecondsPassed"

147 bytes added ,  15:00, 5 May 2010
See also
imported>Dev akm
(mention ScriptEffectElapsedSeconds)
imported>ZuTheSkunk
(See also)
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
'''Syntax:'''
'''Syntax:'''
  GetSecondsPassed  
  (seconds:float) 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.
Returns the number of seconds passed since the last frame in which the current script was processed (in float). Extremely useful for running a timer within a script. Each script has its own counter for GetSecondsPassed. All calls within the same frame and script will return the same value.




Line 27: Line 27:
   begin gamemode
   begin gamemode
   set timer1 to getsecondspassed  ;This returns the time passed since the last frame
   set timer1 to getsecondspassed  ;This returns the time passed since the last frame
   set timer2 to getsecondspassed  ;This returns zero
   set timer2 to getsecondspassed  ;This returns the same value
   
   
   end
   end


'''Warning''': GetSecondsPassed is unreliable in a ScriptEffect during sleep/wait/fast travel. Use [[ScriptEffectElapsedSeconds]] instead.
== Notes ==
* GetSecondsPassed is unreliable in a ScriptEffect during sleep/wait/fast travel. Use [[ScriptEffectElapsedSeconds]] instead.
 
== See also ==
 
* [[Scripting Tutorial: Creating a Simple Timer]]


[[Category: Functions]]
[[Category: Functions]]
[[Category:Functions (CS)]]
[[Category: Functions (CS 1.0)]]
[[Category: Functions (CS 1.0)]]
[[Category: Time Functions]]
[[Category: Time Functions]]
[[Category: Time Functions (CS 1.0)]]
[[Category: Time Functions (CS 1.0)]]
<!-- Begin Search Terms
Get
Seconds
Passed
End Search Terms -->
Anonymous user