Countdown timers

Ideas how the game could be improved and suggestions for subsequent versions of the game. (this is just a space for ideas! We can't guarantee suggestions will be implemented!)

Moderator: moderators

j3m03d3r
Posts: 2
Joined: 09.10.2011, 20:36

Countdown timers

Postby j3m03d3r » 09.10.2011, 20:47

i think kapilands should have some countdown timers for waiting for production or research to finish.
i took the liberty of creating some sample code below!

Code: Select all

<html>
<head>
<script>
/*
 * code by:
 * j3m03d3r
 *
 */

function add_leading_zero(n) {
   if(n.toString().length < 2) {
      return '0' + n;
   } else {
      return n;
   }
}
function countdown(time, out) {
   var hours, minutes, seconds;
   seconds = time % 60;
   minutes = Math.floor(time / 60) % 60;
   hours = Math.floor(time / 3600);
 
   seconds = add_leading_zero( seconds );
   minutes = add_leading_zero( minutes );
   hours = add_leading_zero( hours );
 
   document.getElementById(out).innerHTML = hours + ':' + minutes + ':' + seconds;
 
   if(time < 1) {
      window.location.reload(); //reload if countdown reaches 0
   } else {
      setTimeout("countdown(" + (time - 1) + ", '" + out + "');", 1000);
   }
}
</script>
</head>
<body>
<div id="timer_001"></div>
<script>
countdown(120, 'timer_001');
</script>
</body>
</html>

User avatar
VerConMat Industries BV
KapiTimes-editor
Posts: 2791
Joined: 26.05.2009, 16:24
Location: R1 & R2: VerConMat Industries BV

Postby VerConMat Industries BV » 09.10.2011, 21:47

I don't really see the added value in replacing the already easy to use 'static' timers with animated ones.

I think it would be rather annoying to see the right side of the screen changing every second.
And, it would become pretty much impossible to copy/paste building process as countdown timers usually won't allow that.

If the programmers wanted it, they would have probably done that already.
Some of the other upjers games do have countdown timers in places where it makes more sense to have them.
Image

j3m03d3r
Posts: 2
Joined: 09.10.2011, 20:36

Postby j3m03d3r » 10.10.2011, 12:56

maybe just for the things under 10 minutes

User avatar
NYK
KapiTimes-editor
Posts: 1837
Joined: 13.06.2009, 22:09
Location: R1/R2 - NYK

Postby NYK » 10.10.2011, 18:26

Its been a while si nce i used it due to it not working on the latest firefox but i'm sure Kapiskript had live countdown timers. I may be wrong though. :?