Plugin system

From StealthBot Wiki
Revision as of 13:41, 26 August 2009 by Ribose (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Legacy Information

This page presents information for this legacy feature of StealthBot. There is an alternative, superior method for accomplishing the same thing in the newest version. This information is only provided for backwards compatibility and historical reasons.

The Plugin system was a script written for version 2.6 of StealthBot's Scripting system in order to accomplish the loading of multiple scripts for versions before 2.7. Scripts written for the Plugin System were called Plugins and had a slightly modified structure in order to function.


The idea of the plugin system was originally from Xellos. In 2006, Swent rewrote the plugin system, later incorporating an update plugin by FiftyToo and a help plugin by Hdx into the core functionality of the system. When development for version 2.7 was opened to more people, Swent incorporated some of the plugin system into the bot itself, adding a new UI feature: the menu system. Later Eric redid the script system, making the plugin system obsolete due to the ability of the enhanced script system to do everything the plugin system could and more by using the Script Control's built-in modules. The Plugin System is still available for use on the script repository as a stand-alone script that loads plugins in the Plugins\ folder.


The Plugin System used the #include directive in the script.txt file to #include pluginsystem.dat where the actual Plugin System code is found. When the Plugin System itself was made a 2.7-style script, the code is now all in the pluginsystem.txt file, and no longer uses the #include directive.

The code loads plugins directly into the current Script Control module, making all global variables, functions, and classes public to all other plugins. If any two plugins have global variables, functions or classes named the same, errors or unexpected behavior occur. Upgrading plugins to 2.7-style scripts is recommended.


Main article: Plugin

The Plugin System loads files with the .plug or .txt extension with a comment header. Prefixes are used to keep Script events, global variables, custom functions, and classes unique from other plugins' members.


There are several plugin system commands to control plugins and updating.

List of commands

Prefix command

The prefix command allows you to enable and disable plugins or the entire system.


<trigger><prefix> <on/off>

[04:05:41 PM] <Stealth> .example off
[04:05:41 PM] <StealthBot> The example plugin has been disabled.

Updates command

The updates command shows available plugin updates. When used in-bot, this command will display more extensive information about plugin updates.


External example

[04:05:42 PM] <Stealth> .updates
[04:05:42 PM] <StealthBot> Plugin Downloads: afk, alert, as, load, arc, bcp, beep, bns, cs, crs, rt, dict, utforms, gamble, is, trans, m8bs, pm, pkick, p, pingb, qtkick, rpk, recruit, scramble, (ss), st, spc, teamrand, timeban, comments, ulm, [more]
[04:05:42 PM] <StealthBot> vlc, ws, weatherinfo

Internal example: typed /updates

[04:22:52 PM] Official StealthBot Plugins and Updates
[04:22:52 PM]
Color Key: New, Updated, Installed
[ AFK ]
Author: Swent Version: 1.3
Description: Keeps track of AFK (Away From Keyboard) users in your channel.
Prefix: afk

[ Alerter ]
Author: SoCxFiftyToo Version: 1.5
Description: Your very own Battle.Net alarm clock. Set alerts and reminders.
Prefix: alert

[ Anti-Spam ]
Author: Swent Version: 1.35
Description: Punishes users who talk too quickly. *Not a measure against mass load/flood attacks*
Prefix: as

[ Application Loader ]
Author: SoCxFiftyToo & Jack Version: 1.71
Description: Use inbot commands to open specific applications.
Prefix: load

[ Auto-Reconnect Plugin ]
Author: ZergMaster Version: 1.1
Description: This script will automatically reconnect or connect your bot when it is not online.
Prefix: arc

[ Baal Channel Project ]
Author: IAreConnection Version: 2.0
Description: Allows you to traffic and record specific Diablo II baal games.
Prefix: bcp

[ Beep ]
Author: Ribose Version: 3.253
Description: Allows you to 'beep' or page the bot owner.
Prefix: beep

[ BnetStats ]
Author: Swent Version: 1.2
Description: Keeps track of interesting bot statistics.
Prefix: bns

[ Channel Calendar ]
Author: Darkness Version: 1.3
Description: Send important date reminders to users joining your channel with this plugin.
Prefix: cs

[ Clan Rank Script ]
Author: Swent Version: 2.821
Description: A powerful member ranking system for your clan.
Prefix: crs

[ Clan Recruitment Test ]
Author: The-Black-Ninja Version: 3.0
Description: Asks random recruitment questions to a potential member.
Prefix: rt

[ Dictionary ]
Author: DeadlyWorkz Version: 1.04
Description: Looks up definitions through MSN's Encarta.
Prefix: dict

[ Forms Utility ]
Author: FiftyToo Version: 1.4
Description: A utility plugin for common forms (Beta Only)
Prefix: utforms

[ Gamble Script ]
Author: raylu Version: 1.31
Description: A simple game that involves gambling
Prefix: gamble

[ Idle System ]
Author: Draco & Alendar Version: 1.5
Description: A idle system in which you can set your current status/mood and your current project.
Prefix: is

[ Language Translation ]
Author: SoCxFiftyToo Version: 2.24
Description: Translate messages from one language to another.
Prefix: trans

[ Magic 8 Ball ]
Author: Unknown Version: 1.7
Description: Gives you answers to yes/no questions.
Prefix: m8bs

[ Pelt Me Script ]
Author: Swent Version: 2.42
Description: Fun script which allows users to throw random things at each other.
Prefix: pm

[ Phrase Kick ]
Author: Damien Version: 1.24
Description: Kicks and timebans users that say specific phrases.
Prefix: pkick

[ PimpList ]
Author: Jack Version: 1.35
Description: A condition-based multiple greeting script.
Prefix: p

[ Ping Ban ]
Author: The-Black-Ninja Version: 2.12
Description: Kicks/bans users if their ping exceeds a specified limit.
Prefix: pingb

[ Quiet-Time Kicker ]
Author: Alender Version: 1.3
Description: Same as StealthBot's built in Quiet Time, but kicks instead of bans.
Prefix: qtkick

[ Random Phrase Kicker ]
Author: PyroManiac Version: 1.4
Description: Specify users to get phrasekicked for a random word everytime they talk. Very amusing.
Prefix: rpk

[ Recruit and Apply ]
Author: The-Black-Ninja Version: 2.42
Description: Allows automated stats checking, recruiting, and inviting of users into your clan.
Prefix: recruit

[ ScrambleBot ]
Author: SoCxFiftyToo Version: 6.02
Description: A game where players need to unscramble a word first.
Prefix: scramble

[ Seen Script ]
Author: J3m Version: 1.33
Description: Keep track of your clan members with this powerful script.
Prefix: ss

[ SnapNJacks Trivia ]
Author: Snap Version: 0.849
Description: Chat Trivia. No questions.txt required! Downloads questions from: - questions.txt files are supported too.
Prefix: st

[ Speed Challenge ]
Author: Swent Version: 5.69
Description: Random text is displayed in the channel and the first user to type it in correctly wins.
Prefix: spc

[ Team Randomizer ]
Author: SoCxFiftyToo Version: 1.331
Description: Used to quickly pick random teams for a game.
Prefix: teamrand

[ TimeBan ]
Author: Swent Version: 1.381
Description: Lets you ban a user for a specified amount of time.
Prefix: timeban

[ User and Leader Comments ]
Author: SoCxFiftyToo Version: 1.3
Description: Allows users to write personal comments or comments that can be viewed by everyone.
Prefix: comments

[ User Leave Log And Messaging ]
Author: Swent Version: 1.35
Description: Displays the name of the game/channel that users join and logs joined game data.
Prefix: ulm

[ VLC Controller ]
Author: SoCxFiftyToo Version: 1.3
Description: Used to control VLC Player (for people streaming music!!) Requires .Net 2.0 Framework
Prefix: vlc

[ Warn Script ]
Author: Swent Version: 1.6
Description: Allows you to warn users. Users who exceed a specified warn limit are banned.
Prefix: ws

[ Weather Info ]
Author: #define Version: 1.2
Description: Finds current weather conditions for a specified location.
Prefix: weatherinfo

[04:22:52 PM] To download one of the plugins above, type /getplugin <prefix>

Pinitperf command

This command displays the initialization time for a plugin, in milliseconds.



This command only works internally.

Example: typed /pinitperf

[04:44:51 PM] Plugin initialization performance:
[04:46:51 PM] arc 62ms
[04:46:52 PM] ss 156ms


The plugin system provided several functions for use in plugins for standardizing plugin settings, timers, menus, and

List of functions

PluginEnabled function

This function turns the specified plugin on or off.


PluginEnabled <prefix>, <enabled>

Example: Turn off a plugin with the prefix "example".

PluginEnabled "example", False

GetPluginEnabled function

This function returns whether the specified plugin is enabled.


<enabled> = GetPluginEnabled(<prefix>)

Example: Do something specific if the timeban plugin is enabled.

If GetPluginEnabled("timeban") Then
    ' ...
End If

TimerInterval function

This function sets a plugin timer to a certain interval in seconds.


TimerInterval <prefix>, <timername>, <interval>

Example: Set the "example" plugin's "example" timer to fire every minute.

TimerInterval "example", "example", 60

GetTimerInterval function

This function returns the specified plugin timer's interval in seconds.


<interval> = GetTimerInterval(<prefix>, <timername>)

Example: Print the number of seconds between each timer tick for the "example" plugin's "example" timer.

AddChat vbCyan, "The timer will execute every " & GetTimerInterval("example", "example") & " seconds."

TimerEnabled function

This function sets a plugin timer to on or off.


TimerEnabled <prefix>, <timername>, <enabled>

Example: Enable the "example" plugin's "example" timer.

TimerEnabled "example", "example", True

GetTimerEnabled function

This function returns whether the specified plugin timer is enabled.


<enabled> = GetTimerEnabled(<prefix>, <timername>)

Example: Do something if the "example" plugin's "example" timer is enabled.

If GetTimerEnabled("example", "example") Then
    ' ...
End If

TimeLeft function

This function sets the number of seconds until a plugin timer will next execute.


TimeLeft <prefix>, <timername>, <seconds>

Example: Force the "example" plugin's "example" timer to execute in about one second.

TimeLeft "example", "example", 1

GetTimeLeft function

This function returns the number of seconds left until the next time the specified plugin timer executes.


<seconds> = GetTimeLeft(<prefix>, <timername>)

Example: Print the number of seconds until the next timer tick for the "example" plugin's "example" timer.

AddChat vbCyan, "The timer will execute in " & GetTimeLeft("example", "example") & " seconds."

GetTimerWaiting function

This function returns the number of seconds since the last time the specified plugin timer was executed.


<seconds> = GetTimerWaiting(<prefix>, <timername>)

Example: Print the number of seconds since the last timer tick for the "example" plugin's "example" timer.

AddChat vbCyan, "The timer was executed " & GetTimerWaiting("example", "example") & " seconds ago."

GetSetting function

This function retrieves a setting from the plugin system's setting.ini file.


<value> = GetSetting(<prefix>, <key>)

Example: Get the "example" plugin's "example" setting value.

AddQ "The example value is " & GetSetting("example", "example")

SetSetting function

This function saves a setting to the plugin system's setting.ini file.


SetSetting <prefix>, <key>, <value>, <comment>, <overwrite>

The comment value can be ommitted and the currently stored comment will be untouched. If the overwrite argument is True, the plugin system will always change the value. It was standard to set the override to False, and call SetSetting with a comment and the default <value> on plugin load, so that default values for plugins would be set, if they were not already. Example: This setting will not be set by Event_Load() unless the setting doesn't exist in which case it will be. On Event_Close(), will always be changed.

Sub example_Event_Load()
    SetSetting "example", "example", "this is the value of the example setting!", "Here is a sample comment.", False
End Sub

Sub example_Event_Close()
    SetSetting "example", "example", "this is the new value of the example setting!", vbNullString, True
End Sub

Dsp function

Main article: Dsp function

The Dsp() function was originally part of the plugin system, but has since been moved to the Script Support Class.


Several color constants were globalized for the plugin system:

  • vbGrey was gray. Yes, it was incorrectly spelled. Generate with the hex &H8C8C8C or RGB(140, 140, 140).
  • vbBrown was brown. Generate with the hex &H13458B or RGB(139, 69, 19).
  • vbOrange was orange. Generate with the hex &H0099FF or RGB(255, 153, 0).
  • vbPink was pink. Generate with the hex &HCC99FF or RGB(255, 153, 204).
  • vbLightBlue was light blue. Generate with the hex &HCC6600 or RGB(0, 102, 204).

See also