Counter

The **Counter Nodon** is a Middle Nodon that stores a number to output, which may be altered based on input.

When unpausing from a long pause in Free Programming, it may say "IF AT FIRST YOU DO NOT SUCCEED, TRY TRY TRY TRY TRY TRY TRY TRY AGAIN.". In the Nodopedia, its quote is "IF THERE ARE NUMBERS, I WILL COUNT THEM. AND I WILL REMEMBER.".

## Calling

This Nodon can be called through the following tree.

* Middle
	+ Flag/Counter/Random
		- **Counter**

## Character

### Design

it is a blue digital timer with yellow eyes that that can display 2 digits

## Technical

Despite the fact that the 'Starting Value' and 'Count Range' settings are restricted to only use whole numbers, the value stored by the counter can hold decimal places.

The names of this Nodon's input ports are displayed, even when unselected, in the Nodon's box on the program screen Canvas when zoomed in far enough. The value of this Nodon's output port is also constantly displayed in its box on the program screen Canvas.

### Inputs

* **Count up** - If the 'Count Timing' setting is "On change from 0", when this input changes from 0.00 to something else, the value will have its decimals truncated, then be added to the stored value (rounded up when truncating would result in 0.00). If the 'Count Timing' setting is instead "While not 0", the exact value received at this port will be added to the stored value every frame.
	+ When the 'Mode' setting is "Bounce", and an edge would be surpassed, this port will subtract instead of add, until another end is reached or the counter is reset *[explain how this functions when the end values aren't reached exactly]*.
* **Count down** - If the 'Count Timing' setting is "On change from 0", when this input changes from 0.00 to something else, the value will have with its decimals truncated, then be subtracted from the stored value (rounded away from zero when truncating would result in 0.00). If the 'Count Timing' is instead "While not 0", the exact value received at this port will be subtracted from the stored value every frame.
	+ When the 'Mode' setting is "Bounce", and an edge would be surpassed, this port will add instead of subtract, until another end is reached or the counter is reset *[explain how this functions when the end values aren't reached exactly]*.
* **Reset** - When a signal other than 0.00 is received in this port, the stored value will reset to the value set in the 'Starting Value' setting. This also resets how the 'Count up' and 'Count down' ports act when it comes to "Bounce" mode.

### Settings

* **Starting Value** - Determines what number will be initially stored in the counter when the game begins, and the value that it will reset to when a signal is received in the 'Reset' port. Can be any whole number between -1000 and 1000.
	+ Defaults to 0.
* **Mode** - Determines how the counter interacts with the range defined in its 'Count Range' setting. If set to "No limit", the stored value will have no restrictions. If set to "Range", attempting to cause the stored value to be outside of the range defined in the 'Count Range' setting will cause it to instead be set to the nearest edge. If set to "Loop", the stored value loops arounds the range when it reaches an end. If set to "Bounce", when the value would surpass an end, the roles of the 'Count up' and 'Count down' ports are reversed until an end would be surpassed again or the counter is reset *[explain how this functions when the end values aren't reached exactly]*.
	+ Defaults to "No limit".
* **Count Range** - Determines the range of values that the stored value must stay between.
	+ Is unavailable if the 'Mode' setting is set to "No limit".
	+ Defaults to a range from 0 to 1000, but is also unavailable by default due to the default selection of the 'Mode' setting.
* **Count Timing** - Determines how the stored value should be incremented and decremented. When it is set to "On change from 0", the stored value will increase/decrease by the input values received with their decimals truncated (rounded up when truncating would result in 0.00), when the input received at the corresponding port changes from 0.00 to something else. When it is set to "While not 0", the exact values received at the 'Count up' and 'Count down' ports will be added to/subtracted from the stored value every frame.
	+ Defaults to "While not 0".