This article's documentation is for Source 2. Click here for more information.

Logic case (Source 2): Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Create source 2 logic_case page)
 
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{tabs|main=source|source=1|source2=1|logic_case}}
{{tabs|main=source|source=1|source2=1|logic_case}}
{{CD|CLogicCase|file1=logicentities.cpp}}
{{this is a|point entity|name=logic_case|sprite=1|engine=Source 2}} It compares an input to up to 32 configured values, firing a corresponding output if there is a match (on <code>InValue</code>), or fires a random output (on <code>PickRandom</code>). Use [[logic_random_outputs]] for a weighted random output.
{{this is a|point entity|name=logic_case|sprite=1|engine=Source 2}} It compares an input to up to 32 configured values, firing a corresponding output if there is a match (on <code>InValue</code>), or fires a random output (on <code>PickRandom</code>). Use [[logic_random_outputs]] for a weighted random output.
{{Important|This entity stores values ​​as '''strings''', so if you specify one of the case as "1.50", then when you try to compare [[float]] it will not match, because the float will be "1.5", and not "1.50".}}
{{Important|This entity stores values ​​as '''strings''', so if you specify one of the case as "1.50", then when you try to compare [[float]] it will not match, because the float will be "1.5", and not "1.50".}}
Line 10: Line 9:


== Inputs ==
== Inputs ==
{{IO|InValue|Compares the Input value to the case values, and fires the appropriate output, if any.|param=string}}
{{I|InValue|Compares the Input value to the case values, and fires the appropriate output, if any.|param=string}}
{{IO|PickRandom|Fires a random OnCase output with at least one connection.}}
{{I|PickRandom|Fires a random OnCase output with at least one connection.}}
{{IO|PickRandomShuffle|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.}}
{{I|PickRandomShuffle|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.}}
{{IO|ResetShuffle|Starts the shuffle over so that the next PickRandomShuffle can select from all cases.}}
{{I|ResetShuffle|Starts the shuffle over so that the next PickRandomShuffle can select from all cases.}}


== Outputs ==
== Outputs ==
{{IO|OnCase01|to=OnCase32|Fired when the input value equals the corresponding Case value.}}
{{O|OnCase01|to=OnCase32|Fired when the input value equals the corresponding Case value.}}
{{IO|OnDefault|Fired when the input value does not equal any of the Case values.}}
{{O|OnDefault|Fired when the input value does not equal any of the Case values.}}


== See Also ==
== See Also ==
* {{ent|math_counter}}
* {{ent|math_counter}}
[[Category:IO System]]
[[Category:IO System]]

Latest revision as of 11:11, 26 September 2024

Logic case.png

logic_case is a point entity available in all Source 2 Source 2 games. It compares an input to up to 32 configured values, firing a corresponding output if there is a match (on InValue), or fires a random output (on PickRandom). Use logic_random_outputs for a weighted random output.

Icon-Important.pngImportant:This entity stores values ​​as strings, so if you specify one of the case as "1.50", then when you try to compare float it will not match, because the float will be "1.5", and not "1.50".


Keyvalues

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

Case 01 (Case01) to Case 32 (Case32) <string>
The values to test against.

Inputs

InValue <stringRedirectInput/string>
Compares the Input value to the case values, and fires the appropriate output, if any.
PickRandom
Fires 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 cases have been picked, at which point the shuffle starts over.
ResetShuffle
Starts the shuffle over so that the next PickRandomShuffle can select from all cases.

Outputs

OnCase01 to OnCase32
Fired when the input value equals the corresponding Case value.
OnDefault
Fired when the input value does not equal any of the Case values.

See Also