Timer object

From StealthBot Wiki
Jump to: navigation, search

The Timer object exposes a Visual Basic 6 timer to your script. A timer calls a specially-named subroutine every X milliseconds, where X is a number you give it.


This object was added in StealthBot version 2.7 by Eric to create an object-oriented experience in scripting.

The original version of this object was provided to Script.txt called scTimer in earlier versions.

How to use

Use the CreateObj function to create the timer, and access it using the variable name you passed. Provide an object event with the name "Timer" for when the timer elapses. This is an example with a timer executing every 1.5 seconds.

    CreateObj "Timer", "TimerObj"
    TimerObj.Interval = 1500
    TimerObj.Enabled = True
Sub TimerObj_Timer()
    AddChat vbCyan, "1.5 seconds have passed."
End Sub


List of properties

Interval property

This property returns or sets the interval, or number of milliseconds (one-thousandths of a second) between each call to the Timer event.

Enabled property

This property returns or sets whether the timer is enabled. The timer will fire the event only when it is enabled. The timer is created with this property set to False.


Timer event

The only object event called by this object is the Timer event. Place code inside this subroutine and it will be executed every time the timer is enabled and the set interval elapses.

Its signature is:

Sub <timername>_Timer()

See also