-
Notifications
You must be signed in to change notification settings - Fork 17
Script Events
David edited this page Nov 7, 2020
·
1 revision
(WIP)
To create an event handler in your script, simply declare a sub-routine with "Event_" followed by the event name, for example to handle the "UserTalk" event you would declare:
Sub Event_UserTalk(Username, Flags, Message, Ping)
If Message = "hello" Then
AddQ "world!"
End If
End SubWith this example, whenever someone says "hello" in the channel, the bot will respond with "world!".
| Event Name | Arguments | Description |
|---|---|---|
| FirstRun | the bot first starts (and not on subsequent script reloads) | |
| Load | each time the script is loaded (bot start, script enabled, scripts reloaded) | |
| LoggedOn |
|
The bot successfully logs in and enters chat (received SID_ENTERCHAT back from the server) |
| ChannelJoin |
|
the bot joins a new channel |
| ChannelLeave | the bot leaves a channel | |
| Close | each time the script is unloaded (bot close, script disabled, scripts reloaded) | |
| LoggedOff | the bot disconnects from Battle.net | |
| Shutdown | the bot closes |
| Event Name | Arguments | Description |
|---|---|---|
| Command |
|
a command is issued to the bot (does not mean it was successfully executed) |
| MessageQueued |
|
a message was added to the bot's outgoing message queue |
| MessageSent |
|
a message was taken off the queue and sent to the server |
| Error |
|
an error occurs in the execution of a script |
| PressedEnter |
|
the ENTER/RETURN key is pressed while focus is on the send box |
| PacketReceived |
|
the bot receives a packet on one of its internal sockets |
| PacketSent |
|
the bot sends a packet on one of its internal sockets |
| Event Name | Arguments | Description |
|---|---|---|
| UserEmote |
|
a user in the channel sends an emote (/emote or /me command) |
| UserInChannel |
|
occurs once for each user in the channel when the bot first joins it, and again whenever a user's statstring is updated |
| UserJoins | ||
| UserLeaves | ||
| UserTalk | ||
| WhisperFromuser | ||
| FlagUpdate | ||