Difference between revisions of "Event FirstRun"

From StealthBot Wiki
Jump to: navigation, search
(Created page with 'This StealthBot scripting event occurs when the bot loads, but '''not''' after script reload. The Event_FirstRun() event can be used to do special a…')
 
(Example)
Line 8: Line 8:
 
After the first script load, the script will print "Hello world!" in green using the [[AddChat]] function.
 
After the first script load, the script will print "Hello world!" in green using the [[AddChat]] function.
 
  ' occurs on first script load only
 
  ' occurs on first script load only
  Sub Event_Load()
+
  Sub Event_FirstRun()
 
     AddChat vbGreen, "Hello world!"
 
     AddChat vbGreen, "Hello world!"
 
  End Sub
 
  End Sub

Revision as of 08:54, 3 August 2009

This StealthBot scripting event occurs when the bot loads, but not after script reload.

The Event_FirstRun() event can be used to do special actions that should be done one time per bot lifetime.

Note that any global variable and object settings will be reset by reload script, so using this event for loading them will cause the variables and objects to only be set up until the first reload. In this case, use Event_Load() instead.

Example

After the first script load, the script will print "Hello world!" in green using the AddChat function.

' occurs on first script load only
Sub Event_FirstRun()
    AddChat vbGreen, "Hello world!"
End Sub

See also