VB.net stats lookup

A place to discuss development on the Microsoft .NET framework platform utilizing languages such as C#, Visual Basic, J# and Managed C++

Moderators: IRC Operators, Support Team

tommeke14
User
User
Posts: 21
Joined: Tue Dec 12, 2006 5:09 pm

VB.net stats lookup

Postby tommeke14 » Sat Jul 14, 2007 10:56 am

Ok, I'll post my stats lookup script here
Made in Vb.net , and i know , it's not pro , so if u came here to read a pro code, Go away plz ='(

Code: Select all

Imports System
Imports System.Net
Imports System.IO
Imports System.Text.RegularExpressions
Public Class Form3
    Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
        Windows.Forms.Cursor.Current = Cursors.AppStarting
        Dim oStream As Stream
        Dim sTemp As String
        Dim sarray As Array
        Dim WebRequest As HttpWebRequest
        Dim rsn As String = TextBox1.Text
        WebRequest = (HttpWebRequest.Create("http://hiscore.runescape.com/lang/en/aff/runescape/hiscorepersonal.ws?user1=" & rsn))
        Dim WebResponse As WebResponse = WebRequest.GetResponse()
        oStream = WebResponse.GetResponseStream
        sTemp = Regex.Replace(New StreamReader(oStream).ReadToEnd(), "<[^>]*>", "")
        sTemp = sTemp.Substring(sTemp.IndexOf("Overall"))
        sTemp = sTemp.Substring(0, sTemp.IndexOf("Search"))
        sTemp = Regex.Replace(sTemp, sTemp.Substring(sTemp.Length - 1), vbCrLf)
        sTemp = Regex.Replace(sTemp, vbCrLf & vbCrLf & vbCrLf, vbCrLf)
        sTemp = Regex.Replace(sTemp, "Not Ranked", "0" & vbCrLf & "0" & vbCrLf & "0")
        sTemp = Regex.Replace(sTemp, vbCrLf & vbCrLf, vbCrLf)
        sarray = sTemp.Split(vbCrLf)

        If TextBox1.Text = "" Or sarray.Length < 40 Then
        Else
            Dim j As Byte = 0
            Dim boxs() As TextBox = {overall, attack, Defence, strength, Hitpoints, ranged, prayer, magic, cooking, woodcutting, fletching, fishing, firemaking, crafting, smithing, mining, herblore, agility, thieving, slayer, farming, runecrafting, hunting, construction}
            Do While j <= 23
                boxs(j).Text = sarray(5 * j + 2)
                j = j + 1
            Loop
            j = 0
            Do While j <= 23
                boxs(j).Text = boxs(j).Text.Remove(0, 1)
                j = j + 1
            Loop
            If Val(ranged.Text) > Val(strength.Text) And Val(Defence.Text) And Val(attack.Text) Then
                Combat.Text = (0.487 * Val(ranged.Text)) + (0.249 * Val(Defence.Text)) + (0.25 * Val(Hitpoints.Text)) + (0.124 * Val(prayer.Text))
            ElseIf Val(magic.Text) > Val(strength.Text) And Val(Defence.Text) And Val(attack.Text) Then
                Combat.Text = (0.487 * Val(magic.Text)) + (0.249 * Val(Defence.Text)) + (0.25 * Val(Hitpoints.Text)) + (0.124 * Val(prayer.Text))
            Else
                Combat.Text = (0.32707 * Val(attack.Text)) + (0.249 * Val(Defence.Text)) + (0.324 * Val(strength.Text)) + (0.25 * Val(Hitpoints.Text)) + (0.124 * Val(prayer.Text)) + 0.1
            End If
            Combat.Text = Format(Val(Combat.Text), "0")
        End If
        Windows.Forms.Cursor.Current = Cursors.Arrow
    End Sub
End Class


Plz give ur opinion about it and be nice
Ok, its not as pro as other scripts , but it will do :o
Tips r welcome too :o
Last edited by tommeke14 on Wed Aug 01, 2007 8:54 am, edited 1 time in total.
Nick|
User
User
Posts: 568
Joined: Sun Apr 15, 2007 12:47 pm

Postby Nick| » Thu Jul 26, 2007 10:19 am

Bloody cool 8)
Image
Image
Zypher in development #Zypher
veloxity
Newbie
Newbie
Posts: 1
Joined: Sat Jun 15, 2013 7:45 pm

Re: VB.net stats lookup

Postby veloxity » Sat Jun 15, 2013 8:03 pm

I couldn't get it to work, seems to be a problem with your coding.
It looks like it should work though.
I added a button,textbox and all the necessary labels.


Error:

Code: Select all

Error   11   'agility' is not declared. It may be inaccessible due to its protection level.   c:\users\firebird\documents\visual studio 2012\Projects\player_lookup\player_lookup\Form1.vb   34   200   player_lookup
Error   17   'construction' is not declared. It may be inaccessible due to its protection level.   c:\users\firebird\documents\visual studio 2012\Projects\player_lookup\player_lookup\Form1.vb   34   259   player_lookup
Error   2   'cooking' is not declared. It may be inaccessible due to its protection level.   c:\users\firebird\documents\visual studio 2012\Projects\player_lookup\player_lookup\Form1.vb   34   108   player_lookup
Error   7   'crafting' is not declared. It may be inaccessible due to its protection level.   c:\users\firebird\documents\visual studio 2012\Projects\player_lookup\player_lookup\Form1.vb   34   162   player_lookup
Error   14   'farming' is not declared. It may be inaccessible due to its protection level.   c:\users\firebird\documents\visual studio 2012\Projects\player_lookup\player_lookup\Form1.vb   34   227   player_lookup
Error   6   'firemaking' is not declared. It may be inaccessible due to its protection level.   c:\users\firebird\documents\visual studio 2012\Projects\player_lookup\player_lookup\Form1.vb   34   150   player_lookup
Error   5   'fishing' is not declared. It may be inaccessible due to its protection level.   c:\users\firebird\documents\visual studio 2012\Projects\player_lookup\player_lookup\Form1.vb   34   141   player_lookup
Error   4   'fletching' is not declared. It may be inaccessible due to its protection level.   c:\users\firebird\documents\visual studio 2012\Projects\player_lookup\player_lookup\Form1.vb   34   130   player_lookup
Error   10   'herblore' is not declared. It may be inaccessible due to its protection level.   c:\users\firebird\documents\visual studio 2012\Projects\player_lookup\player_lookup\Form1.vb   34   190   player_lookup
Error   16   'hunting' is not declared. It may be inaccessible due to its protection level.   c:\users\firebird\documents\visual studio 2012\Projects\player_lookup\player_lookup\Form1.vb   34   250   player_lookup
Error   9   'mining' is not declared. It may be inaccessible due to its protection level.   c:\users\firebird\documents\visual studio 2012\Projects\player_lookup\player_lookup\Form1.vb   34   182   player_lookup
Error   1   'overall' is not declared. It may be inaccessible due to its protection level.   c:\users\firebird\documents\visual studio 2012\Projects\player_lookup\player_lookup\Form1.vb   34   38   player_lookup
Error   15   'runecrafting' is not declared. It may be inaccessible due to its protection level.   c:\users\firebird\documents\visual studio 2012\Projects\player_lookup\player_lookup\Form1.vb   34   236   player_lookup
Error   13   'slayer' is not declared. It may be inaccessible due to its protection level.   c:\users\firebird\documents\visual studio 2012\Projects\player_lookup\player_lookup\Form1.vb   34   219   player_lookup
Error   8   'smithing' is not declared. It may be inaccessible due to its protection level.   c:\users\firebird\documents\visual studio 2012\Projects\player_lookup\player_lookup\Form1.vb   34   172   player_lookup
Error   12   'thieving' is not declared. It may be inaccessible due to its protection level.   c:\users\firebird\documents\visual studio 2012\Projects\player_lookup\player_lookup\Form1.vb   34   209   player_lookup
Error   3   'woodcutting' is not declared. It may be inaccessible due to its protection level.   c:\users\firebird\documents\visual studio 2012\Projects\player_lookup\player_lookup\Form1.vb   34   117   player_lookup

Code: Select all

Imports System
Imports System.Net
Imports System.IO
Imports System.Text.RegularExpressions
Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Windows.Forms.Cursor.Current = Cursors.AppStarting
        Dim oStream As Stream
        Dim sTemp As String
        Dim sarray As Array
        Dim WebRequest As HttpWebRequest
        Dim rsn As String = TextBox1.Text
        WebRequest = (HttpWebRequest.Create("http://hiscore.runescape.com/lang/en/aff/runescape/hiscorepersonal.ws?user1=" & rsn))
        Dim WebResponse As WebResponse = WebRequest.GetResponse()
        oStream = WebResponse.GetResponseStream
        sTemp = Regex.Replace(New StreamReader(oStream).ReadToEnd(), "<[^>]*>", "")
        sTemp = sTemp.Substring(sTemp.IndexOf("Overall"))
        sTemp = sTemp.Substring(0, sTemp.IndexOf("Search"))
        sTemp = Regex.Replace(sTemp, sTemp.Substring(sTemp.Length - 1), vbCrLf)
        sTemp = Regex.Replace(sTemp, vbCrLf & vbCrLf & vbCrLf, vbCrLf)
        sTemp = Regex.Replace(sTemp, "Not Ranked", "0" & vbCrLf & "0" & vbCrLf & "0")
        sTemp = Regex.Replace(sTemp, vbCrLf & vbCrLf, vbCrLf)
        sarray = sTemp.Split(vbCrLf)

        If TextBox1.Text = "" Or sarray.Length < 40 Then
        Else
            Dim j As Byte = 0
            Dim boxs() As TextBox = {overall, attack, Defence, strength, Hitpoints, ranged, prayer, magic, cooking, woodcutting, fletching, fishing, firemaking, crafting, smithing, mining, herblore, agility, thieving, slayer, farming, runecrafting, hunting, construction}
            Do While j <= 23
                boxs(j).Text = sarray(5 * j + 2)
                j = j + 1
            Loop
            j = 0
            Do While j <= 23
                boxs(j).Text = boxs(j).Text.Remove(0, 1)
                j = j + 1
            Loop
            If Val(ranged.Text) > Val(strength.Text) And Val(defence.Text) And Val(attack.Text) Then
                combat.Text = (0.487 * Val(ranged.Text)) + (0.249 * Val(defence.Text)) + (0.25 * Val(hitpoints.Text)) + (0.124 * Val(prayer.Text))
            ElseIf Val(magic.Text) > Val(strength.Text) And Val(defence.Text) And Val(attack.Text) Then
                combat.Text = (0.487 * Val(magic.Text)) + (0.249 * Val(defence.Text)) + (0.25 * Val(hitpoints.Text)) + (0.124 * Val(prayer.Text))
            Else
                combat.Text = (0.32707 * Val(attack.Text)) + (0.249 * Val(defence.Text)) + (0.324 * Val(strength.Text)) + (0.25 * Val(hitpoints.Text)) + (0.124 * Val(prayer.Text)) + 0.1
            End If
            combat.Text = Format(Val(combat.Text), "0")
        End If
        Windows.Forms.Cursor.Current = Cursors.Arrow
    End Sub
End Class
User avatar
JoshR
User
User
Posts: 716
Joined: Tue Jan 01, 2008 7:32 pm
Location: #mSL
Contact:

Re: VB.net stats lookup

Postby JoshR » Fri Dec 20, 2013 11:47 pm

I realize it's unlikely anyone will read this. However I'm going to answer your question anyway.

First off, line 34, which is the declaration of the array of stats, all the stat names should be wrapped in quotations (i.e.: "overall", "attack", etc...).

If it still doesn't work after fixing that and it doesn't give you a line which it received the error on, then it's likely due to the fact it was written 7 years ago, veloxity.
Image

Return to “.NET”

Who is online

Users browsing this forum: No registered users and 1 guest