Once I get that upgrade to 36-hour days, I will tackle that. – Mychaeel
Difference between revisions of "Timing"
Line 1: | Line 1: | ||
{{stub}} | {{stub}} | ||
− | ''' | + | '''Timing''' is a family of functions using which you can schedule other functions to be called asynchronously |
+ | at a interval. Only <code>SetTimer</code> exists in UT2004. | ||
− | + | == Functions == | |
+ | === SetTimer === | ||
<uscript> | <uscript> | ||
− | function SetTimer( | + | native final function SetTimer( |
float inRate, | float inRate, | ||
optional bool inbLoop, // not optional in UT2004 | optional bool inbLoop, // not optional in UT2004 | ||
Line 12: | Line 14: | ||
optional Object inObj // doesn't exist in UT2004 | optional Object inObj // doesn't exist in UT2004 | ||
);</uscript> | );</uscript> | ||
− | + | Sets a timer to call the given function at a set interval. Defaults to calling the 'Timer' event if no function is specified. If inRate is set to 0.f it will effectively disable the previous timer. | |
* <code>inRate</code> - time interval, in gameplay seconds. If <code>inRate <= 0.0</code>, it'll reset the timer. <!-- will calling SetTimer override previous timer? or it'll create another one? --> | * <code>inRate</code> - time interval, in gameplay seconds. If <code>inRate <= 0.0</code>, it'll reset the timer. <!-- will calling SetTimer override previous timer? or it'll create another one? --> | ||
* <code>inbLoop<code> - if false, it'll fire only once. Default to false. | * <code>inbLoop<code> - if false, it'll fire only once. Default to false. | ||
* <code>inTimerFunc</code> - function name. | * <code>inTimerFunc</code> - function name. | ||
− | * <code>inObj</code> - | + | * <code>inObj</code> - unknown. |
+ | |||
+ | === ClearTimer === | ||
+ | <uscript> | ||
+ | native final function ClearTimer( | ||
+ | optional Name inTimerFunc='Timer', | ||
+ | optional Object inObj | ||
+ | );</uscript> | ||
+ | Clears a previously set timer. | ||
+ | * <code>inTimerFunc</code> - function name. | ||
+ | * <code>inObj</code> - unknown. | ||
+ | |||
+ | === IsTimerActive === | ||
+ | <uscript> | ||
+ | native final function bool IsTimerActive( | ||
+ | optional Name inTimerFunc='Timer', | ||
+ | optional Object inObj); | ||
+ | </uscript> | ||
+ | Checks is specified timer is active. | ||
+ | * <code>inTimerFunc</code> - function name. | ||
+ | * <code>inObj</code> - unknown. | ||
+ | |||
+ | === GetTimerCount === | ||
+ | <uscript> | ||
+ | native final function float GetTimerCount( | ||
+ | optional Name inTimerFunc='Timer', | ||
+ | optional Object inObj | ||
+ | ); | ||
+ | </uscript> | ||
+ | Gets the current count for the specified timer, defaults to 'Timer' if no function is specified. | ||
+ | Returns -1.f if the timer is not currently active. See <code>GetTimerRate</code> below for explanation. | ||
+ | * <code>inTimerFunc</code> - function name. | ||
+ | * <code>inObj</code> - unknown. | ||
+ | |||
+ | === GetTimerRate === | ||
+ | <uscript> | ||
+ | native final function float GetTimerRate( | ||
+ | optional name TimerFuncName = 'Timer', | ||
+ | optional Object inObj | ||
+ | ); | ||
+ | * <code>inTimerFunc</code> - function name. | ||
+ | * <code>inObj</code> - unknown. | ||
+ | </uscript> | ||
+ | Gets the current rate for the specified timer. | ||
+ | <code>GetTimerRate('SomeTimer') - GetTimerCount('SomeTimer')</code> is the time remaining before 'SomeTimer' is called. | ||
+ | In other words, "count" starts at 0, increases, and when it reaches "rate", timer is fired. | ||
== How to make seconds real == | == How to make seconds real == |
Revision as of 07:55, 31 August 2011
This article is a stub. You can help Unreal Wiki by expanding it. |
Timing is a family of functions using which you can schedule other functions to be called asynchronously at a interval. Only SetTimer
exists in UT2004.
Contents
Functions
SetTimer
native final function SetTimer( float inRate, optional bool inbLoop, // not optional in UT2004 optional Name inTimerFunc='Timer', // doesn't exist in UT2004 optional Object inObj // doesn't exist in UT2004 );
Sets a timer to call the given function at a set interval. Defaults to calling the 'Timer' event if no function is specified. If inRate is set to 0.f it will effectively disable the previous timer.
inRate
- time interval, in gameplay seconds. IfinRate <= 0.0
, it'll reset the timer.inbLoop
- if false, it'll fire only once. Default to false.inTimerFunc
- function name.inObj
- unknown.
ClearTimer
native final function ClearTimer( optional Name inTimerFunc='Timer', optional Object inObj );
Clears a previously set timer.
inTimerFunc
- function name.inObj
- unknown.
IsTimerActive
native final function bool IsTimerActive( optional Name inTimerFunc='Timer', optional Object inObj);
Checks is specified timer is active.
inTimerFunc
- function name.inObj
- unknown.
GetTimerCount
native final function float GetTimerCount( optional Name inTimerFunc='Timer', optional Object inObj );
Gets the current count for the specified timer, defaults to 'Timer' if no function is specified. Returns -1.f if the timer is not currently active. See GetTimerRate
below for explanation.
inTimerFunc
- function name.inObj
- unknown.
GetTimerRate
native final function float GetTimerRate( optional name TimerFuncName = 'Timer', optional Object inObj ); * <code>inTimerFunc</code> - function name. * <code>inObj</code> - unknown.
Gets the current rate for the specified timer. GetTimerRate('SomeTimer') - GetTimerCount('SomeTimer')
is the time remaining before 'SomeTimer' is called. In other words, "count" starts at 0, increases, and when it reaches "rate", timer is fired.
How to make seconds real
Multiply rate by WorldInfo.TimeDilation
. Of course, this method isn't absolutely reliable, as TimeDilation may change before timer fires.