Comrades in Arms Discussion Board

Full Version: Counter timer for the next coop night live on the website
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
(07-12-2015, 12:02 PM)Variable link Wrote:I think that the 'Hours', 'Minutes' and 'Seconds' part should be separated as well so it will show "1 day 1 hour 1 minute 1 second" left.

Also, what should be the text? "Coop night starts in"?, "coop night start in"?, "coop night begin/s in"?

When the timer reaches zero it should show "coop night in progress". Maybe we want to auto-join TS if clicked?

Maybe show the time as "1d 1h 1m 1s" or "1d 01:01:01"? I think people will understand those and it keeps it a bit neater.

I think "Next co-op begins in" for the text would be good. You could add "night" after "co-op" but for some people around the world it's not actually night time when we play. It's not a big deal though.

Might be nice if we could have it join TS when clicked but probably anyone who's installed all the mods, etc will have TS and anything else sorted already. If they're just interested, they won't be able to chat to anyone whilst we're playing due to TFAR will they, or can they hear and talk to everyone if they haven't got that installed? If so and they catch us at a quiet part of a mission, then someone might be able to go to the lobby and help them get setup.
(07-14-2015, 07:21 PM)Alwarren link Wrote:Well you have to have something to count on. If you just do something that waits a second and then updates the timer, that won't really work, since the javascript might not be running when the user deactivates the browser or chooses another tab. You need to have a time base.
I don't see the problem. Sure you need a timebase but can't you just compare current GMT to 19:00 GMT and display the difference?

You'd also need to calculate the number of days between today and Thursday (if today is Mon-Wed) or today and Sunday (if today is Friday-Saturday).

I guess it might be easiest to change from in-progress to the countdown again at a set time (say 00:00 or 01:00) as we don't stop at a set time and there's probably no way for it to tell when we've stopped for the night.
Remember that it has to be recurring and be able to show a message ("coop night in progress") in between.
(07-15-2015, 03:54 AM)doveman link Wrote:there's probably no way for it to tell when we've stopped for the night.

Oh yes there is: http://arma3.swec.se/server/data/20493, but let's not complicate things Smile


The timer linking to http://ciahome.net/servers/ should be enough
(07-15-2015, 03:54 AM)doveman link Wrote:I don't see the problem. Sure you need a timebase but can't you just compare current GMT to 19:00 GMT and display the difference?
I'm with doveman's confusion about this, too.

(07-15-2015, 03:54 AM)doveman link Wrote:I guess it might be easiest to change from in-progress to the countdown again at a set time (say 00:00 or 01:00) as we don't stop at a set time and there's probably no way for it to tell when we've stopped for the night.
No need to over-engineer this. We can stop the counter at a fixed time (01:00 CET according to the specs) as rund suggested and have the link to the servers page active all the time (even off coop nights).
(07-15-2015, 03:54 AM)doveman link Wrote:I don't see the problem. Sure you need a timebase but can't you just compare current GMT to 19:00 GMT and display the difference?

Well that's what I was trying to say. Pass the server time via php into the javascript. Calculate the GMT offset based on that (I wouldn't assuime that the local machine is always properly set up) and use that offset to calculate the time needed.

I hope that's clearer.
It's an easy calculation (any errors are due to my lazyness). Lets assume all times are in unix format ( defined as the number of seconds that have elapsed since 1 January 1970)

Then:
Code:
time_to_coop = time_coop - time_server.
Where time_coop is 20:00 CET converted to unix time
However, time_server is only known on  page loading, and is static, so we need the difference between the local machine time and the server time at page loading:
Code:
time_diff_local = time_local - time_server. 
time_diff_local is now the number of seconds your local clock is in advance of the server, which is zero if your local clock is set exactly like the server.
Now we can countdown from the local time, and update the text at any time (that is crucial as Alwarren correctly notes):
Code:
time_to_coop = time_coop - (time_local - time_diff_local).

Hope that clears it up
Yakir can't keep working on this. Can someone pick this up?
I can try to give this a go, as I picked up web developing recently again, it's a good refresher maybe  ;D

Who fills me in on the webserver login details?
Awesome! Let's proceed on email regarding login credentials. 
http://ciahome.net/countdown/

This is a test page for the logic, let's test if it works as desired, and I'll put it on the homepage when we're confident.
Spot on accurate for me!
Looks good!
Good to go
Well done, run! Seems accurate enough for me  ;D
Pages: 1 2 3