Logic case: 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_case}}
[[File:logic_case.png|left]]
{{base_point}}


== Entity description ==
{{base point|logic_case}} It either compares an input to up to 16 configured values, firing a corresponding output if there is a match (on <code>InValue</code>), or fires a random output (on <code>PickRandom</code>).
[[Image:logic_case.png|right]]


Compares an input to up to 16 preset values. If the input value is the same as any of the preset values, an output corresponding to that value is fired.
{{bug|This entity will not recognize [[float]]s with trailing zeroes (like <code>0.50</code> or <code>1.00</code>). Always remove any.}}


For example: If ''Case01'' is set to <code>2</code> and ''Case02'' is set to <code>5</code>, and the input value is <code>5</code>, the ''OnCase02'' output will be fired.
{{tip|Use with [[logic_timer]] for extremely random events.}}
 
This entity can also be used to select from a number of random targets via the ''PickRandom'' input. One of the ''OnCase'' outputs that is connected to another entity will be picked at random and fired.
 
{{note|This entity will not recognize float values ending in <code>0</code> (like <code>0.50</code> or <code>1.00</code>). Simply remove these.}}
 
* The ideal entity for randomized events.
* Use with [[logic_timer]] for extremely random events.


== Keyvalues ==
== Keyvalues ==
* {{KV Targetname}}


* '''Case''(01-16)'''''
; Case01 <span style="font-weight:normal;">to</span> Case16 <code><[[string]]></code>
: <string>
: The values to test against.
{{KV Targetname}}


== Inputs ==
== Inputs ==
* {{I Targetname}}
* '''InValue <string>'''
: Compare the Input value to the case values, and fire the appropriate output, if any.


* '''PickRandom'''
; <code>InValue <[[string]]></code>
: Fire a random OnCase output with at least one connection.
: Compare an input value to the case values, firing the appropriate output on the first match.
 
; <code>PickRandom</code>
* '''{{EP1 add|PickRandomShuffle}}'''
: Fire a random <code>OnCase</code> output with at least one connection.
: Fires a random OnCase output with at least one connection, with no repeats until all cases have been picked, at which point the shuffle starts over.
; <code>PickRandomShuffle</code>
: Fires a random <code>OnCase</code> output with at least one connection, with no repeats until all have been picked.
{{I Targetname}}


== Outputs ==
== Outputs ==
* {{O Targetname}}
* '''OnCase''(01-16)'''''
: Fired when the input value equals the Case''(01-16)'' value. {{activator|activator}}


* '''OnDefault <string>'''
; <code>OnCase01</code> <span style="font-weight:normal;">to</span> <code>OnCase16</code>
: Fired when the input value does not equal any of the Case values. {{activator|activator}}
: Fired when the input value equals the corresponding Case value.
; <code>OnDefault <[[string]]></code>
: Fired when the input value does not equal any of the Case values. Passes the value on.
{{O Targetname}}

Revision as of 01:53, 1 August 2009

Logic case.png

Template:Base point It either compares an input to up to 16 configured values, firing a corresponding output if there is a match (on InValue), or fires a random output (on PickRandom).

Icon-Bug.pngBug:This entity will not recognize floats with trailing zeroes (like 0.50 or 1.00). Always remove any.  [todo tested in ?]
Tip.pngTip:Use with logic_timer for extremely random events.

Keyvalues

Case01 to Case16 <string>
The values to test against.
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

Inputs

InValue <string>
Compare an input value to the case values, firing the appropriate output on the first match.
PickRandom
Fire a random OnCase output with at least one connection.
PickRandomShuffle
Fires a random OnCase output with at least one connection, with no repeats until all have been picked.


Outputs

OnCase01 to OnCase16
Fired when the input value equals the corresponding Case value.
OnDefault <string>
Fired when the input value does not equal any of the Case values. Passes the value on.