November 28, 2020, 01:44:19 AM

Author Topic: [bb] b+ CreateDelayTimer(length) by skn3 [ 1+ years ago ]  (Read 494 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] b+ CreateDelayTimer(length) by skn3 [ 1+ years ago ]
« on: June 29, 2017, 12:28:41 AM »
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
  1. Function CreateDelayTimer(length)
  2.         Local timerlength#
  3.         If length > 1000
  4.                 timerlength# = 1.0 / (length / 1000.0)
  5.                 Return CreateTimer(timerlength#)
  6.         Else
  7.                 timerlength# = 1000.0 / length
  8.                 Return CreateTimer(timerlength#)
  9.         End If
  10. End Function


Comments :


Perturbatio(Posted 1+ years ago)

 Typo:
Code: [Select]
tiemrlength# = 1000.0 / length



skn3(Posted 1+ years ago)

 haha well spotted, thanks [/i]

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal