Goddamn millisecs timer...

Blitz3D Forums/Blitz3D Beginners Area/Goddamn millisecs timer...

Mustang(Posted 2003) [#1]
Allright, I have "coders block"... I'm trying to do simple timer(millisecs)/loop and it doesn't work like I want it to work.

I want to have "text" that I'm drawing every flip, but I want to show 5000ms red text, and then 5000ms white text, then 5000ms red... how? I know it's simple, but I'm STUCK. My brains stopped working or something... help!


Floyd(Posted 2003) [#2]
How about this?
If Abs( MilliSecs() Mod 10000 ) < 5000 Then useRed Else useWhite

The Abs is there in case Millisecs() has 'rolled over' to negative numbers.

There are other ways, but this doesn't need to remember previous results.


Mustang(Posted 2003) [#3]
Thanks Floyd! That is cool way to do it... and it works! :)

Repeat

If Abs( MilliSecs() Mod 1000 ) < 500 Then
        Color 128,128,128
	Text 10,10,"test"
Else
	Color 255,0,0
	Text 10,10,"test"
EndIf

Until KeyHit (1)