# Get countdown value

**URL:** <https://forum.makecode.com/t/get-countdown-value/3903>\
**Category:** Help\
**Created:** [October 15, 2020, 7:59pm UTC](https://forum.makecode.com/t/get-countdown-value/3903 "2020-10-15T19:59:36Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![cosmoscowboy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cosmoscowboy/32/1718_2.png) [@cosmoscowboy](https://forum.makecode.com/u/cosmoscowboy)\
**Post date:** [October 15, 2020, 7:59pm UTC](https://forum.makecode.com/t/get-countdown-value/3903/1 "2020-10-15T19:59:36Z")

</div>

Is there any way to get the remaining value of the countdown timer? I want to use that value to calculate a score based on how quick the player completed a task.

---

<div class="post-metadata">

**Author:** ![Dreadmask197](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dreadmask197/32/10494_2.png) [@Dreadmask197](https://forum.makecode.com/u/Dreadmask197)\
**Post date:** [October 15, 2020, 9:21pm UTC](https://forum.makecode.com/t/get-countdown-value/3903/2 "2020-10-15T21:21:19Z")

</div>

You could turn the countdown timer into a variable. (ex. `Countdown variable`) and you could do a random number you chose. (ex. 100) and do this -\> 100 - `Countdown variable` and put that into a `set points to __ ` block I guess

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [October 15, 2020, 10:14pm UTC](https://forum.makecode.com/t/get-countdown-value/3903/3 "2020-10-15T22:14:08Z")

</div>

I’m not sure if I understand yours, but what I was thinking was to just have a variable along side that containing the seconds that you started with and in an `on game update every 1000 ms` you would subtract the variable by one, simulating the countdown timer in memory. It wouldn’t be as accurate though, because I tried before in a separate game.

---

<div class="post-metadata">

**Author:** ![Dreadmask197](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dreadmask197/32/10494_2.png) [@Dreadmask197](https://forum.makecode.com/u/Dreadmask197)\
**Post date:** [October 15, 2020, 10:18pm UTC](https://forum.makecode.com/t/get-countdown-value/3903/4 "2020-10-15T22:18:28Z")

</div>

That is what I’m explaining. or almost. Kinda what i was talking about but I think you’re thinking of the same thing as me except I forgot to put in the part of the 1000 ms

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [October 15, 2020, 10:19pm UTC](https://forum.makecode.com/t/get-countdown-value/3903/5 "2020-10-15T22:19:26Z")

</div>

Great minds think alike.

At least I hope they do.

---

<div class="post-metadata">

**Author:** ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)\
**Post date:** [October 16, 2020, 1:14am UTC](https://forum.makecode.com/t/get-countdown-value/3903/6 "2020-10-16T01:14:24Z")

</div>

I did that very thing in my sample Maze Game. (Link to thread [here](https://forum.makecode.com/t/mazes-extension/290); scroll down to the Maze Game 2.0 Blocks game.) There isn’t a block that you can use to find the remaining time on the countdown clock, so I saved the current “game clock” to a variable when the countdown starts, and then I calculate the elapsed time at the end of the game.

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [October 16, 2020, 7:57pm UTC](https://forum.makecode.com/t/get-countdown-value/3903/7 "2020-10-16T19:57:27Z")

</div>

By:

> [@AlexK](#):
>
> current “game clock”

you mean the `milliseconds since start`?

---

<div class="post-metadata">

**Author:** ![cosmoscowboy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cosmoscowboy/32/1718_2.png) [@cosmoscowboy](https://forum.makecode.com/u/cosmoscowboy)\
**Post date:** [October 16, 2020, 7:59pm UTC](https://forum.makecode.com/t/get-countdown-value/3903/8 "2020-10-16T19:59:46Z")

</div>

I appreciate all of your ideas. I was thinking that the best option would be to save the value of ‘game time since start’ when the level starts, and then get it again when the level finishes, and subtract the two. I was just hoping there would be a ‘getter’ for the function, since you can set it.

Maybe you guys can help me out on a other issue. I will post something shortly about a game I developing.
