timer problem

BlitzPlus Forums/BlitzPlus Programming/timer problem

Kanati(Posted 2004) [#1]
I've rarely used timers before... so I'm a little stumped with this... The program runs uuber quick. The way I understand it, the following code should run for 5 seconds before dropping out of the loop. However it doesn't. It's QUICK. What am I doing wrong?

	fpstimer = CreateTimer(60)
	endsplash = CreateTimer(100)
	
	While WaitEvent() <> $803
		evnt = EventID()
		
		Select evnt 
			Case $201
				End
			Case $4001
				If EventSource() = fpstimer
					Cls
					DrawImage splashimg,0,0 
					FlipCanvas SPLASHCANVAS		
				EndIf
				
				If EventSource() = endsplash
					If splashtime >= 50
						FreeTimer fpstimer
						FreeTimer endsplash
						FreeGadget SPLASHWIN
					  Return 0
					Else
						splashtime = EventData()
					EndIf
				EndIf
		End Select
	Wend


It's actually a code snippet from a function (splash screen)... hence the return 0.


Kanati(Posted 2004) [#2]
hrm... did the light in the refrigerator of my mind just turn on?

CreateTimer(100) doesn't create a timer that delays 100 milliseconds and fires... It creates a timer that fires 100 times per second? Is that it?

So to delay 5 seconds I would CreateTimer(1) and count to 5?


skn3(Posted 2004) [#3]
http://www.blitzbasic.com/codearcs/codearcs.php?code=1006

take a peek


Kanati(Posted 2004) [#4]
Thanks... checked pretty much everywhere but the code archives HERE. Sigh...

I think I had it figured out finally, but thanks for the tip. Spent far too much time on something so simple.

Kanati