• Log in or sign up for an account here: https://www.sythe.org/login

DaRk NiGhT's scripts and tutorials - by DaRk NiGhT

Six

Guru
Joined
Jan 21, 2007
Sythe Gold
12
Messages
1,482
Had to make 3 posts because its so freaking long :p

-
-
-
-





This thread is all of my scripts and tutorials. I hope this helps people as i see posts asking about autospammers and world switchers all the time. Along with things people always want to know about I have a tutorial on how to use INI files which i find to be very useful, especially for a client. XCLIENT itself stores 22 settings and variables in an INI file.

If you find errors make sure you tell me so i can fix them. If you have suggestions for tutorials PM/AIM/MSN me and i'll try to make it happen.

*This thread is locked to keep people from asking things here. If you have a question or want to report an error PM/AIM/MSN me.

Quick Links:
[Tutorial #1] World Switcher
[Tutorial #2] AutoSpammer
[Tutorial #3] Reading/Writing INI Files
[Tutorial #4] StealRS2
[Tutorial #5] AutoClicker
[Tutorial #6] Multi-User Auth System (PHP & MySQL)



[Tutorial #1] World Switcher (might be out-dated)

Alot of people want to include this in their client, and what would a client be without it. This tutorial explains how to make a world switcher two similar ways.

Skill Level: Medium

What you will need:
Visual Basic Standard/Pro/Enterprise (Im Using Version 6 Enterprise)
Basic Knowledge of Visual Basic
About 15 Minutes

Steps:

Step 1: Setting up the Form

You can set this up a few ways. You can use pictures, buttons, labels, alot of things. It doesnt matter what you use as long as they are named server1, server2, and so on.

Step 2: The Code

This is a function to get the worlds prefix. I recommend using this as its the easiest to update. You give this function a world number 1 through 121 and it returns that worlds prefix. (This method required you use the loadworld function given below and use the loadworld() code for the buttons/labels/whatever you use)


Code:
Private Sub getprefix(ByVal server As String)
Select Case server

Case 1
tempprefix = "ul2"
Case 2
tempprefix = "ul4"
Case 3
tempprefix = "po3"
Case 4
tempprefix = "po4"
Case 5
tempprefix = "po5"
Case 6
tempprefix = "po6"
Case 7
tempprefix = "above2"
Case 8
tempprefix = "above3"
Case 9
tempprefix = "above4"
Case 10
tempprefix = "jolt7"
Case 11
tempprefix = "jolt8"
Case 12
tempprefix = "jolt9"
Case 13
tempprefix = "nl3"
Case 14
tempprefix = "nl4"
Case 15
tempprefix = "uk2"
Case 16
tempprefix = "uk3"
Case 17
tempprefix = "tor1"
Case 18
tempprefix = "tor2"
Case 19
tempprefix = "nl7"
Case 20
tempprefix = "nl8"
Case 21
tempprefix = "nl11"
Case 22
tempprefix = "nl1"
Case 23
tempprefix = "uk4"
Case 24
tempprefix = "uk5"
Case 25
tempprefix = "nl12"
Case 26
tempprefix = "ul5"
Case 27
tempprefix = "nl5"
Case 28
tempprefix = "nl6"
Case 29
tempprefix = "ul6"
Case 30
tempprefix = "po7"
Case 31
tempprefix = "po8"
Case 32
tempprefix = "ul1"
Case 33
tempprefix = "at1"
Case 34
tempprefix = "at2"
Case 35
tempprefix = "at3"
Case 36
tempprefix = "at4"
Case 37
tempprefix = "tor3"
Case 38
tempprefix = "planet1"
Case 39
tempprefix = "planet2"
Case 40
tempprefix = "planet3"
Case 41
tempprefix = "planet4"
Case 42
tempprefix = "po2"
Case 43
tempprefix = "sl11"
Case 44
tempprefix = "at6"
Case 45
tempprefix = "planet5"
Case 46
tempprefix = "planet6"
Case 47
tempprefix = "above5"
Case 48
tempprefix = "above6"
Case 49
tempprefix = "ams1"
Case 50
tempprefix = "ams2"
Case 51
tempprefix = "ams3"
Case 52
tempprefix = "ams4"
Case 53
tempprefix = "ams5"
Case 54
tempprefix = "ams6"
Case 55
tempprefix = "ch1"
Case 56
tempprefix = "nl10"
Case 57
tempprefix = "ch3"
Case 58
tempprefix = "ch4"
Case 59
tempprefix = "ch5"
Case 60
tempprefix = "ch6"
Case 61
tempprefix = "se1"
Case 62
tempprefix = "se2"
Case 63
tempprefix = "se3"
Case 64
tempprefix = "se4"
Case 65
tempprefix = "se5"
Case 66
tempprefix = "se6"
Case 67
tempprefix = "jolt10"
Case 68
tempprefix = "jolt11"
Case 69
tempprefix = "jolt12"
Case 70
tempprefix = "sl10"
Case 71
tempprefix = "uk7"
Case 72
tempprefix = "sl1"
Case 73
tempprefix = "sl3"
Case 74
tempprefix = "sl4"
Case 75
tempprefix = "sl5"
Case 76
tempprefix = "sl6"
Case 77
tempprefix = "sl6"
Case 78
tempprefix = "sl7"
Case 79
tempprefix = "sl8"
Case 80
tempprefix = "jolt1"
Case 81
tempprefix = "jolt2"
Case 82
tempprefix = "jolt3"
Case 83
tempprefix = "jolt4"
Case 84
tempprefix = "jolt5"
Case 85
tempprefix = "ny1"
Case 86
tempprefix = "ny2"
Case 87
tempprefix = "ny4"
Case 88
tempprefix = "ny5"
Case 89
tempprefix = "ny6"
Case 90
tempprefix = "ny7"
Case 91
tempprefix = "ny8"
Case 92
tempprefix = "nl9"
Case 93
tempprefix = "mi1"
Case 94
tempprefix = "mi2"
Case 95
tempprefix = "mi3"
Case 96
tempprefix = "mi4"
Case 97
tempprefix = "mi5"
Case 98
tempprefix = "mi6"
Case 99
tempprefix = "mi7"
Case 100
tempprefix = "mi8"
Case 101
tempprefix = "at7"
Case 102
tempprefix = "at8"
Case 103
tempprefix = "at9"
Case 104
tempprefix = "at10"
Case 106
tempprefix = "uk9"
Case 107
tempprefix = "au1"
Case 108
tempprefix = "au2"
Case 109
tempprefix = "au3"
Case 110
tempprefix = "au4"
Case 111
tempprefix = "au5"
Case 112
tempprefix = "au6"
Case 113
tempprefix = "tor4"
Case 114
tempprefix = "tor5"
Case 115
tempprefix = "tor6"
Case 117
tempprefix = "swe1"
Case 118
tempprefix = "swe2"
Case 119
tempprefix = "swe3"
Case 120
tempprefix = "swe4"
Case 121
tempprefix = "swe5"
End Select

End Sub



This code is for the buttons/menu. As stated above your buttons must be labeled to match the code. (server1, server2, and so on) The variable, quality, is an integer and if it is 1 low-quality is used and if it is 0 high-quality is used. (This must be defined before the buttons are clicked, on form load or something)

There should be a peice of code like this for each button/menu item:

Code:
Private Sub server1_Click()
loadworld (1)
End Sub


The following code is for the loadworld function. This function takes a world number and loads the given world. Using this function requires you have the getprefix function from the beginning of the tutorial. As before, quality is either 1 for low-quality or 0 for high-quality. The tempprefix variable is created by the getprefix function and is a string.


Code:
Private Sub loadworld(ByVal worldnum As String)
getprefix (worldnum)
WebBrowser.Navigate ("http://" & tempprefix & ".runescape.com/lang/en/aff/runescape/game.ws?lowmem=" & quality & "&plugin=0&affiliate=runescape")
End Sub

Conclusion

The advantage of the loadworld() version is you can assign other variables at the same time you load the world. For example, in XCLIENT I use the loadworld function and at the same time I load the world i do some other operations like below:
Code:
currentworld.caption = worldnum

(this is much easier then adding that line of code for every world button u have)

This tutorial might be a little confusing for some but i tried to write it so it wouldnt be. Enjoy :)
 
[Tutorial #2] AutoSpammer Using SendKeys

This topic is commonly confusing for people. In the end its a very simple thing to use but there is sometimes a bit of confusing regarding where to put whatcode. This is what I intend to clear up.

Skill Level: Easy

What you will need:
Visual Basic Standard/Pro/Enterprise (Im Using Version 6 Enterprise)
Basic Knowledge of Visual Basic
About 10 Minutes

Steps:

Step 1: Setting up the Form
In this example we are going to make 2 autospammers. In your form you will need the following:

A Timer with the following properties:
Name: SpamTmr
Enabled: True
Interval: 300

A Textbox with the following properties:
Name: SpamTxt1
Text: AutoSpammer 1

A Textbox with the following properties:
Name: SpamTxt2
Text: AutoSpammer 2

If you want you can put labels next to the textboxes to show which key you push to use them. In this example SpamTxt1 will be F10 and SpamTxt2 will be F11.

Step 2: The Code
Now we will add the autospammer's code. Its very simple code but everything must be in the right place.

The first peice of code sets up the key listener. This allows the timer to know when you push keys. (In this case F10 and F11) This code goes at the very top of your forms code:


Code:
Option Explicit
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer


The next code tells the timer which keys to look for and what to do when they r pressed. This code goes in your forms code pretty much anywhere.


Code:
Private Sub SpamTmr_Timer()
    If GetAsyncKeyState(vbKeyF10) Then
        SendKeys SpamTxt1.Text
        SendKeys "{Enter}"
    End If

    If GetAsyncKeyState(vbKeyF11) Then
        SendKeys SpamTxt2.Text
        SendKeys "{Enter}"
    End If
End Sub

Conclusion

Thats it! Its very simple but yet very useful. Enjoy.







[Tutorial #3] Reading and Writing INI Files

This is a VERY useful thing to know. XCLIENT uses an INI files to store 150 settings.

Arrow Skill Level: Medium/Easy

Arrow What you will need:
Visual Basic Standard/Pro/Enterprise (Im Using Version 6 Enterprise)
Basic Knowledge of Visual Basic
Basic Knowledge of INI Files
About 10 Minutes



Steps:

Step One: Setting up the Form
This example will show you how to:
Read values from an INI file and put them in textboxes.
write values from textboxes to an INI file.
In your form you will need the following:

A Textbox with the following properties:
Name: TextBox1

A Textbox with the following properties:
Name: TextBox2

A Textbox with the following properties:
Name: TextBox3

A Button with the following properties:
Name: SaveButton
Caption: Save

Step 2: The Class Module
The easiest way I have found to use INI files is with a Class Module. (This might be the only way for all I know) Dont be afraid if you dont know what a Class Module is.

In Visual Basic go to Project and then Add Class Module (In the menu bar).
Select Class Module and then click Open.
Name the new Class Module ClsIniFile (This is important).
Paste the following code:


Code:
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private Declare Function GetPrivateProfileSection Lib "kernel32" Alias "GetPrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long

Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Private Declare Function WritePrivateProfileSection Lib "kernel32" Alias "WritePrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpString As String, ByVal lpFileName As String) As Long

Private Const BufferSize As Long = 4096

Private strIniFile As String

Public Property Get file() As String
    file = strIniFile
End Property

Public Property Let file(Value As String)
    strIniFile = Value
End Property

Public Function GetValue(strSection As String, strKey As String) As Variant
    Dim strBuffer As String
    Dim lLength As Long

    strBuffer = Space(BufferSize)

    lLength = GetPrivateProfileString(strSection, strKey, vbNullString, strBuffer, BufferSize, strIniFile)
   
    GetValue = Left(strBuffer, lLength)
End Function

Public Sub WriteValue(strSection As String, strKey As String, vntValue As Variant)
    WritePrivateProfileString strSection, strKey, CStr(vntValue), strIniFile
End Sub

Public Function GetSection(strSection As String) As Variant
    Dim strBuffer As String
    Dim lLength As Long

    strBuffer = Space(BufferSize)

    lLength = GetPrivateProfileSection(strSection, strBuffer, BufferSize, strIniFile)
   
    GetSection = Split(Left(strBuffer, lLength), vbNullChar)
End Function

Public Function GetSectionKeys(strSection As String) As Variant
    Dim strBuffer As String
    Dim lLength As Long

    strBuffer = Space(BufferSize)

    lLength = GetPrivateProfileString(strSection, vbNullString, vbNullString, strBuffer, BufferSize, strIniFile)
   
    GetSectionKeys = Split(Left(strBuffer, lLength), vbNullChar)
End Function


The class module is now done and you shouldn't have to edit it anymore.

Step 3: Reading from the INI File
First we're going to read values from the INI file and put them in textboxes. For simplicity we're going to do this on Form_Load:


Code:
Private Sub Form_Load()
Dim Ini As ClsIniFile
Set Ini = New ClsIniFile

With Ini
.file = App.Path & "\Messages.ini"
message1 = .GetValue("Messages", "message1")
message2 = .GetValue("Messages", "message2")
message3 = .GetValue("Messages", "message3")
End With

Textbox1.Text = message1
Textbox2.Text = message2
Textbox3.Text = message3
End Sub


Before we move on, lets explore this code a bit. (You can skip this if you understand whats happening)

First we are stating what Ini is. Its being declared as a ClsIniFile here.
Then we are stating which INI file to use. In this case, Messages.ini (\Messages.ini means that Messages.ini is in the same directory as the programs exe)
Next we are doing a few things:
message1 = .GetValue("Messages", "message1")
1. We state we want to assign the value to message1
2. State we want to GetValue (Get the value from the INI file)
3. State which section of the INI file the value is in, in this case, Messages.
4. State which value we want, in this case, message1.
We have a line like this for every value we want to get from the INI file. In this example there are 3 of these lines, one for each message.

After we have assigned the values from the INI files to visual basic variables we can fill the textboxes with code like this:
Textbox1.Text = message1

Step 4: Writing to the INI File
Now that we have read values from the INI file, we will probably want to write new ones. This can be done with the following code:


Code:
Private Sub Save()

Dim Ini As ClsIniFile
Set Ini = New ClsIniFile

With Ini
.file = App.Path & "\Messages.ini"
.WriteValue "Messages", "message1", Textbox1.Text
.WriteValue "Messages", "message2", Textbox2.Text
.WriteValue "Messages", "message3", Textbox3.Text
End With

End Sub
(In this example, instead of putting the save code right in the button, im putting it in its own function called Save.)

Before we move on, lets explore this code a bit. (You can skip this if you understand whats happening)

First we do the same as when we read the INI file. (Stating that Ini is a ClsIniFile and stating which INI file to use.)
Next we do a few things:
.WriteValue "Messages", "message1", Textbox1.Text
1. We state that we want to Write to the INI file. (WriteValue)
2. We state which section we want to write to, in this case, Messages.
3. We state which value to write to, in this case, message1.
4. We state which value to write to the file. Here, we are writing the contents of Textbox1 directly to the INI file.

Thats pretty much all there is to the Save function. You could put the same code for a buttons action if you wanted.

Since we have writing to the INI file as its own function, we have to tell the program what to do when we click the Save button:


Code:
Private Sub SaveButton_Click()
Call Save
End Sub


Step 5: The INI File
Here is this examples INI file:


Code:
[Messages]
Message1=Sythe.org
Message2=Is
Message3=Awesome


[Messages] is the section of the file and Message1, Message2, and Message3 are the different values. INI files are very simple. (Every value goes on its own line.)

Conclusion

I hope this helps anyone wanting to utilize INI files. Enjoy.


[Tutorial #4] StealRS2

Anyone wanting to make a Visual Basic client should know how to use StealRS2. StealRS2 removes the add from the top of the page and also removes the Jagex bar. (with the links to join members and such)

Skill Level: Easy

What you will need:
Visual Basic Standard/Pro/Enterprise (Im Using Version 6 Enterprise)
Basic Knowledge of Visual Basic
About 5 Minutes

Steps:

Step One: Setting up the Form
For this example you will need a WebBrowser and a button.

Step 2: The Code
The following code goes in a module. (Go to Project and then Add Module) Name the module StealRS2


Code:
Public Const SWP_NOSIZE = &H1
Public Const HWND_TOP = 0
Public Const SWP_NOOWNERZORDER = &H200
Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long

Public Function StealRS2(Frm As Form)
    On Error Resume Next
   
    Dim RSHwnd As Long
    Dim RSSunJava As Long
   
    DoEvents
    RSHwnd = FindWindowEx(Frm.hwnd, 0, "shell embedding", vbNullString)
    RSHwnd = FindWindowEx(RSHwnd, 0, "shell docobject view", vbNullString)
    RSHwnd = FindWindowEx(RSHwnd, 0, "internet explorer_server", vbNullString)
    RSSunJava = FindWindowEx(RSHwnd, 0, "Java Plug-in Control Window", vbNullString)
    RSSunJava = FindWindowEx(RSSunJava, 0, "sun.plugin.viewer.frame.IExplorerEmbeddedFrame", vbNullString)
    'RSSunJava = FindWindowEx(RSSunJava, 0, "SunAwtCanvas", vbNullString)
    'RSSunJava = FindWindowEx(RSSunJava, 0, "SunAwtCanvas", vbNullString)
    RSHwnd = FindWindowEx(RSHwnd, 0, "microsoft vm for java(tm) host window class", vbNullString)
    RSHwnd = FindWindowEx(RSHwnd, 0, "msawt_comp_class", vbNullString)
    If RSHwnd = 0 Then RSHwnd = RSSunJava
    If RSHwnd = 0 Then Exit Function
    SetParent RSHwnd, Frm.hwnd
End Function


The next peice of code goes in the forms code. This code is executed when the WebBrowser's progress changes. Make sure that this code matches the name of your WebBrowser.


Code:
Private Sub WebBrowser_ProgressChange(ByVal Progress As Long, ByVal ProgressMax As Long)
On Error Resume Next
StealRS2 Me
End Sub


Conclusion

This code is fairly simple and very powerful/useful. Enjoy.








[Tutorial #5] AutoClicker

Another common task for anyone wanting to make a client.

Skill Level: Easy

What you will need:
Visual Basic Standard/Pro/Enterprise (Im Using Version 6 Enterprise)
Basic Knowledge of Visual Basic
About 5 Minutes

Steps:

Step 1: Setting up the Form

You can do this a variety of ways but in this example we will need:

A Timer with the following properties:
Name: ClickTimer
Enabled: False

A Button with the following properties:
Name: StartButton
Caption: Start

A Button with the following properties:
Name: StopButton
Caption: Stop

A Textbox with the following properties:
Name: ClickInterval
Text: 5


Step 2: The Code
Now we will add the core to the autoclicker. It's rather simple code.

The first peice of code goes at the top of your project and declares some mouse functions:


Code:
Private Const MOUSEEVENTF_LEFTDOWN = &H2      ' left button down
Private Const MOUSEEVENTF_LEFTUP = &H4        ' left button up
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)


The following code goes in the Start button:


ClickTimer.Interval = (ClickInterval.Text * 1000)
ClickTimer.Enabled = True


The next code goes in your timer:


Code:
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0


The last peice of code goes in your Stop button:


Code:
ClickTimer.enabled = False


Conclusion:
Thats all there is to it. Put how often, in seconds, you want the clicker to click and hit start.
 
[Tutorial #6] Multi-User Auth System Using PHP and MySQL

With so many people creating clients and various other programs, there is a need for auth systems. Some stupid people just use text files on webservers while other smart people, who want people to actually buy auths, use various other methods. This tutorial will explain how to create a secure, multi-user auth system with 3 common things, PHP, MySQL, and of course Visual Basic.

Skill Level: Medium

What you will need:
Visual Basic Standard/Pro/Enterprise (Im Using Version 6 Enterprise)
Basic Knowledge of Visual Basic
Basic Knowledge of PHP
Basic Knowledge of MySQL
About 10 Minutes

Steps:

Step 1: Setting Up MySQL
This tutorial requires that you have a MySQL database somewhere and access to it through something like phpMyAdmin.

For this example, we'll create a database called TestAuths. Below is a query you can run to create the database. Basic MySQL knowledge is required and in the PHP steps you NEED to know your MySQL server's address, database password, and database username.


Code:
CREATE DATABASE testauths


Next, we need to add a table called Licenses. Below is a query you can run to create the table.


Code:
CREATE TABLE licenses (username varchar(200), code varchar(200))


Now lets create a test auth. Below is a query you can run to add a test auth.


Code:
INSERT INTO licenses VALUES ('bob', '5555555')


Now that we have a database with a table and a test auth, we can move on. If you have problems with the above queries, make sure you check you have copied everything correctly. Different versions of MySQL might use different syntax so you might need to modify the code i have supplied.

Step 2: The PHP File
The PHP file is like a middleman. Visual Basic uses the PHP file to connect to the database and verify the auth. Below is a link to a sample PHP file which you could use. Its basic and could be modified to include things like IP checks. You will need to the following code into a file called checkauth.php and put it on a webserver. MAKE SURE YOU REMEMBER WHERE YOU PUT IT AND READ THE INSTRUCTIONS BELOW THE CODE BLOCK.

Click Here for the PHP

This code might look intimidating but its not that bad. MAKE SURE YOU CHANGE THE CONNECTION VARIABLES TO YOUR OWN. I filled in the name of the database we created before, if you did something else, make sure you put your databases name in.

Step 3: Using the above in Visual Basic
Now we'll integrate the above into Visual Basic. Remember, this is a basic example, you can add things like IP checks and other stuff later if you know how.

SubStep A:
In Visual Basic, create a form with the following:

A Textbox with the following properties:
Name: usernametxt

A Textbox with the following properties:
Name: codetxt

A Button with the following properties:
Name: checkauth
Caption: Check Auth

A Inet with the following properties:
Name: Inet1

SubStep B:
Now for the code! The following code must be modified. Below the code block is instructions on what to modify.

Code:
Private Sub checklic_Click()

Dim licurl as String
Dim authresult as String

licurl = "http://webserver.com/checkauth.php?name=" + usernametxt.Text + "&code=" + codetxt.Text

authresult = Inet1.OpenURL(licurl)

If authresult = "1" Then
MsgBox "Auth Accepted!"
Else
MsgBox "Auth Denied!"
End If

End Sub


You must change the following in the above code:
-- Change http://webserver.com to where you put your checkauth.php file.
-- Where MsgBox "Auth Accepted!" is you can do things like set variables to true so things that require an auth work. In XCLIENT for example, your auth is saved to an INI file here.
-- Where MsgBox "Auth Denied!" is you can do things like close the program or just leave it the way it is and allow people to retry.

Conclusion
The above steps are complicated but if you get it to work its worth it. Please keep in mind that auth codes are sent in plain text and could be phised (or w/e its called). If you want to add encryption like MD5, you can encrypt the auth codes before you put them in the database and before they are sent from visual basic. A tutorial on using MD5 in visual basic might come soon.....

Hope this helps some people!
 
Runescape Gamblingrunescape gambling
Back
Top