PDA

View Full Version : Adding string to counting numbers


Navstar
11-05-2010, 09:00 AM
I've got a basic setup displaying extruded text that can count up and down via slider.

But I want to add a string before the number. Specifically a dollar sign. Since the value goes from $0 to $100000, I need the "$" to always stay attached next to the far left number.

Seems simple, but the Xpresso to combine a string and an integer escapes me.
http://i175.photobucket.com/albums/w134/navstar/Screenshot2010-11-05at40124AMcopy.png

Darter
11-05-2010, 09:30 AM
Just use an Add node with the data type set to String.

kvb
11-05-2010, 09:52 AM
You could also use a coffee node.

Totally forgot the math node could be used with strings (make sure you put the node producing the $ as input 1).

But just in case you need to do more to the number (like adding cents, constraining to 2 decimal places will be a pain and will most likely require a bit of scripting), I'm posting the coffee equivalent:)

main()
{
var value = tostring(Input1);
Output1 = "$"+value;
}

-kvb

Navstar
11-05-2010, 03:11 PM
Very cool! Thanks!

On a side note... anyone know how to stop numbers from "vibrating" side to side as it counts up/down? All professional fonts have monospaced numbers, but C4D seems to change the kerning enough to make each number have a slightly different width.

kvb
11-06-2010, 12:45 AM
Change the alignment from center to either left or right and the jitter should go away:)

-kvb

CGTalk Moderation
11-06-2010, 12:45 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.