Skip to main content

math_counter

math_counter icon

Point Entity

Holds a numeric value and performs arithmetic operations upon it. If either the minimum or maximum legal value is nonzero, OutValue will be clamped to the legal range, and the OnHitMin/OnHitMax outputs will be fired at the appropriate times. If both min and max are set to zero, no clamping is performed and only the OutValue output will be fired.

Keyvalues

  • Start Disabled (StartDisabled) <Boolean>

  • Entity Scripts (vscripts) <ScriptList>
    Name(s) of script files that are executed after all entities have spawned.

  • Name (targetname) <TargetSource>
    The name that other entities refer to this entity by.

  • Initial Value (startvalue) <Integer>
    Starting value for the counter.

  • Minimum Legal Value (min) <Integer>
    Minimum legal value for the counter. If min=0 and max=0, no clamping is performed.

  • Maximum Legal Value (max) <Integer>
    Maximum legal value for the counter. If min=0 and max=0, no clamping is performed.

Inputs

  • Enable <Void>
    Enable this entity.

  • Disable <Void>
    Disable this entity.

  • RunScriptFile <String>
    Load and execute a script file

  • RunScriptCode <String>
    Execute a fragment of script code

  • CallScriptFunction <String>
    Call a script function

  • CallPrivateScriptFunction <String>
    Calls a script function from this entity's private script scope.

  • CallGlobalScriptFunction <String>
    Calls a script function in the global script scope.

  • Kill <Void>
    Removes this entity from the world.

  • KillHierarchy <Void>
    Removes this entity and all its children from the world.

  • KillConstrained <Void>
    Removes this entity, all its children, and anything constrained to it, from the world.

  • AddOutput <String>
    Adds an entity I/O connection to this entity. Parameter format: outputname>targetname>inputname>parameter>delay>max times to fire (-1 == infinite). Very dangerous, use with care.

  • FireUser1 <Void>
    Causes this entity's OnUser1 output to be fired.

  • FireUser2 <Void>
    Causes this entity's OnUser2 output to be fired.

  • FireUser3 <Void>
    Causes this entity's OnUser3 output to be fired.

  • FireUser4 <Void>
    Causes this entity's OnUser4 output to be fired.

  • Add <Integer>
    Add an amount to the counter and fire the OutValue output with the result.

  • Divide <Integer>
    Divide the counter by an amount and fire the OutValue output with the result.

  • Multiply <Integer>
    Multiply the counter by an amount and fire the OutValue output with the result.

  • SetValue <Integer>
    Set the counter to a new value and fire the OutValue output with the result.

  • SetValueNoFire <Integer>
    Set the counter to a new value without firing any outputs.

  • Subtract <Integer>
    Subtract an amount from the counter and fire the OutValue output with the result.

  • SetHitMax <Integer>
    Set the upper bound of the counter and fire the OutValue output with the current value.

  • SetHitMin <Integer>
    Set the lower bound of the counter and fire the OutValue output with the current value.

  • GetValue <Void>
    Causes the counter fire its OnGetValue output with the current value of the counter. Used for polling the counter when you don't want constant updates from the OutValue output.

Outputs

  • OnUser1 <Void>
    Fired in response to FireUser1 input.

  • OnUser2 <Void>
    Fired in response to FireUser2 input.

  • OnUser3 <Void>
    Fired in response to FireUser3 input.

  • OnUser4 <Void>
    Fired in response to FireUser4 input.

  • OnKilled <Void>
    Fired when the entity is killed and removed from the game. Parameter is the inflictor.

  • OutValue <Integer>
    Fired when the counter value changes.

  • OnHitMin <Void>
    Fired when the counter value meets or goes below the min value. The counter must go back above the min value before the output will fire again.

  • OnHitMax <Void>
    Fired when the counter value meets or exceeds the max value. The counter must go below the max value before the output will fire again.

  • OnChangedFromMin <Void>
    Fired when the counter value changes from the minimum value.

  • OnChangedFromMax <Void>
    Fired when the counter value changes from the max value.

  • OnGetValue <Integer>
    Fired in response to the GetValue input. Used for polling the counter when you don't want constant updates from the OutValue output.