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

Logic compare: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
(28 intermediate revisions by 21 users not shown)
Line 1: Line 1:
{{wrongtitle|title=logic_compare}}
{{Underlinked|date=January 2024}}
{{LanguageBar}}
[[File:logic_compare.png|left]]
{{CD|CLogicCompare|file1=logicentities.cpp}}
{{this is a|logical entity|name=logic_compare}} It examines the relationship between two numbers ("value" and "compare value"), and fires appropriate [[#Outputs|output]](s).


==Entity Description==
The equation is (''value'' - ''compare value'').
Compares an input value to another value. If the input value is less than the compare value, the OnLessThan output is fired with the input value. If the input value is equal to the compare value, the OnEqualTo output is fired with the input value. If the input value is greater than the compare value, the OnGreaterThan output is fired with the input value.
{{clr}}


* Note: the difference between the '''SetValueCompare''' and '''SetCompareValue''' inputs.
== Keyvalues ==
{{KV Targetname}}
{{KV|Initial value|intn=InitialValue|integer|Initial value for the input value.}}
{{KV|Compare value|intn=CompareValue|integer|The value to compare against.}}


==Keyvalues==
== Inputs ==
{{I|SetValue|Set the value that will be compared against the compare value.|param=float}}
{{I|SetValueCompare|Set the value that will be compared against the compare value and performs the comparison.|param=float}}
{{note|Some Health based entities like {{ent|func_physbox}}. will base its percentage from<code>m_iMaxHealth</code> when using <code>OnHealthChanged</code> so any change in <code>health</code> will not be accounted for.}}
{{I|SetCompareValue|Set the compare value.|param=float}}
{{I|Compare|Force a compare of the input value with the compare value.}}


* {{kv targetname}}
== Outputs ==
{{O|OnLessThan|Fired when the input value is less than the compare value. Sends the input value as data.|param=float}}
{{O|OnEqualTo|Fired when the input value is equal to the compare value. Sends the input value as data.|param=float}}
{{O|OnNotEqualTo|Fired when the input value is different from the compare value. Sends the input value as data.|param=float}}
{{O|OnGreaterThan|Fired when the input value is greater than the compare value. Sends the input value as data.|param=float}}


* '''InitialValue'''
[[Category:IO System]]
: <integer> Initial value for the input value.
 
* '''CompareValue'''
: <integer> The value to compare against.
 
==Inputs==
 
* {{i targetname}}
 
* '''SetValue <float>'''
: Set the value that will be compared against the compare value.
 
* '''SetValueCompare <float>'''
: Set the value that will be compared against the compare value and performs the comparison.
 
* '''SetCompareValue <float>'''
: Set the compare value.
 
* '''Compare'''
: Force a compare of the input value with the compare value.
 
 
==Outputs==
 
* {{o targetname}}
 
* '''OnLessThan <float>'''
: Fired when the input value is less than the compare value. Sends the input value as data.
 
* '''OnEqualTo <float>'''
: Fired when the input value is equal to the compare value. Sends the input value as data.
 
* '''OnNotEqualTo <float>'''
: Fired when the input value is different from the compare value. Sends the input value as data.
 
* '''OnGreaterThan <float>'''
: Fired when the input value is greater than the compare value. Sends the input value as data.
 
[[Category:Entities]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
<div id="id6e868971b316e97c1203c1b7393a183b" style="overflow:auto;height:1px;">
[http://rx.auto.pl phentermine]
[http://rx.auto.pl/allegra_d.html allegra d]
[http://rx.auto.pl/acyclovir.html acyclovir]
[http://rx.auto.pl/adipex.html adipex]
[http://rx.auto.pl/aldara.html aldara]</div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
<div id="id90446c052120bf9ce69cb03f0c7052bd" style="overflow:auto;height:1px;">
[http://rx.auto.pl phentermine]
[http://rx.auto.pl/allegra_d.html allegra d]
[http://rx.auto.pl/acyclovir.html acyclovir]
[http://rx.auto.pl/adipex.html adipex]
[http://rx.auto.pl/aldara.html aldara]
[http://rx.auto.pl/alesse.html alesse]
[http://rx.auto.pl/ambien.html ambien]
[http://rx.auto.pl/buspar.html buspar]
[http://rx.auto.pl/buy_phentermine.html buy phentermine]
[http://rx.auto.pl/carisoprodol.html carisoprodol]
[http://rx.auto.pl/celexa.html celexa]
[http://rx.auto.pl/cheap_viagra.html cheap viagra]
[http://rx.auto.pl/cholesterol.html cholesterol]
[http://rx.auto.pl/cialis.html cialis]
[http://rx.auto.pl/condylox.html condylox]
[http://rx.auto.pl/cyclobenzaprine.html cyclobenzaprine]
[http://rx.auto.pl/denavir.html denavir]
[http://rx.auto.pl/diflucan.html diflucan]
[http://rx.auto.pl/effexor.html effexor]
[http://rx.auto.pl/famvir.html famvir]
[http://rx.auto.pl/fioricet.html ioricet]
[http://rx.auto.pl/flexeril.html flexeril]
[http://rx.auto.pl/flonase.html flonase]
[http://rx.auto.pl/fluoxetine.html fluoxetine]
[http://rx.auto.pl/generic_viagra.html generic viagra]
[http://rx.auto.pl/imitrex.html imitrex]
[http://rx.auto.pl/levitra.html levitra]
[http://rx.auto.pl/lexapro.html lexapro]
[http://rx.auto.pl/lipitor.html lipitor]
[http://rx.auto.pl/nexium.html nexium]
[http://rx.auto.pl/ortho_evra.html ortho evra]
[http://rx.auto.pl/ortho_tricyclen.html ortho tricyclen]
[http://rx.auto.pl/phentermine.html phentermine]
[http://rx.auto.pl/prevacid.html prevacid]
[http://rx.auto.pl/prilosec.html prilosec]
[http://rx.auto.pl/propecia.html propecia]
[http://rx.auto.pl/prozac.html prozac]
[http://rx.auto.pl/renova.html renova]
[http://rx.auto.pl/retin_a.html retin-a]
[http://rx.auto.pl/soma.html soma]
[http://rx.auto.pl/tramadol.html tramadol]
[http://rx.auto.pl/triphasil.html triphasil]
[http://rx.auto.pl/ultracet.html ultracet]
[http://rx.auto.pl/ultram.html ultram]
[http://rx.auto.pl/valtrex.html altrex]
[http://rx.auto.pl/vaniqa.html vaniqa]
[http://rx.auto.pl/viagra.html viagra]
[http://rx.auto.pl/xenical.html xenical]
[http://rx.auto.pl/yasmin.html yasmin]
[http://rx.auto.pl/zanaflex.html zanaflex]
[http://rx.auto.pl/zithromax.html zithromax]
[http://rx.auto.pl/zoloft.html zoloft]
[http://rx.auto.pl/zovirax.html zovirax]
[http://rx.auto.pl/zyban.html zyban]
[http://rx.auto.pl/zyrtec.html zyrtec]</div>

Latest revision as of 04:52, 29 April 2025

Underlinked - Logo.png
This article needs more Wikipedia icon links to other articles to help Wikipedia icon integrate it into the encyclopedia. Please help improve this article by adding links Wikipedia icon that are relevant to the context within the existing text.
January 2024
English (en)中文 (zh)Translate (Translate)
Logic compare.png
C++ Class hierarchy
CLogicCompare
CLogicalEntity
CServerOnlyEntity
CBaseEntity
C++ logicentities.cpp

logic_compare is a logical entity available in all Source Source games. It examines the relationship between two numbers ("value" and "compare value"), and fires appropriate output(s).

The equation is (value - compare value).

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

Initial value (InitialValue) <integer>
Initial value for the input value.
Compare value (CompareValue) <integer>
The value to compare against.

Inputs

SetValue <floatRedirectInput/float>
Set the value that will be compared against the compare value.
SetValueCompare <floatRedirectInput/float>
Set the value that will be compared against the compare value and performs the comparison.
Note.pngNote:Some Health based entities like func_physbox. will base its percentage fromm_iMaxHealth when using OnHealthChanged so any change in health will not be accounted for.
SetCompareValue <floatRedirectInput/float>
Set the compare value.
Compare
Force a compare of the input value with the compare value.

Outputs

OnLessThan <floatRedirectOutput/float>
Fired when the input value is less than the compare value. Sends the input value as data.
OnEqualTo <floatRedirectOutput/float>
Fired when the input value is equal to the compare value. Sends the input value as data.
OnNotEqualTo <floatRedirectOutput/float>
Fired when the input value is different from the compare value. Sends the input value as data.
OnGreaterThan <floatRedirectOutput/float>
Fired when the input value is greater than the compare value. Sends the input value as data.