Logic compare: 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_compare}}
[[File:{{PAGENAME}}.png|left|alt=|link=]]
{{base_point}}


==Entity Description==
{{base point|logic_compare}} It examines the relationship between two numbers ("value" and "compare value"), and fires appropriate [[#Outputs|output]](s).


[[Image:{{PAGENAME}}.png|left]]Compares an input value to another value, and fires an output depending on if the input value is equal to, greater than, less than, or not equal to, the compare value, sending the input value as data.
The equation is (''value'' - ''compare value'').
 
Note the difference between the '''SetValueCompare''' and '''SetCompareValue''' inputs.


==Keyvalues==
==Keyvalues==


* {{KV Targetname}}
; <code>InitialValue <[[int]]></code>
 
: Initial value to compare.
* '''InitialValue'''
; <code>CompareValue <int></code>
: <integer> Initial value for the input value.
: The value to compare against.
 
{{KV Targetname}}
* '''CompareValue'''
: <integer> The value to compare against.


==Inputs==
==Inputs==


* {{I Targetname}}
; <code>SetValue <[[float]]></code>
 
: Set the value that will be compared.
* '''SetValue <float>'''
; <code>SetValueCompare <float></code>
: Set the value that will be compared against the compare value.
: Set the value to compare, then perform a comparison.
 
; <code>SetCompareValue <float></code>
* '''SetValueCompare <float>'''
: Set the value to compare against
: Set the value that will be compared against the compare value and performs the comparison.
; <code>Compare</code>
 
: Perform a comparison.
* '''SetCompareValue <float>'''
{{I Targetname}}
: Set the compare value.
 
* '''Compare'''
: Force a compare of the input value with the compare value.
 


==Outputs==
==Outputs==


* {{O Targetname}}
; <code>OnEqualTo <[[float]]></code>
 
; <code>OnNotEqualTo <float></code>
* '''OnEqualTo <float>'''
; <code>OnGreaterThan <float></code>
: Fired when the input value is equal to the compare value. Sends the input value as data.
; <code>OnLessThan <float></code>
 
: The appropriate output(s) are fired when the <code>Compare</code> or <code>SetValueCompare</code> input is received. Each pass the input value.
* '''OnGreaterThan <float>'''
{{O Targetname}}
: Fired when the input value is greater than the compare value. Sends the input value as data.
 
* '''OnLessThan <float>'''
: Fired when the input value is less than 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.

Revision as of 07:44, 7 January 2010

Template:Base point It examines the relationship between two numbers ("value" and "compare value"), and fires appropriate output(s).

The equation is (value - compare value).

Keyvalues

InitialValue <int>
Initial value to compare.
CompareValue <int>
The value to compare 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

SetValue <float>
Set the value that will be compared.
SetValueCompare <float>
Set the value to compare, then perform a comparison.
SetCompareValue <float>
Set the value to compare against
Compare
Perform a comparison.


Outputs

OnEqualTo <float>
OnNotEqualTo <float>
OnGreaterThan <float>
OnLessThan <float>
The appropriate output(s) are fired when the Compare or SetValueCompare input is received. Each pass the input value.