Jump to content




Countdown timer not working?


2 replies to this topic

#1 Knovox

  • Members
  • 7 posts
  • LocationCalgary, AB, Canada

Posted 05 May 2017 - 10:39 PM

Hello,

I was making a countdown timer for a game I am making. I have made countdown timers before in Java as well as inside ComputerCraft. However, there is something weird that I just cannot pin-point for the life of me.

I am making two variables: mins and secs. Mins is mins = timerMinutes/60, and seconds is secs = timerMinutes%60. I believe that is correct.

However, the weird thing is that timerMInutes/60 is spitting out a bunch of numbers like so -> http://imgur.com/a/3grO7

I am pretty experienced with CC, but I still don't know everything. I am not sure if there is something I am missing here, but I just remember doing the same type of method to make a timer in Java. I am sure there is an easy enough solution to this.

Any help appreciated, thank you!

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 05 May 2017 - 11:04 PM

Well, that's the actual result of the division operation. You probably want to math.floor() the result of the division, and use that number.

#3 Knovox

  • Members
  • 7 posts
  • LocationCalgary, AB, Canada

Posted 06 May 2017 - 10:20 PM

View PostLyqyd, on 05 May 2017 - 11:04 PM, said:

Well, that's the actual result of the division operation. You probably want to math.floor() the result of the division, and use that number.

Thank you! Like I said I knew there was probably something I was missing or something else I could do. I will give it a try!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users