Counting up numbers

Hello all,

I’m trying to create a simple number counter. My issue is trying to figure out how to get the “Math” to effect text.

The text (numbers) need to start at specific value (example 5,000,000,000) and jump in increments. How would you go about making text count up in increments of a set value. I’m very green at touch designer, so any help would be much appreciated.

Try taking a look at the CHOP value replace par on a text TOP - I think that’ll help you get there.
base_count_to_text_example.tox (1.33 KB)

So that worked, almost. I replaced your button with an lfo to have the number constantly go up. That helped so much. Now I have to figure out how to do a reset button. I figured the reset is on the count1 pulse, but can’t seem to attach a button to it.

You can also reset with the middle input of the Count CHOP.

Take a look here:
base_count_and_reset.tox (1.46 KB)

1 Like

Awesome. So I’m incrementing at 80k per the speed of the lfo. Is there anyway to add commas to the numbers? So instead of 80000 it’s 80,000 and so on.

You can do this by formatting the text.
For this, change the parameter text in the text1 DAT to the following slightly cryptic line of Python code:

'{0:,d}'.format(int(op('null1')[0])) and also set its parameter mode to expression.
base_count_and_reset_thousands_separator.toe (4.36 KB)

  • edit
    OHHHH SNAPPPP! Idz for the win!!!

I don’t know if there’s a way to do this with the CHOP Value replace approach. You can certainly do it with Python though with an expression like:

'{:,d}'.format( int(op('null1')['v1']) )

base_count_and_reset_commas.tox (1.53 KB)

Look here to get a handle on how format works:
pyformat.info/

Here to get a handle on Python in TouchDesigner:
matthewragan.com/teaching-resou … hdesigner/

Thanks guys,

This is amazing. Just getting into this, so every lesson teaches a ton of other info as well. Thank you for taking the time to show me this.

As far as learning materials you might also like:

Elburz Open Source Book
nvoid.gitbooks.io/introduction- … r/content/

Cutmod’s Tutorials:
cutmod.wixsite.com/portfolio/tutorials

The tuts I’ve made:
matthewragan.com/teaching-resou … hdesigner/

Now that we have the numbers counting up by a selectable number and commas in and everything. How hard would it be to have a selectable starting number to count up from? If I launched in Perform mode, and want the number to start counting from (whatever number)?

Is the number user entered or selected from a table?

Probably the thing to consider is building UI bits to handle all of this - not at all a hard thing to do. Depending on how you want it to behave, you may or may not need to dig into some python (if you want floating selection windows for example).

I really don’t know all that touch can do without code. The way that it’s running right now, we can change a the number in the constant to do the adding per button click or lfo cycle. Maybe not a selectable starting number, but one we could just enter in once.

Take a look at this example.
container_count_with_ui.tox (2.42 KB)

Here you have a UI where you can count up, down, and reset. You can also set the increment amount.

Take a look here for how to open a temporary floating UI:
matthewragan.com/2015/03/29/ame … hdesigner/

also, the Count CHOP has a Reset Value.
Set it to the number you want and push the reset button. That’s your starting number.

So I have hit a weirdness with the project. After the numbers go into trillions, (four commas) the numbers stop animating up. Maybe it’s do to the math inside TD is limited after that point?

The Goal is to have the number start at certain number (which works, thanks to you guys) and count up by a certain number (again, thanks for that) but the number has to count up continuously.

first, see definition of float and double here: thoughtco.com/definition-of-float-958293

a CHOP uses a c++ 32-bit float as the internal format (as far as I know).

If your number does not fit in that, you would have to write your calculator in a python script instead of in CHOPs. If you use floats in Python they should be large enough (Python floats are C doubles).

I’m afraid I don’t have the time to do all the work for you, but read here how to add two floats in python: programiz.com/python-progra … add-number and build on from there.

I’m trying to get the number now to add up 7937 every 10th of a second so that every “second” it increases 79,370. So that the number is more visually appealing.
CountingUp.1.toe (5.65 KB)

If anything, i just need to be able to key any number in for the “multiplying” of the number. Right now it has to be in the thousands for the network to work.

Hi!
How can I make a multi-position switch that displays a different caption on the switch in each position?
I am currently using it as shown in the attachment, but I would like the button to also display the current function.(Eg: one, two, three, four) I am a beginner and help would be very helpful.
bmode.toe (4.2 KB)