Download

How to change substrings of countdown to have two digits?

I was trying to do a timer, for a simple exercise, and I got it working no problem. Then when I tried to add zeroes when seconds or minutes are below 10 the problems mounted. I got seconds working when there were two paths to take: seconds don’t need extra zeroes - seconds do need extra zeroes. After that when I tried to do minutes in to the mix I got overwhelmed. I think I’m missing something here, since it can’t be that I can’t do this in blueprints, right? Set me straight how to in a smart way. In the picture is the blueprint that works for seconds but doesn’t for the minutes or the hours.

I’m new so this maybe some basic stuff, but I don’t understand how you do these things when something is hinging on multiple outcomes and every outcome is different.

EDIT: Let me explain a little further. I have a text render object which I update every tick based on (countdown time - elapsed time). I get the hours by doing modulo 3600 and minutes with modulo 60. Those are the middle parts on the graph. I append all of those results with each other and some " : " to make it look nice. Now I would like to add zeroes if the hours, seconds or minutes are under 10 to keep it looking consistent. I just don’t know how to do it in blueprint. If I have to a different path for every permutation, it’s not going to work or would be totally messy. It works here with one branch node and two almost identical branches where in another I append an extra zero to seconds and in another not if the result is 10 or above, but is this the way to go with multiple different outcomes? Seems so weird to make all these different paths that could amount to double digits easily in fairly simple scenarios. I know there must be an easier way which I just don’t know about since I’m a newbie. I’m hoping someone could point to somewhere where I could learn how to make complex logical blueprints and this isn’t even that complex.

EDIT 2:

Okay I found out a solution, but it wasn’t quite the solution I was hoping for. You don’t create alternate event branches, which makes sense, but check each part of the string at the same time and set them to a 2 character string though this method I found online: https://answers.unrealengine.com/que…ml?sort=oldest

Seems like not the optimal solution, though. Maybe I’m just new and I don’t understand how the flow should go.