Download

Microwave time setting

This is probably a really stupid question, but for the life of me, I cannot figure it out, which annoys me beyond belief considering some of the other things I have worked out on my own.

But basically I am trying to create a microwave or oven interface, where the player can use a digital pad to set the timer…

So if the player hits 5, 4, 3, 2, 1, 2, 4, 2, the timer should show (in sequence):
00:05
00:54
05:43
54:32

(This is where numbers start being overridden)
54:31
54:12
51:24
12:42

The next thing is, when the player adds something that is more than 60, so they might do something like 5, 4, 3, 2, 6, 5.

00:05
00:54
05:43
54:32

(This is where numbers start being overridden)
54:36

(This is where we technically add 1:05 (65sec))
55:05

I just don’t really know why I can’t work all of this out, it seems so simple and straight forward, but my brain just for some reason cannot figure out what blueprint nodes to use to solve this, and what variables I would need.

I have tried to use string and int arrays, I have tried to use timespans (not really ideal though for inputting a number manually), I just can’t work it out and it’s depressing me now. I can figure out some advanced trigonometry and in game guiding systems, I can figure out some really crazy stuff, but I can’t figure out how to make a microwave timer -_-…so sad haha

Does anybody have any ideas or magical blueprint nodes that I don’t know about?

UPDATE:
And moments later, I go and test the microwave again (the real one) to see how it functions…and…it doesn’t function how I thought it did in the first place.

In the first example, the microwave just shifts the array numbers to the left.
So it does this
00:05
00:54
05:43
54:32

43:21
32:12
21:24
12:42

And if I do add anything more than 60 seconds…well, it doesn’t do what I thought, if I input 9,5,9,9, the output is.

00:09
00:95
09:59
95:99

And if I start the microwave…it starts counting down on the right side from 99 down to 0, before going to 94:59.

So maybe I shouldn’t be losing my mind over this haha

I think this problem boils down to two separate problems.

  • The first is to set the numbers in the sequence you want them to work, even if it prints you 54:65.
  • Once you get there you can maybe try to convert the string to time parameters, then extract the results separately as hour and minutes which you will display on the owen ui and use in your game logic.

The string version of the input would be stored separately for the string operations to input the numbers only, it will be a hidden property you store for further evaluations.

I’m assuming the time conversion operations should correct the invalid 54:65 to the proper 55:05 output for you (never tested, but it usually the behavior of such time conversion libs). The interesting thing comes after all this, since you can expect a little incosistency at this point once you put an additional number to the system, eg a 1, which would result in a 56:51 in instead of the expected 50:51.

What would be your expected time stamp at this point once you press a number 1 after the displayed 55:05 is on the screen?

Maybe you should just avoid the number overwrites go and with a maximum of 4 input digits. You can also provide a Clear button that will reset the timer to 00:00 and the user can input any 4 numbers again. That would make things a bit easier.

Try importing this widget that I’ve attached](Microwave.uasset.zip (57.6 KB)), into your project so you can see how I did it. I used 4.16 but it might work with newer and older versions.

Alternatively:
**Event Graph: **Microwave1 posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4
IncrementTime Function: IncrementTime posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4
CheckTimerFinished Function: CheckTimerFinished posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4 [HR][/HR]
Inside my UMG Widget itself I have 10 buttons, called 0-9 respectively, I have a button for Start which starts the timer going and I have 4 text boxes called ‘A’ ‘B’ ‘C’ ‘D’, where A is the left most number in the clock (
‘0’0:00) and D is the right most number in the clock (00:0’****0’
).

Let me know if you want screenshots or anything else, hope this helps! :slight_smile:

  • Jamie

Sorry about the late response folks, and thank you for the quick responses! I have been on a bit of a hiatus with work/life haha.

I got it to work as I wanted, even if I set the time to 99:99, it will count down from 99 sec to 0, the minute will change to 98 and the next minute will count down from 60 as expected, just like on an actual microwave.
Since this is for a game, and is one small part of the game, I don’t think this amount of detail is necessary for just this one interactive object, and I could have gotten away with simply using some “add x time” buttons, but keypads will be used quite a lot on many different devices in the game where players may want a very specific time set.

I also have temperature setting that is working, but no need to go into detail with that as it’s very straight forward.

I don’t think i’ll try and explain what I did, because …well, it’s easier in blueprint form.

When a play hits a number on the keypad (the UMG in game 3d Widget keypad) it sets an int variable to the number of the keypad (hit 3…it stores the number 3) then runs this function called AdjustTimer.

The time text itself on the widget has a bind function which does this (I don’t typically like to bind functions, especially with many widgets each ticking away with , I prefer to just set them as the values change, but this is a bit of a rush job)

When the player starts the timer, this timer event is triggered in the main event graph.