Script object

From StealthBot Wiki Backup
Jump to: navigation, search

The Script object is a standard Scripting.Dictionary provided by StealthBot per script module to store script information. The bot uses keys set in the object after the initial execution of the script (before events are called).

Keys

StealthBot uses the following Scripting.Dictionary keys in the Script object:

  • "Path" is set by StealthBot before loading the script. It contains the path to the current script. Modification may cause the menu item Scripting > Script("Name") > View Script to act unexpectedly.
  • "InitPerf" is set by StealthBot after loading the script (but before calling Event_Load()). It contains the time in milliseconds it took to load the script. Modification will change the values as seen by the initperf command.
  • "Name" should be set by the script in the global scope (not in methods or members of classes). If this key is not set, the bot will default to loading the script with a name based on its file name. The key will then be set automatically.
  • "Author" should be set by the script in the global scope (not in methods or members of classes). It should be the author or authors of the script.
  • "Major" should be set by the script in the global scope (not in methods or members of classes). It should be the major version number of the script. It is standard to increment this value on major changes to the script.
  • "Minor" should be set by the script in the global scope (not in methods or members of classes). It should be the minor version number of the script. It is standard to increment this value on minor changes to the script.
  • "Revision" should be set by the script in the global scope (not in methods or members of classes). It should be the revision version number of the script. It is standard to increment this value on small revisions to the script.

Internal use

StealthBot uses the above keys for the following:

  • The bot extensively uses the "Name" value for script identification. The enable, disable, and sdetail commands use it as the required argument. The Scripting menu system menu items use the name. The name is also used to access other scripts using the Scripts object.
  • The "Author" and version number values are used for the sdetail command.
  • The "Path" value is used for the Scripting > Script("Name") > View Script menu item to open the script.
  • The "InitPerf" value is used by the initperf command.

External use

Scripters are free to use the openness of the Script object to their advantage. Example uses:

  • Checking version numbers with an online repository to create an update script.
  • Creating custom "Description" or "Settings" keys to store information that could be used for a global script management GUI script.

See also