counter
Description
Outputs the current count of bang message constrained to a specified range. Can be set to count up, down, or up-then-down.
Examples
Arguments
options [int]
If there is only one argument, it sets an initial maximum count value for counter. If there are two arguments, the first number sets an initial minimum value, and the second number sets an initial maximum value. If there are three arguments, the first number specifies the direction of the count, the second number is the minimum, and the third number is the maximum. If there are no arguments, the direction is up, the minimum is 0, and the maximum is 2,147,483,647 (the largest possible 32-bit signed integer).
Attributes
carryflag [int]
Sets the type of data output from the third outlet (numbers or bangs).
Possible values:
0 = 'Numeric'
1 = 'Bang'
compatmode [int]
Provides compatibility when importing patches created with versions 3.x and earlier of Max. When "Ancient" is selected, sending an int to inlets 3 and 4 will change the min count instead of just resetting it temporarily (which causes the fourth inlet to behave exactly as thought the counter object).
Possible values:
0 = 'Current'
1 = 'Ancient'
Common Box Attributes
annotation [symbol]
Sets the text that will be displayed in the Clue window when the user moves the mouse over the object.
background [int] (default: 0)
Adds or removes the object from the patcher's background layer.
adds the object to the background layer, removes it. Objects in the background layer are shown behind all objects in the default foreground layer.color [4 floats]
Sets the color for the object box outline.
fontface [int]
Sets the type style used by the object. The options are:
plain
bold
italic
bold italic
Possible values:
0 = 'regular'
1 = 'bold'
2 = 'italic'
3 = 'bold italic'
fontname [symbol]
Sets the object's font.
fontsize [float]
Sets the object's font size (in points).
Possible values:
'8'
'9'
'10'
'11'
'12'
'13'
'14'
'16'
'18'
'20'
'24'
'30'
'36'
'48'
'64'
'72'
hidden [int] (default: 0)
Toggles whether an object is hidden when the patcher is locked.
hint [symbol]
Sets the text that will be displayed in as a pop-up hint when the user moves the mouse over the object in a locked patcher.
ignoreclick [int] (default: 0)
Toggles whether an object ignores mouse clicks in a locked patcher.
jspainterfile [symbol]
JS Painter File
patching_rect [4 floats] (default: 0. 0. 100. 0.)
Sets the position and size of the object in the patcher window.
position [2 floats]
Sets the object's x and y position in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its size unchanged.
presentation [int] (default: 0)
Sets whether an object belongs to the patcher's presentation.
presentation_rect [4 floats] (default: 0. 0. 0. 0.)
Sets the x and y position and width and height of the object in the patcher's presentation, leaving its patching position unchanged.
rect [4 floats]
Sets the x and y position and width and height of the object in both patching and presentation modes (if the object belongs to its patcher's presentation).
size [2 floats]
Sets the object's width and height in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its position unchanged.
textcolor [4 floats]
Sets the color for the object's text in RGBA format.
textjustification [int]
Sets the justification for the object's text.
Possible values:
0 = 'left'
1 = 'center'
2 = 'right'
varname [symbol]
Sets the patcher's scripting name, which can be used to address the object by name in pattr, scripting messages to thispatcher, and the js object.
Messages
bang
In left-middle inlet: Changes the direction of the count.
In middle inlet: Resets the count to its specified minimum value, which will be sent out the next time a is received in the left inlet.
In right-middle inlet: Resets the count to its specified minimum value, and sends out that value immediately.
In right inlet: Resets the count to its specified maximum value, which is sent out immediately.
int
Arguments
In left-middle inlet: Sets the direction of the count. causes counter to count up, causes it to count down, and causes it to count up and down.
In middle inlet: The number sets the counter to a new value, to be sent out the next time a is received in the left inlet. If the number is less than the current minimum value, the minimum will be reset to that number. If the number is greater than the current maximum value, the counter will be set to that number, but the maximum value actually remains the same and the minimum is set equal to the maximum.
In middle-right inlet: The number sets the counter to a new value and sends it out immediately. If the number is less than the current minimum value, the minimum will be reset to that number. If the number is greater than the current maximum value, the number is sent out, but the maximum value actually remains the same and the minimum is set equal to the maximum.
In right inlet: Resets the maximum value sent out by counter. If the number is less than the current minimum, the maximum is equal to the minimum. If the minimum is subsequently changed to a value below the maximum value you input, the counter objects retains the correct maximum value it received through this inlet. Unlike a message, an int in this inlet does not cause the counter object to output anything.
float
Arguments
carrybang
carryint
dec
down
flags
Arguments
minimum-mode [int]
goto
Arguments
inc
jam
Arguments
max
Arguments
min
Arguments
next
set
Arguments
setmin
Arguments
state
up
updown
Output
bang
Out left-middle outlet: If a
Out right-middle outlet: If a message has been received in the left inlet, then when the count is moving upward and reaches the maximum limit, a is sent out (instead of the number which is sent out by default). When the count leaves the maximum limit, nothing is sent out. This only works in mode 0 (count up) or mode 2 (count up and down).
int
Out left outlet: When
When the direction is up, or up and down, counter begins counting from the specified minimum value. When the direction is down, counter begins from the maximum value.
Out left-middle outlet: When the count is moving downward and reaches the minimum limit, the number is sent out. When the count leaves the minimum limit, is sent out. This only works in mode 1 (count down) or mode 2 (count up and down).
Out right-middle outlet: When the count is moving upward and reaches the maximum limit, the number is sent out. When the count leaves the maximum limit, is sent out. This only works in mode 0 (count up) or mode 2 (count up and down).
Out right outlet: An additional count is kept of the number of times counter reaches its maximum limit. Each time the maximum is reached, that count is sent out.
See Also
Name | Description |
---|---|
tempo | Output numbers at a metronomic tempo |
Max Basic Tutorial 11: Procedural Drawing | Max Basic Tutorial 11: Procedural Drawing |