math_counter

From Source Entities
Jump to navigation Jump to search

Code classes:

Math counter.png

math_counter is a point entity present in all Source games. It stores a number value which can be manipulated in various ways.

Keyvalues[edit | edit source]

Initial Value (startvalue) <float>
Starting value for the counter.
Minimum Legal Value (min) <float>
Minimum legal value for the counter. If both the minimum and maximum values are set to 0, they will be ignored.
Maximum Legal Value (max) <float>
Maximum legal value for the counter.
Start Disabled (StartDisabled) <boolean>
Stay inactive until Enabled.
Note: When disabled, the stored value will not be changeable. GetValue will still work.

Inputs[edit | edit source]

Add <float>
Adds the parameter value onto the stored number.
Subtract <float>
Subtracts the parameter value from the stored number.
Multiply <float>
Multiplies the stored number by the parameter value.
Divide <float>
Divides the stored number by the parameter value.
SetValue <float>
Sets the stored number.
SetValueNoFire <float>
Sets the stored number without firing any outputs.
SetHitMin <float>
Sets Minimum Legal Value. OnHitMin will fire if appropriate.
SetHitMax <float>
Sets Maximum Legal Value. OnHitMax will fire if appropriate.
GetValue
Fires OnGetValue.
Enable
Makes the entity active.
Disable
Makes the entity inactive.
SetMinValueNoFire <float> (available in all games since P2.png)
Sets Minimum Legal Value without firing any outputs.
SetMaxValueNoFire <float> (available in all games since P2.png)
Sets Maximum Legal Value without firing any outputs.

Outputs[edit | edit source]

OutValue <float>
Fires whenever the stored number changes, except when caused by SetMinValueNoFire, SetMaxValueNoFire, or SetValueNoFire. Automatically puts the stored number as the input parameter, unless overridden by the mapper.
OnHitMin
Fires when the stored number reaches Minimum Legal Value.
OnHitMax
Fires when the stored number reaches Maximum Legal Value.
OnGetValue <float>
Fires when GetValue is sent. Automatically puts the stored number as the input parameter, unless overridden by the mapper.
OnChangedFromMin  (available in all games since Asw.png)
If the stored number has hit Minimum Legal Value, this output fires when it changes.
OnChangedFromMax  (available in all games since Asw.png)
If the stored number has hit Maximum Legal Value, this output fires when it changes.

See Also[edit | edit source]