ComfyUI > Nodes > TrentNodes > Number Counter

ComfyUI Node: Number Counter

Class Name

CUN_NumberCounter

Category
Trent/Utilities
Author
TrentHunter82 (Account age: 0days)
Extension
TrentNodes
Latest Updated
2026-03-20
Github Stars
0.03K

How to Install TrentNodes

Install this extension via the ComfyUI Manager by searching for TrentNodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter TrentNodes in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Number Counter Description

CUN_NumberCounter manages numerical sequences by incrementing, decrementing, and resetting values.

Number Counter:

The CUN_NumberCounter node is a versatile utility designed to manage and manipulate numerical sequences within your AI art projects. Its primary function is to increment or decrement numbers based on user-defined parameters, allowing for dynamic control over numerical values. This node is particularly useful for tasks that require iterative processes, such as generating sequences or managing counters in a creative workflow. By offering various modes of operation, including incrementing, decrementing, and resetting, the CUN_NumberCounter provides flexibility and precision in handling numbers. Its ability to maintain state across different operations ensures consistency and reliability, making it an essential tool for artists looking to automate and streamline their numerical tasks.

Number Counter Input Parameters:

number_type

The number_type parameter determines the format of the number being processed, with options for either integer or float. This choice affects the precision of the counter, where integer provides whole numbers and float allows for decimal values. Selecting the appropriate type is crucial for ensuring the desired level of detail in your numerical operations.

mode

The mode parameter specifies the operation to be performed on the number. Options include increment, decrement, increment_to_stop, decrement_to_stop, and reset_after_stop. Each mode dictates how the counter will behave, such as continuously increasing or decreasing, stopping at a specified value, or resetting after reaching a limit. This flexibility allows for tailored control over the numerical sequence.

start

The start parameter sets the initial value of the counter. It accepts a FLOAT with a default of 0, and a range from -1e18 to 1e18. This parameter is essential for defining the starting point of your numerical sequence, ensuring that the counter begins at the desired value.

stop

The stop parameter defines the endpoint for operations that involve stopping conditions, such as increment_to_stop or decrement_to_stop. It accepts a FLOAT with a default of 100, and a range from -1e18 to 1e18. This parameter is crucial for controlling when the counter should cease its operation, providing a boundary for the sequence.

step

The step parameter determines the increment or decrement value for each operation. It accepts a FLOAT with a default of 1, and a range from 0 to 1e6. This parameter is vital for controlling the rate of change in the counter, allowing for fine-tuned adjustments to the numerical sequence.

reset_bool

The reset_bool parameter is an optional input that, when set to a value greater than or equal to 1, resets the counter to the start value. This parameter is useful for scenarios where you need to restart the sequence, ensuring that the counter can be reset as needed.

unique_id

The unique_id parameter is a hidden input used to maintain the state of the counter across different operations. It ensures that each counter instance is tracked separately, allowing for multiple independent counters to operate simultaneously without interference.

Number Counter Output Parameters:

number

The number output provides the current value of the counter in the format specified by the number_type parameter. This output is essential for retrieving the processed numerical value, which can be used in subsequent operations or displayed as needed.

float

The float output always returns the current value of the counter as a floating-point number, regardless of the number_type setting. This output is useful for scenarios where a consistent decimal representation is required, ensuring precision in numerical operations.

int

The int output provides the current value of the counter as an integer, regardless of the number_type setting. This output is beneficial for tasks that require whole numbers, offering a straightforward representation of the counter's value.

Number Counter Usage Tips:

  • Use the increment_to_stop and decrement_to_stop modes to create bounded sequences that automatically stop at a specified value, ideal for loops or iterations that require a defined endpoint.
  • Leverage the reset_bool parameter to easily restart your counter from the beginning, which is particularly useful in scenarios where you need to repeat a sequence multiple times.
  • Assign unique values to the unique_id parameter when using multiple counters simultaneously to ensure each counter maintains its own state and operates independently.

Number Counter Common Errors and Solutions:

"Cannot get line by index from an empty file."

  • Explanation: This error occurs when attempting to access a line from a file that has not been loaded or is empty.
  • Solution: Ensure that the file is properly loaded and contains data before attempting to access its lines.

"Index {safe_idx} is out of bounds for file with {len(self.lines)} lines."

  • Explanation: This error indicates that the specified index is outside the range of available lines in the file.
  • Solution: Verify that the index is within the valid range of lines in the file, and adjust it accordingly to prevent out-of-bounds access.

Number Counter Related Nodes

Go back to the extension to check out more related nodes.
TrentNodes
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

Number Counter