Timer issue...

Blitz3D Forums/Blitz3D Beginners Area/Timer issue...

HuNTeD(Posted 2004) [#1]
I cannot figure out how to make a 30 minuet timer for my game, the book im using dosent tell me how to make a timer and I was wondering if someone could help me out.


wizzlefish(Posted 2004) [#2]
You're the fourth one *today.*

Anyway, it's pretty simple. Before your main loop, do this:
timer = Millisecs()


IN your main loop, put this (I like to put it right before "RenderWorld")
If Millisecs() = timer + 1800000 ;(30 minutes)
    ;do stuff
EndIf


Did that help?

(hehe - I remember when I was you - hehe)


WolRon(Posted 2004) [#3]
Digital Fortress, I know I told you about this before... :)
If Millisecs() = timer + 1800000 ;(30 minutes)
    ;do stuff
EndIf

The problem with the code above is that Millisecs() has to EQUAL timer + 1800000. This should be changed to greater than. The odds of it being equal are very small.

Heres what it should read.
If Millisecs() > timer + 1800000 ;(30 minutes)
    ;do stuff
EndIf


By the way, it doesn't have to be anywhere near the RenderWorld command. In fact, if his program isn't using 3D graphics, he wouldn't even be using a RenderWorld command. It just has to be in his main loop.


P.S. In case my post sounds offensive, it's not intended to be. I hope no offense was taken D.F. I'm just helping out.


HuNTeD(Posted 2004) [#4]
Ok guys thanks a ton, i can finaly fisnish my game...


wizzlefish(Posted 2004) [#5]
it wasn't offensive - I assure you :)

and I keep forgetting that greater than thing......


HuNTeD(Posted 2004) [#6]
ok, ive never used this before, and what i have found out is that it dosent do what i would like it to do.

I want it to be a 30 minuet timer, that counts down 1 second every second.

I know I can do other things to get around this but this is the fastest way. If you could give me the script for that I would be able to learn off of it.


tonyg(Posted 2004) [#7]
Try this thread...
http://www.blitzcoder.com/cgi-bin/ubb-cgi/postdisplay.cgi?forum=Forum5&topic=002756