Download

Set text/string and integers.

Hi,

I’m having a little trouble at the moment with integers, what it is is that I’m trying to create a score system where it starts off displaying “00000” and then counts up from there on tick. The issue lies in that I can only display one single 0 when I use integer variables to try and implement the display.

Is there any way around this? Thanks.

You could use the AsCurrency node as below:

9dffc5a9d2fd9e7b9ac86b58b2ad3abc927ac7e9.png

Set the minimum integral digits to set the amount of leading zeroes. Not sure if there’s a way to prevent the currency symbol, but using a Right Chop node will remove it.

i dont think that is what he asked for (or im just blind)

Right from the scratch there are two possible ways i can think of right now:

  1. work with a score number of: (1)00000 and increment this with your scorevalue. Then to display it, convert this number into a string and erase the leading “1”.
  2. you could count the exponents of your digit, and divide them into single ints for each exponent and then build a string with leading “0” until the first exponent number occurs (very ugly, when i think about it)

(3. maybe there is a third option and the engine provides you something like here:http://stackoverflow.com/questions/1714515/how-can-i-pad-an-int-with-leading-zeros-when-using-cout-operator

maybe i come up with something different

cheers

I would make the whole event tick coding in another blueprint and then I would bind it to the widget. There are multiple ways to do this, but I suggested the above on which I would go around.

Thanks for everyone’s replies, I am grateful. Did not even know those nodes existed (AsCurrency and “Chopping?” lol) I will let you guys know how I get on as soon as I return home to try em :smiley:

A ToText node would work better than the AsCurrency node actually, it does the same thing without the symbol, I forgot it existed.

you can update string array with each integer digit and print string the array 0 0 0 0 0 0

a 5.5 yo necro o_O