Author Topic: Teaching VBS  (Read 1070 times)

ArticWolve

  • Global Moderators
  • Hero Member
  • *****
  • Posts: 636
    • View Profile
    • http://
Teaching VBS
« on: March 12, 2009, 09:35:29 AM »
In my three years of scripting for stealth bot, and four years of actually using it, I have decided that that it's time to make a basic tutorial of certain things that people should know before they begin their first script.

This thread serves two purposes, with the first being to share the knowledge of all kinds of scripters and secondly, to help new scripters come up to par with me or the next guy really quickly. So if you want to contribute, or ask a question, PLEASE dot your I's and cross your T's and keep it clean, and understandable.

I could just send Joel my PDF files to host in regards to this, but who wants to read about six or seven hundred pages? I know I don't have time for that with two kids, a pregnant wife, working from the house, cooking meals (Yes I am the one who cooks, not my wife), and the odd job here or there for a friend to make an extra hundred.

Now instead of jammering my fingers away for nothing, I am telling you that I will be covering several CORE BASIC areas for those of you who want to learn VBS. Keep in mind that I am assuming that you have no programming/coding knowledge.

Items in GREEN are finished. Items in RED are not even started. Items in BLUE are started, but not finished.
First is the format for plugins (The outline) [Reference for the list of subs here].
Second are variables and what you can use them for.

Third are various words and other things that you will use frequently in your plugin(s).
Fourth are commands (No Command Processor)
Fifth is an introduction to custom subs
Sixth is Commands using a custom sub.
Seventh is basic parsing.


And what anyone else has to chip in!



I) Introduction to the Plugin Format

You may be wondering of the plugin format, well simply put, each plugin has a similar structure and that structure is called Hungarian Notation. Wow a big name! Don't worry about it. Most people don't even know what it's called. Anyways, that is the format you us, and for reference purposes, I will be using several scripts to identify key features of it.

Example Plugin:
Code: [Select]
'Prefix
'1.0
'& Plugin Name: Author: General Description

MY PLUGIN USING HUNGARIAN NOTATION
Code: [Select]
'Ex
'1.0
'& Example Plugin: ArticWolve: Basic layout of scripts using Hungarian Notation

' <-- This " ' " means that this is a commented out line is not used in the actual Code/Script.
Sub Ex_Event_Load() ' <-- This line up to the ' is included.
  AddChat VBPink, "You may find the full reference of SUBS and EVENTS at: http://www.stealthbot.net/board/index.php?showtopic=22480."
End Sub ' <-- Same with this one.

Okay now I bet you are wondering about that AddChat.... argument. It'll be explained later on in section 3.

Now seeing as I referenced you to here to see all the other subs and events for plugins, I think you should be warned that this site is in NO WAY IN CONTROL of what you post at that site. If you break their rules, then you pay the price. With that out the way, ALWAYS REMEMBER TO PUT whatever PREFIX is before ANY SUB or FUNCTION!

II) Variables

Now in all honesty, you will be using VARIABLES in almost every script you do. Why? Simply because they keep you from having to retype lines of code or store information for use later. Variables are actually defined by a use of the Plugin Prefix and a short, but simple, name. So ExVariable is actually NOT a good variable because to me, that is too long. However, ExVar01 is much shorter but serves no purpose to the scripter reading my code (which most the time I don't want people to read). Yet as a beginner, you always want to understand your code. So be concise when naming your variables. So if you have a variable that stores a number, put ExNum01.

Important note: NEVER USE THE SAME VARIABLE IN TWO DIFFERENT PLUGINS! It will cause massive errors in one or the other. That is why you should ALWAYS use the plugin's prefix before the variable's name!

Example defining a variable:

Code: [Select]
ExNum = "30"
Why would I use a variable to store a number? Simply put, for a command to change the time for when a timer event is executed.

Now for variables that store data, it would be good for PARSING, which is covered later in the parsing section.

III) Common words and phrases

Seeing as you were referenced to the Subs and Functions page on Stealthbot.net, I think it is time to cover the list of most frequent words and phrases that you will use in your script(s).

*AddChat VBColor, -- To put out a text viewing of something that YOU as the scripter only want the user to see. Color can be changed to Pink, Cyan, Blue, Orange, Yellow, Red, or Green. Remember to keep the VB before the color and the comma (,) afterwords.
Usage example: AddChat VBPink, "Test"

*If...Then -- Direct Condition-Action relationship. This is the most WIDELY used statement. This allows you to have XX action if YY condition is met.
Usage Eample:
If ExVar >= 2 Then Exit Sub

Second Example:
If ExVar >= 2 Then
  Exit Sub
End If

Note: The first and second are equivalent to each other, EXCEPT the second one requires more typing. Only use the second if you are doing more then exiting the sub.  Please also note that If, Then, End if is more widely used and makes code cleaner to look at.  -Ace

*Exit Sub -- Cancel the sub and no longer move forward.
[See above for usage]

*GetDBEntry Username, Access, Flags
-GetDBEntry Username, a, f

Both are the same, just naming the variables differently.  Basically, this is ALWAYS used before commands (covered later)
« Last Edit: March 15, 2009, 08:27:56 AM by Ace »
Quote
Darker then the darkest shade of night...
    A Rebel at heart... A criminal by mind
    All in the eyes of the beholder... is the truth to life
    But Th---The Only---The One and Only True Master of Death is the Reaper itself
[/color]
[/color]
[div align=\'center\'][img]http://img261.imageshack.us/img261/9411/mydesktopce6.jpg\" border=\"0\" class=\"linked-sig-image\" /][img]http://www.danasoft.com/sig/238153.jpg\" border=\"0\" class=\"linked-sig-image\" /][/div]                     [div align=\'center\']    Click ME for my forums. You know you want to click ME. Come on CLICK ME DAMN IT! But don't click THIS!![/div]

ArticWolve

  • Global Moderators
  • Hero Member
  • *****
  • Posts: 636
    • View Profile
    • http://
Teaching VBS
« Reply #1 on: March 12, 2009, 04:49:21 PM »
This is in Group Projects to gather information from more then one person. Please only contribute VBScript information in regards to Stealth Bot plugins! No other VBS should be posted here.
Quote
Darker then the darkest shade of night...
    A Rebel at heart... A criminal by mind
    All in the eyes of the beholder... is the truth to life
    But Th---The Only---The One and Only True Master of Death is the Reaper itself
[/color]
[/color]
[div align=\'center\'][img]http://img261.imageshack.us/img261/9411/mydesktopce6.jpg\" border=\"0\" class=\"linked-sig-image\" /][img]http://www.danasoft.com/sig/238153.jpg\" border=\"0\" class=\"linked-sig-image\" /][/div]                     [div align=\'center\']    Click ME for my forums. You know you want to click ME. Come on CLICK ME DAMN IT! But don't click THIS!![/div]