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

Code Release!

speljohan

Guru

Visual Basic Programmers
Joined
Apr 24, 2005
Sythe Gold
0
Messages
1,450
Age
35
Location
Sweden, Laholm
Ok, i decided to release some of my code.

Retrieving all worlds in a string array

This will return all the worlds along with their info in a string array.

Code:
    Public Function getWorldArray() As String()
        Dim output() As String = Nothing
        Dim i As Integer = 0
        Dim src As String = New Net.WebClient().DownloadString("http://www.runescape.com/slj.ws?lores.x=366&lores.y=232&plugin=0")
        Dim tmp As String
        matches = regex.Matches(src, "\(\d{1,3},\d{1},\d{1},(" & Chr(34) & "\w{1,10}" & Chr(34) & "),\d{1,4},\d{1,3}\)")
        For Each match In matches
            tmp = match.Value
            tmp = tmp.Remove(InStr(tmp, ")") - 1)
            tmp = tmp.Remove(InStr(tmp, "(") - 1, 1)
            tmp = tmp.Replace(Chr(34), "")
            output(i) = tmp
            i += 1
        Next
        Return output
    End Function

Usage: Just call the code wherever you want like this:
Code:
Dim worldinfo() As String = getWorldArray()

Now, the world information is separated by commas in each string of the array like this:
worldNumbers,Members(0=False,1=True),Status(0=Online,1=Offline,2=Full),worldPrefix,playersOnline,playerLocation

worldLocation is a number, and here is a table of the representation:
Code:
            Case 0 : Return "US West 1"
            Case 1 : Return "US West 2"
            Case 2 : Return "US West 3"
            Case 3 : Return "UK 2"
            Case 4 : Return "US West 5"
            Case 5 : Return "UK 1"
            Case 6 : Return "Canada East"
            Case 7 : Return "US East 2"
            Case 8 : Return "US Central 3"
            Case 9 : Return "US Central 2"
            Case 10 : Return "Netherlands"
            Case 11 : Return "US Central 1"
            Case 12 : Return "US West 4"
            Case 13 : Return "US East 1"
            Case 14 : Return "US East 3"
            Case 15 : Return "Australia"
            Case 16 : Return "Sweden"
            Case 17 : Return "Canada West"
            Case 18 : Return "Finland"

That's it for that function. Let's move on :)

Get Total Players

This returns the total amount of players currently playing runescape.

Code:
    Public Function GetTotalPlayers() As Integer
        Dim src As String = New Net.WebClient().DownloadString("http://www.runescape.com/title.ws")

        src = src.Substring(InStr(src, "currently", CompareMethod.Text) + 9)
        src = src.Remove(InStr(src, "people", CompareMethod.Text) - 1)

        Return src
    End Function

Usage: Well, this is quite obvious. Call it like this:
Code:
Label1.Text = GetTotalPlayers()

Moving on...

Get Players By World

This will return the amount of players on a specified world.

Code:
    Public Function getPlayersByWorld(ByVal worldNumber As Integer) As Integer
        Dim tmp() As String
        Dim src As String = New Net.WebClient().DownloadString("http://www.runescape.com/slj.ws?lores.x=366&lores.y=232&plugin=0")

        src = src.Substring(InStr(src, "e(" & worldNumber & ","))
        tmp = src.Split(",")

        Return tmp(4)
    End Function

Usage: Also an obvious function. Call it like this:
Code:
Label1.Text = getPlayersByWorld(5)

Neext..

Auto Create Account

This code will let you create new accounts with ease.

Code:
    Public Function createAccount(ByVal Username As String, ByVal Password As String) As Boolean
        Dim src As String
        Dim web As New Net.WebClient()
        Dim stream As New IO.StreamReader(web.OpenRead("https://create.runescape.com/lang/en/aff/runescape/createaccount.ws?password1=" & Password & "&password2=" & Password & "&username=" & Username & "&country=191&termsandcond=1"))

        If Username.Length < 5 Then MsgBox("Username must be 5-12 characters long. Please try again", MsgBoxStyle.Critical)
        If Password.Length < 5 Then MsgBox("Password must be 5-20 characters long. Please try again", MsgBoxStyle.Critical)

        src = stream.ReadToEnd()

        If src.Contains("Sorry, this service is unavailable at the moment. Please try again in a few minutes.") Or src.Contains("Sorry, that username is no longer available.") Then
            MsgBox("Username or Password Error! This could happen because of one of the following reasons:" & vbCrLf _
                 & "Your username might have already been taken" & vbCrLf _
                 & "Your username might be offensive and/or aganist jagex rules" & vbCrLf _
                 & vbCrLf _
                 & "Please check these settings and try again.")
            Return False
        ElseIf src.Contains("has now been created with the password you have chosen.") Then
            MsgBox("You account was created successfully! Please remember these details:" & vbCrLf _
     & "Username:" & Username & vbCrLf _
     & "Password:" & Password, MsgBoxStyle.Information)
            Return True
        ElseIf src.Contains("You have been blocked from creating too many accounts, please try again in a few minutes.") Then
            MsgBox("You have been blocked from creating accounts, please try again in a few minutes. (Pathetic Jagex...)", MsgBoxStyle.Critical)
            Return False
        End If

    End Function

Usage: Well, this is extremely obvious. Call like this:
Code:
createAccount("noob","wierdpass")

That's it for releases right now. I hope you will find great use for this code.

NOTE: I do not require credits for this code, however you may not claim to be the writer.

I really hope this will educate some people a bit.

As always, enjoy and keep coding :)
 
nice, i can see you are using now regex like in the post i made

try saving the results in a collection base for better access later

i posted an example on doing that, on my code you can get all the values of the world list once is saved on the colelction

PS: i like the code to create the account
 
use the one o wrote, it already has some cool stuff in it like sorting

oh also i noticed some good changes in the regex i'll use them
 
Runescape Gamblingrunescape gambling
Back
Top