This article's documentation is for anything that uses the Source engine. Click here for more information.

Logic multicompare: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Categorized)
(CompareValues is variant but doesn't seem to use it for anything. Not sure if worth specifying)
 
(30 intermediate revisions by 15 users not shown)
Line 1: Line 1:
{{wrongtitle|title=logic_multicompare}}
{{LanguageBar}}
{{CD|CLogicCompareInteger|file1=logicentities.cpp}}
{{this is a|logical entity|name=logic_multicompare|sprite=1}}


==Entity Description==
Compares a set of inputs to each other. If they are all the same, fires an <code>OnEqual</code>. If any are different, fires the <code>OnNotEqual</code>.
'''Entity Name:''' logic_multicompare


Compares a set of inputs to each other. If they are all the same, fires an OnEqual output. If any are different, fires the OnNotEqual output.
This entity has an internal list of integers that it has received from any inputValue input's. Any values sent to this entity, must be sent as an integer or boolean because "if it can't be converted" the entity will "just throw it away" (Source Code comment from dev's). Currently, there is no way to clear this 'list', so the entity is not reusable.


==Entity Values==
== Keyvalues ==
===Keys===
{{KV Targetname}}
{{KV|Integer Value (optional)|intn=IntegerValue|integer|Initial integer value.}}
{{KV|Should use Integer Value|intn=ShouldComparetoValue|boolean|If set, compare inputs against Integer Value.}}


* '''Name''' ''targetname <target_source>''
== Inputs ==
** The name that other entities refer to this entity by.
{{I|InputValue|Input value|param=variant}}
* '''Integer Value (optional)''' ''IntegerValue <integer>''
{{I|CompareValues|param=variant|Compares the values and fires appropriate outputs}}
** Initial value for the integer value.
* '''Should use Integer Value''' ''ShouldComparetoValue <choices>''
** If '''Yes''', compare inputs against '''Integer Value'''.


== Outputs ==
{{O|OnEqual|activator = activator of input causing this|param=void|Fires if the values are equal}}
{{O|OnNotEqual|activator = activator of input causing this|param=void|Fires if the values are not equal}}


===Inputs===
== See Also ==
* {{ent|logic_compare}}


* '''Kill'''
[[Category:IO System]]
** Removes this entity from the world.
* '''KillHierarchy''' 
** Removes this entity and all its children from the world.
* '''AddOutput''' ''<output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire (-1 == infinite)>''
** Adds an entity I/O connection to this entity. Very dangerous, use with care
* '''FireUser1'''
** Causes this entity's OnUser1 output to be fired.
* '''FireUser2'''
** Causes this entity's OnUser2 output to be fired.
* '''FireUser3'''
** Causes this entity's OnUser3 output to be fired.
* '''FireUser4'''
** Causes this entity's OnUser4 output to be fired.
* '''InputValue <integer>'''
** Input value
* '''CompareValues'''
** Compares the values and fires appropriate outputs
 
 
===Outputs===
 
* '''OnUser1'''
** Fired in response to FireUser1 input.
* '''OnUser2'''
** Fired in response to FireUser2 input.
* '''OnUser3'''
** Fired in response to FireUser3 input.
* '''OnUser4'''
** Fired in response to FireUser4 input.
* '''OnEqual'''
** Fires if the values are equal
* '''OnNotEqual'''
** Fires if the values are not equal
 
[[Category:Entities]]

Latest revision as of 01:59, 6 May 2025

English (en)中文 (zh)Translate (Translate)
C++ Class hierarchy
CLogicCompareInteger
CLogicalEntity
CServerOnlyEntity
CBaseEntity
C++ logicentities.cpp
Logic multicompare.png

logic_multicompare is a logical entity available in all Source Source games.

Compares a set of inputs to each other. If they are all the same, fires an OnEqual. If any are different, fires the OnNotEqual.

This entity has an internal list of integers that it has received from any inputValue input's. Any values sent to this entity, must be sent as an integer or boolean because "if it can't be converted" the entity will "just throw it away" (Source Code comment from dev's). Currently, there is no way to clear this 'list', so the entity is not reusable.

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

Integer Value (optional) (IntegerValue) <integer>
Initial integer value.
Should use Integer Value (ShouldComparetoValue) <boolean>
If set, compare inputs against Integer Value.

Inputs

InputValue <variantRedirectInput/variant>
Input value
CompareValues <variantRedirectInput/variant>
Compares the values and fires appropriate outputs

Outputs

OnEqual <void>
!activator = activator of input causing this
!caller = this entity
Fires if the values are equal
OnNotEqual <void>
!activator = activator of input causing this
!caller = this entity
Fires if the values are not equal

See Also