Logic timer: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Robot: fixing template case.)
(cleanup)
Line 1: Line 1:
{{wrongtitle|title=logic_timer}}
[[File:Logic timer.png|left]] {{DISPLAYTITLE:logic_timer}} __NOTOC__
{{base_point}}


==Entity Description==
{{base point|logic_timer}} It fires an [[output]] at regular or random intervals. It can optionally alternate between a "high" and a"low" output.
[[Image:{{PAGENAME}}.png|right]]An entity that fires a timer event at regular, or random, intervals. It can also be set to oscillate between a high and low end, in which case it will fire alternating high/low outputs each time it fires.
* An oscillator's first output will be an OnTimerHigh output.
* Use with [[logic_case]] for extremely random events.
* Could be used to deploy [[env_headcrabcanister]]s at random intervals, instead of using fixed delays on the inputs.{{clr}}


==Keyvalues==
{{note|Enabling the entity resets its timer.}}


* {{KV Targetname}}
{{tip|Use with [[logic_case]] for extremely random events.}}


* {{KV EnableDisable}}
==KeyValues==


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


==Flags==
==Flags==


* 1 : Oscillator (alternates between OnTimerHigh and OnTimerLow outputs)
* Oscillator (Alternates between <code>OnTimerHigh</code> and <code>OnTimerLow</code> outputs. <code>OnTimerHigh</code> comes first.)


==Inputs==
==Inputs==


* {{I Targetname}}
; <code>Toggle</code>
* {{I EnableDisable}}
: Toggle the timer on or off, resetting it in the process.
 
; <code>RefireTime <[[int]]></code>
* '''Toggle'''
: Set a new refire interval.
: Toggle the timer on/off.
; <code>FireTimer</code>
 
* '''RefireTime <integer>'''
: Set a new Refire Interval.
 
* '''FireTimer'''
: Force the timer to fire immediately.
: Force the timer to fire immediately.
 
; <code>LowerRandomBound <[[float]]></code>
* '''LowerRandomBound <float>'''
; <code>UpperRandomBound <float></code>
: Set a new Minimum Random Interval.
: Set a new min/max random interval.
 
; {{EP2 add|<code>ResetTimer</code>}}
* '''UpperRandomBound <float>'''
: Starts counting from zero. You could also use <code>enable</code>.
: Set a new Maximum Random Interval.
; {{EP2 add|<code>AddToTimer <float></code>}}
 
; {{EP2 add|<code>SubtractFromTimer <float></code>}}
* '''{{EP2 add|ResetTimer}}'''
: Adds/removes time if the timer is enabled. No effect if disabled.
* '''{{EP2 add|AddToTimer <float>}}'''
; {{EP2 add|<code>UseRandomTime</code>}}
* '''{{EP2 add|SubtractFromTimer <float>}}'''
{{I EnableDisable}}
* '''{{EP2 add|UseRandomTime}}'''
{{I Targetname}}


==Outputs==
==Outputs==


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

Revision as of 11:22, 22 July 2009

Logic timer.png

Template:Base point It 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 <bool>
Makes the entity fire at random intervals. Range of values is restricted by the next two KVs.
Minimum Random Interval <float>
Maximum Random Interval <float>
If "Use Random Time" is enabled, these values define the range of values, in seconds, that the entity can choose from for random firing.
Refire Interval <float>
If "Use Random Time" is disabled, this is the interval between outputs in seconds.
Start Disabled (StartDisabled) <boolean>
Stay dormant until activated (with theEnableinput).
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

Flags

  • Oscillator (Alternates between OnTimerHigh and OnTimerLow outputs. OnTimerHigh comes first.)

Inputs

Toggle
Toggle the timer on or off, resetting it in the process.
RefireTime <int>
Set a new refire interval.
FireTimer
Force the timer to fire immediately.
LowerRandomBound <float>
UpperRandomBound <float>
Set a new min/max random interval.
Template:EP2 add
Starts counting from zero. You could also use enable.
Template:EP2 add
Template:EP2 add
Adds/removes time if the timer is enabled. No effect if disabled.
Template:EP2 add

EnableDisable:

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


Outputs

OnTimer
Fired when a non-oscillating timer expires.
OnTimerHigh
OnTimerLow
Alternatively fired every time an oscillating timer expires, starting with OnTimerHigh.