Script events

From StealthBot Wiki
Revision as of 20:29, 1 February 2010 by Ribose (talk | contribs) (List of script events: missing events: command, error)
Jump to: navigation, search

Script events are VBScript subroutines that StealthBot recognizes and calls automatically when something happens in the bot.


If first you place code in your script, it will be executed as soon as the script is loaded. To wait until something else calls your code, you must put it inside of subroutines.

Every subroutine needs a triggering event to run: something needs to happen before the script can begin to do anything. For instance, if you want to make a greet, you need to first detect someone joining. Someone joining will be the triggering event we are looking for, so we would want the Event_UserJoins subroutine to catch that event. Now, if you want something to happen when a user types something, specifically in the white chat (channel chat), what event do you think we need? Something that catches someone talking, right? Event_UserTalk is what we'll look for.

Every event has a set of required parameters (in some cases, they require zero parameters) that must be present. You don't necessarily need to use all of them; you'll probably just want one of the variables. But you have to list all of them as the parameters for the subroutine or else the subroutine will not be called.

It will be overwhelming at first, but the events are named in such a way that they generally describe when they will be called: Event_PressedEnter is "fired" (called) when you press the Enter key from within the bot to send a message.

This information was originally written by TheBlackNinja.

How to use

  1. Put the event in your script like so.
  2. Sub Event_EventName(EventArgument, EventArgument)
        ' place VBScript code here
    End Sub
  3. Put valid VBScript code in place of the comment.
  4. You're done! Your bot will do the specified instructions when the event occurs.

List of script events

Here are a list of the current script events that you can use:

Object events

An object event is a script event "called by" an object created with the CreateObj function.

The name of the event uses a similar format as the above script events, except that instead of the word Event, we use the name we has passed to CreateObj() as the name of the object.

For example, if we created a LongTimer object and named it LTimerObj, its Tuner() event would fire an event called LTimerObj_Timer. The number of parameters and function name still must match what the event call is looking for.

It can be simplified to think of the script as having a global object named Event whose job is to call global script events and that all events follow the naming format of ObjectName_EventName.

See also