The Daily Click ::. Forums ::. Klik Coding Help ::. Making a perfect clock
 

Post Reply  Post Oekaki 
 

Posted By Message

Willy C



Registered
  14/02/2004
Points
  1524

Game of the Week WinnerKlikCast StarPicture Me This -Round8- Winner!VIP MemberWii OwnerIt's-a me, Mario!Hero of TimeThe Cake is a LiePS3 OwnerI am an April Fool
Batman!Teddy Bear
8th June, 2008 at 08:11:31 -

I'm trying to make a timer that counts seconds and minutes, and it should be consistent on all computers.
I understand that using the "every xx" event might result in a slight variation on some computers.

How do I make such a timer?

 
http://www.robocaptain.com

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
8th June, 2008 at 08:38:34 -

"Always"

Always depends on processor speed.

I.e

"Always"
add 1 to counter milliseconds

Counter milliseconds >= 100
add 1 to seconds
set milliseconds to 0

Counter seconds >= 60
add 1 to minutes
set seconds to 0

Counter minutes >= 60
add 1 to hours
set minutes to 0


something like that.

 
My signature is never too big!!!

Willy C



Registered
  14/02/2004
Points
  1524

Game of the Week WinnerKlikCast StarPicture Me This -Round8- Winner!VIP MemberWii OwnerIt's-a me, Mario!Hero of TimeThe Cake is a LiePS3 OwnerI am an April Fool
Batman!Teddy Bear
8th June, 2008 at 08:44:57 -

thanks. I'll try that.

 
http://www.robocaptain.com

viva/volt

Awesome Sauce

Registered
  26/08/2006
Points
  1694

Game of the Week WinnerSilverNova MemberKlikCast StarVIP Member
8th June, 2008 at 09:39:19 -

This is actually the one place where I would use a timer event since they are frame rate independent - if you want a second to be a second on any machine just use the inbuilt functions. Though - if machine independent speed is checked then you can use the always method with your frame rate being how many frames to a second on the clock etc.

 
Image
http://bfollington.tumblr.com

Willy C



Registered
  14/02/2004
Points
  1524

Game of the Week WinnerKlikCast StarPicture Me This -Round8- Winner!VIP MemberWii OwnerIt's-a me, Mario!Hero of TimeThe Cake is a LiePS3 OwnerI am an April Fool
Batman!Teddy Bear
8th June, 2008 at 11:14:38 -

I guess the safest way would be to use an extension that reads off the system clock...

But I don't want the timer to be manipulated. Is there a way to freeze the system clock so that the time will stand still in the game?

 
http://www.robocaptain.com

OMC

What a goofball

Registered
  21/05/2007
Points
  3539

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
8th June, 2008 at 11:56:17 -

Someone else was just have this same issue... I think he made it so that if the player changes the clock, he has to go on a magical quest to be able to play the main storyline. That or he used the crasher extension. Goldfish memory.

 

  		
  		

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
8th June, 2008 at 21:19:22 -

Like you mentioned, simply use the date & time object. Then you can detect "new second", "new minute" etc. If you had the event: new second, add one to counter. Then it wouldn't matter if the player changed the clock, because it only checks when 1 second has passed.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Willy C



Registered
  14/02/2004
Points
  1524

Game of the Week WinnerKlikCast StarPicture Me This -Round8- Winner!VIP MemberWii OwnerIt's-a me, Mario!Hero of TimeThe Cake is a LiePS3 OwnerI am an April Fool
Batman!Teddy Bear
9th June, 2008 at 05:39:02 -

Yeah, I realize that. But I am worried about what happens if someone uses some kind of program that actually freezes the system clock. Then it won't be able to count the seconds that pass.

Maybe I can add a fail safe. If the timer, in-game, doesn't move for a little while I'll just exit to main menu or something.

 
http://www.robocaptain.com

viva/volt

Awesome Sauce

Registered
  26/08/2006
Points
  1694

Game of the Week WinnerSilverNova MemberKlikCast StarVIP Member
9th June, 2008 at 08:24:35 -

If someone's trying that hard to cheat why stop them?

Surprisingly most people don't cheat unless they get very stuck or beat the game.

 
Image
http://bfollington.tumblr.com

Dr. James MD

Addict

Registered
  08/12/2003
Points
  11941

First GOTW AwardSecond GOTW AwardThird GOTW AwardPicture Me This -Round 26- Winner!
9th June, 2008 at 08:50:20 -

Unless its online or has highscores I wouldn't worry about it. If somebody wants to ruin the game let them. The vast majority will play it properly, it might not even cross their mind to change the time to cheat.

 
Image
http://uk.youtube.com/watch?v=j--8iXVv2_U
On the sixth day God created Manchester
"You gotta get that sand out your vaj!" x13
www.bossbaddie.com

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
9th June, 2008 at 11:29:21 -

Also: 1 second = 1000 milliseconds, not 100.

lrn2 metric system.

Image Edited by the Author.

 
n/a

Willy C



Registered
  14/02/2004
Points
  1524

Game of the Week WinnerKlikCast StarPicture Me This -Round8- Winner!VIP MemberWii OwnerIt's-a me, Mario!Hero of TimeThe Cake is a LiePS3 OwnerI am an April Fool
Batman!Teddy Bear
9th June, 2008 at 14:21:35 -

yeah. It might be used online. Otherwise I usually don't care.

thanks for all the help.

 
http://www.robocaptain.com

OMC

What a goofball

Registered
  21/05/2007
Points
  3539

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
9th June, 2008 at 20:37:00 -

How the p'hoogus do you freeze a system clock? (btw, I haven't googled it. Likely that would yield results.)

 

  		
  		

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
10th June, 2008 at 03:10:58 -

You can program it in MMF. I've done it before as a joke It's simple. Add a clock object and: Always set time to 12:00:00

Willy C - I think that exit to menu idea is a good one. You could have a counter which always has 1 added to it, and every new second it is set to 0. Then if this counter is greater than, say 2000, then you know that the timer has frozen.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
10th June, 2008 at 03:16:20 -

someone should make an object that keeps count of processor ticks and ticks per second. then it would be easy as 1 2 3.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click