Logic timer: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Undo revision 124045 by Gmc.jimmy (Talk) - No need for an edit war)
(Cleanup)
Line 1: Line 1:
[[File:Logic timer.png|left]] {{DISPLAYTITLE:logic_timer}} __NOTOC__
{{base point|logic_timer}}


{{base point|logic_timer}} It fires an [[output]] at regular or random intervals. It can optionally alternate between a "high" and a"low" output.
== Entity description ==
[[File:logic_timer.png|left|link=]]
An entity that fires an [[output]] at regular or random intervals. It can optionally alternate between a "high" and a "low" output.


{{note|Enabling the entity resets its timer.}}
{{note|Enabling the entity resets its timer.}}
Line 7: Line 9:
{{tip|Use with [[logic_case]] for extremely random events.}}
{{tip|Use with [[logic_case]] for extremely random events.}}


==KeyValues==
{{clr}}


; Use Random Time <code><[[bool]]></code>
== Keyvalues ==
: Makes the entity fire at random intervals. Range of values is restricted by the next two KVs.
{{KV|Use Random Time|boolean|Makes the entity fire at random intervals. Range of values is restricted by the next two KVs. }}
; Minimum Random Interval <code><[[float]]></code>
{{KV|Minimum Random Interval|string|If "Use Random Time" is set, this is the minimum time between timer fires. The time will be a random number between this and the "Maximum Random Interval".}}
; Maximum Random Interval <code><float></code>
{{KV|Maximum Random Interval|string|If "Use Random Time" is set, this is the maximum time between timer fires. The time will be a random number between the "Minimum Random Interval" and this.}}
: If "Use Random Time" is enabled, these values define the range of values, in seconds, that the entity can choose from for random firing.
{{KV|Refire Interval|string|If "Use Random Time" isn't set, this is the time between timer fires, in seconds.}}
; Refire Interval <code><float></code>
{{KV Targetname}}
: If "Use Random Time" is disabled, this is the interval between outputs in seconds.
{{KV EnableDisable}}
{{KV EnableDisable}}
{{KV Targetname}}


==Flags==
== Flags ==
* 1 : Oscillator (alternates between <code>OnTimerHigh</code> and <code>OnTimerLow</code> outputs)


* Oscillator (Alternates between <code>OnTimerHigh</code> and <code>OnTimerLow</code> outputs. <code>OnTimerHigh</code> comes first.)
== Inputs ==
 
{{IO|RefireTime|Set a new Refire Interval.|param=integer}}
==Inputs==
{{IO|ResetTimer|Reset the timer. It will fire after the Refire Interval expires.}}
 
{{IO|FireTimer|Force the timer to fire immediately.}}
; <code>Toggle</code>
{{IO|Enable|Enable the timer.}}
: Toggle the timer on or off, resetting it in the process.
{{IO|Disable|Disable the timer.}}
; <code>RefireTime <[[int]]></code>
{{IO|Toggle|Toggle the timer on/off.}}
: Set a new refire interval.
{{IO|LowerRandomBound|Set a new Minimum Random Interval.|param=float}}
; <code>FireTimer</code>
{{IO|UpperRandomBound|Set a new Maximum Random Interval.|param=float}}
: Force the timer to fire immediately.
{{IO|AddToTimer|Add time to the timer if it is currently enabled.  Does not change the Refire Interval.|param=float}}
; <code>LowerRandomBound <[[float]]></code>
{{IO|SubtractFromTimer|Subtract time from the timer if it is currently enabled. Does not change the Refire Interval.|param=float}}
; <code>UpperRandomBound <float></code>
{{I Targetname}}
: Set a new min/max random interval.
; {{EP2 add|<code>ResetTimer</code>}}
: Starts counting from zero. You could also use <code>enable</code>.
; {{EP2 add|<code>AddToTimer <float></code>}}
; {{EP2 add|<code>SubtractFromTimer <float></code>}}
: Adds/removes time if the timer is enabled. No effect if disabled.
; {{EP2 add|<code>UseRandomTime</code>}}
{{I EnableDisable}}
{{I EnableDisable}}
{{I Targetname}}
==Outputs==


; <code>OnTimer</code>
== Outputs ==
: Fired when a non-oscillating timer expires.
{{IO|OnTimer|Fired when the timer expires.}}
; <code>OnTimerHigh</code>
{{IO|OnTimerHigh|Fired every other time for an oscillating timer.}}
; <code>OnTimerLow</code>
{{IO|OnTimerLow|Fired every other time for an oscillating timer.}}
: Alternatively fired every time an oscillating timer expires, starting with <code>OnTimerHigh</code>.
{{O Targetname}}
{{O Targetname}}

Revision as of 00:04, 9 June 2011

Template:Base point

Entity description

Logic timer.png

An entity that fires an output at regular or random intervals. It can optionally alternate between a "high" and a "low" output.

Note.pngNote:Enabling the entity resets its timer.
Tip.pngTip:Use with logic_case for extremely random events.

Keyvalues

Use Random Time ([todo internal name (i)]) <boolean>
Makes the entity fire at random intervals. Range of values is restricted by the next two KVs.
Minimum Random Interval ([todo internal name (i)]) <string>
If "Use Random Time" is set, this is the minimum time between timer fires. The time will be a random number between this and the "Maximum Random Interval".
Maximum Random Interval ([todo internal name (i)]) <string>
If "Use Random Time" is set, this is the maximum time between timer fires. The time will be a random number between the "Minimum Random Interval" and this.
Refire Interval ([todo internal name (i)]) <string>
If "Use Random Time" isn't set, this is the time between timer fires, in seconds.
Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Start Disabled (StartDisabled) <boolean>
Stay dormant until activated (with theEnableinput).

Flags

  • 1 : Oscillator (alternates between OnTimerHigh and OnTimerLow outputs)

Inputs

RefireTime <integerRedirectInput/integer>
Set a new Refire Interval.
ResetTimer
Reset the timer. It will fire after the Refire Interval expires.
FireTimer
Force the timer to fire immediately.
Enable
Enable the timer.
Disable
Disable the timer.
Toggle
Toggle the timer on/off.
LowerRandomBound <floatRedirectInput/float>
Set a new Minimum Random Interval.
UpperRandomBound <floatRedirectInput/float>
Set a new Maximum Random Interval.
AddToTimer <floatRedirectInput/float>
Add time to the timer if it is currently enabled. Does not change the Refire Interval.
SubtractFromTimer <floatRedirectInput/float>
Subtract time from the timer if it is currently enabled. Does not change the Refire Interval.

EnableDisable:

Enable / Disable
Enable/disable this entity from performing its task. It might also disappear from view.

Outputs

OnTimer
Fired when the timer expires.
OnTimerHigh
Fired every other time for an oscillating timer.
OnTimerLow
Fired every other time for an oscillating timer.