The Daily Click ::. Forums ::. Klik Coding Help ::. I need to create a timer that counts up from 0 by tenths of seconds
 

Post Reply  Post Oekaki 
 

Posted By Message

Sephirenn

Possibly Insane

Registered
  15/01/2002
Points
  2343

360 OwnerPS3 OwnerWii OwnerI am an April FoolVIP MemberGOTW JUNE 2010 WINNER!
18th May, 2007 at 11:00:25 -

I'm trying to create a running timer that is visible over the course of four frames. I want it to start at zero and count up by tenths of seconds transfering the time to the next frame by global value. The Date and Time object doesn't seem to work for this, and using a counter it seems I can only increment by seconds and not by any decimal amount. Is there an easy way to do this, or do I need an extension of some kind? FYI I'm using MMF2.

 
*Sephirenn*

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
18th May, 2007 at 12:11:20 -

Every 00"-10?

Timer events suck though. Just use a counter, and increment it by X every event loop (the always event), where X is 10 divided by your game's framerate.

Image Edited by the Author.

 
n/a

Sephirenn

Possibly Insane

Registered
  15/01/2002
Points
  2343

360 OwnerPS3 OwnerWii OwnerI am an April FoolVIP MemberGOTW JUNE 2010 WINNER!
18th May, 2007 at 12:21:57 -

Thanks, I'll use your suggestion. HOWEVER, both of the methods require me to add a decimal to the counter (.2 in the case of looping) which either gives me a syntax error in the event editor, or if I use "10/framerate" the counter doesn't count. What am I doing wrong?

In addition, I'd like to actually show a decimal if possible. So it would count from 0.0 to whatever, but show 2.3, 5.7, etc. instead of just 4, 5, 6, etc.

I guess I can always go with just a quicker timer that doesn't relate to actual seconds. But the only way I see I can do this without using decimals is:

Always -> Add 1 to Counter1
Always -> Set Counter2 = Counter1/10

Image Edited by the Author.

 
*Sephirenn*

Windybeard Games



Registered
  14/04/2005
Points
  219

You've Been Circy'd!VIP MemberCandy Cane
18th May, 2007 at 13:57:12 -

i might be reading your question wrong but if im not then...

Every 00.10 second add 1 to counter 1
counter => 1 set to 0
Every 01.00 second add 1 to counter 2

 
n/a

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
18th May, 2007 at 15:23:09 -

Antworx: Read my previous post, don't use timer events.

Sephirenn: That's absolutely fine. I don't think I'm ever going to get my head around the way MMF handles decimals. Hmm, I'm not sure, but you could also try using an alterable value instead if you still want the decimals. Just use a string or something to display it.

Also, about the syntax error: Try using 0.2 instead of .2

 
n/a
   

Post Reply



 



Advertisement

Worth A Click