Noob: CreateTimer() Help

BlitzMax Forums/BlitzMax Beginners Area/Noob: CreateTimer() Help

MGE(Posted 2009) [#1]
I just noticed this ability, can you set up a timer and have it call a Function? If so...how? Thanks for your help.


Perturbatio(Posted 2009) [#2]
you can do this with EVENT_TIMERTICK

http://www.blitzbasic.com/Community/_search.php?bbs=BlitzMax&forum=&terms=EVENT_TIMERTICK&method=simple&case=no&results=topic&user=&submit=Search


MGE(Posted 2009) [#3]
ahh...so you poll each loop then? I was thinking it was more like an internal thread or "interrupt" that gets called. That way your main loop was free to do it's own thing. I already have software timers based on millisecs() I guess I'll just keep doing that then.


jsp(Posted 2009) [#4]

I was thinking it was more like an internal thread or "interrupt" that gets called.


When you filter the EVENT_TIMERTICK in a hook function that should work.


tonyg(Posted 2009) [#5]
... as the hook function is called automatically once registered.


MGE(Posted 2009) [#6]
Never used the hook function either. Will investigate this. Thanks for the help.


jsp(Posted 2009) [#7]
Have a look at this:
http://www.blitzbasic.com/codearcs/codearcs.php?code=1690
that comes may quite close...


GfK(Posted 2009) [#8]
The dev/SVN version of blitzmax has a threading module which works really nicely, but still has a couple of issues and needs a general tidy-up.

Hopefully it'll make it into a release version soon (because I want to use it!)


Retimer(Posted 2009) [#9]
Personally, I wasn't a fan of blitz event timers as the event system seems too screwy with delays and checks, so I just use a (millisecond - lastcheck) > (<insert tick count variable>) style of timers to call functions or make updates.

Not entirely sure what the issues are with threads as I haven't kept up on them, but i'm using threads for a game/application archive updater with multiple download progress bars with bruceys bah.CEGUI mod and file/http streams, without any issues on my side, or the clients that have tested it. Running smooth. Although since it doesn't have to run more than a few minutes, I suppose that's not a great announcement.

Time


H&K(Posted 2009) [#10]
http://www.blitzbasic.com/codearcs/codearcs.php?code=1721


Include the Type definition Tbeat into your code.
Then when you want a Timer

MyTimer:Tbeat = New TBeat.Create (MilliDelay:Int, Name of Function)

This will call the function named every MilliDelay