Difference between revisions of "LongTimer object"
m (1 revision imported) |
|
(No difference)
|
Latest revision as of 08:20, 1 December 2017
The LongTimer object exposes a Visual Basic 6-like timer to your script. A "long" timer calls a specially-named subroutine every X seconds, where X is a number you give it.
This object is used to create greater-length intervals than the Timer object provides and the more conceptually-friendly "second" interval. If you need to use a timer with an interval less than a second, use the Timer object. This object is also useful in quickly converting plugins: the plugin system timers used an interval precision of one second as well.
Contents
History
This object was added in StealthBot version 2.7 by Eric to create an object-oriented experience in scripting.
How to use
Use the CreateObj function to create the long timer, and access it using the variable name you passed. Provide an object event with the name "Timer" for when the long timer elapses. This is an example with a long timer executing every 2 minutes.
CreateObj "LongTimer", "LTimerObj" LTimerObj.Interval = 120 LTimerObj.Enabled = True ... Sub LTimerObj_Timer() AddChat vbCyan, "2 minutes have passed." End If
Properties
List of properties
Interval property
This property returns or sets the interval, or number of seconds 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.
Events
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 <longtimername>_Timer()