[bb] b+ CreateDelayTimer(length) by skn3 [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:41

Previous topic - Next topic

BlitzBot

Title : b+ CreateDelayTimer(length)
Author : skn3
Posted : 1+ years ago

Description : Blitz timers are designed to trigger at a constant rate, rather than wait a speciffic time amount.

The function CreateDelayTimer, will create and return a timer, who's first "tick" occurs, at your specified length.

The timer will continue to tick, so it is upto you to deal with it after the initial event.

Note: b3d uses a different timer system, so this will not work correctly! It will however work perfectly in b+


Code :
Code (blitzbasic) Select
Function CreateDelayTimer(length)
Local timerlength#
If length > 1000
timerlength# = 1.0 / (length / 1000.0)
Return CreateTimer(timerlength#)
Else
timerlength# = 1000.0 / length
Return CreateTimer(timerlength#)
End If
End Function


Comments :


Perturbatio(Posted 1+ years ago)

 Typo:
tiemrlength# = 1000.0 / length



skn3(Posted 1+ years ago)

 haha well spotted, thanks [/i]