The plugin format is slightly different than the script format.
Here is a guide of changes that need to be done in order to convert a plugin to a script. These are general guidelines on how conversions should be done. If you'd like to change functionality or rewrite a script completely in the new script format, using these guidelines is not recommended if you would like to take full advantage of new script system features.
Plugin header to script header
A comment header is ignored by the script system, so the comments can be changed to whatever you want.</li> At the beginning of the new script, we need to populate the Script dictionary for the script system.
'example '1.63 '&Sample Plugin:SomePerson:This plugin is a sample used on the StealthBot Wiki. '&example:samplecmd '&9001 '&important note #1:important note #2
Script("Name") = "Sample" Script("Author") = "SomePerson" Script("Major") = 1 Script("Minor") = 63 Script("Revision") = 1 Script("Description") = "This script is a sample used on the StealthBot Wiki."
The name should be one word or two. Do not make this excessively long or tedious because the internal script commands require the full name.
The author name should be kept as shown.
The major should be the number to the left of the dot, the minor should be the number to the right, and revision should be 1 since you are revising it but not changing the functionality.
StealthBot itself ignores the Description key, but some future scripts might use the field to present useful information to the user.
You may want to leave unconverted comments for later in case such a future script optionally checks for such information and you can put it in the Script object then.
The prefix in front of all script events in the plugin must be removed to function. The prefix in front of global variable names, custom function names, and class names may be removed for readability. They are removable because the Script Control modules are each separate, and it is not possible for identifier names to conflict anymore. Important: all calls to changed variable names, function names, and class names must be changed also in uses of the variables and classes and calls to the functions in code.
Private Const example_ConstantVar = "constantval" Private example_GlobalVar Sub example_Event_Load() Set example_GlobalVar = New clsExample_CustomClass Call example_CustomFunction1(example_ConstantVar) End Sub Function example_CustomFunction1(argA) ' code End Function Class clsExample_CustomClass ' code End Class
Private Const ConstantVar = "constantval" Private GlobalVar Sub Event_Load() Set GlobalVar = New clsCustomClass Call CustomFunction1(ConstantVar) End Sub Function CustomFunction1(argA) ' code End Function Class clsCustomClass ' code End Class
Use of plugin system functions
The plugin system functions have been replaced with better methods of doing the same thing.
- PluginEnabled() is replaced with an OOP-style call to the script in question's WriteSettingsEntry function.
PluginEnabled <prefix>, <enabled>
GetScriptByName(<name>).WriteSettingsEntry "Enabled", <enabled>
<enabled> = GetPluginEnabled(<prefix>)
<enabled> = GetScriptByName(<name>).IsEnabled()
TimerInterval <prefix>, <timername>, <interval> TimerEnabled <prefix>, <timername>, <enabled>
CreateObj "LongTimer", "<timername>" With <timername> .Interval = <interval> .Enabled = <enabled> End With
If GetTimerEnabled(<prefix>, <timername>) Then ' ... End If
If <timername>.Enabled Then ' ... End If