• Welcome to Valhalla Legends Archive.
 

[VB6] Help?

Started by Pedlar, April 21, 2005, 07:05 PM

Previous topic - Next topic

Pedlar

Ok, I load up Visual Basic 6.0 and i click to add an ActiveX control, when i lock on the RichText one, and click apply a Msg box comes up and says "Object Library not registerd.", what can i do to fix this?

shout

Try re-installing VB6.

Warrior

GAH I forgot how I fixed this. I used to get it a lot.
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?

Pedlar

I got it fixed, but now i have a new problem with AddChat,  I have rtbChat, and i goto to do Len(rtbChat.Text) and it wont compile that it says Method or data not there

Warrior

Make sure you are including the Form prefix if you're in a module or class. (Or other form but not practical)
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?

Blaze

Make sure when your setting rtbchat to a richtextbox, that richtextbox actually exists.
Quote
Mitosis: Haha, Im great arent I!
hismajesty[yL]: No

Pedlar

Ok, I got abit of the stufff working, now im having trouble connecting to BNET, im using CleanSlateBot2.OCX for it. Heres my code.



Sub Connect()
    Const f As String = "Main", p As String = "config.ini"
        Close #1
    'Vars
        Dim strUsername As String
    Dim strNewPassword As String, strProduct As String
    Dim strRealmName As String, strRealmChar As String, booRealm As Boolean, booConnecting As Boolean
    Dim strNewPW As String, strIdles As String, strRealms As String, strLODKey As String
    Dim strAutoban As String, strTagban As String, strsafelist As String
    Dim strCDKey As String, strPassword As String, UDP As String
   
    If booConnected = True Then
        Access.Disconnect
    End If
    booConnected = False
    'CONNECTION CODE
    booConnecting = False
    strUsername = ReadINI(f, "Username", p)
    strPassword = ReadINI(f, "Password", p)
    strCDKey = ReadINI(f, "CDKey", p)
    strLODKey = ReadINI(f, "LODKey", p)
    strServer = ReadINI(f, "Server", p)
    strHomeChannel = ReadINI(f, "HomeChan", p)
    strProduct = ReadINI(f, "Product", p)
    strRealmName = ReadINI(f, "Realm", p)
    Trigger = ReadINI(f, "Trigger", p)
    strIdles = ReadINI(f, "Idles", p)
    IdleWait = ReadINI(f, "IdleWait", p)
    IdleMsg = ReadINI(f, "IdleMsg", p)
    strTagban = ReadINI(f, "Tagbans", p)
    strAutoban = ReadINI(f, "Autobans", p)
    strsafelist = ReadINI(f, "Safelist", p)
    strRealms = ReadINI(f, "UseRealm", p)
    UDP = ReadINI(f, "UDP", p)
       
    If strUsername = "" Or strPassword = "" Or strCDKey = "" Or strServer = "" Or strHomeChannel = "" _
    Or strProduct = "" Or Trigger = "" Then
        MsgBox "Configuration file error. Please fix your configuration file using the bot's Setup dialog."
        Exit Sub
    End If
    If strIdles = "Y" Then
        Idles = True
    Else
        Idles = False
    End If
    If strTagban = "Y" Then
        Tagbans = True
    Else
        Tagbans = False
    End If
    If strAutoban = "Y" Then
        Autobans = True
    Else
        Autobans = False
    End If
    If strsafelist = "Y" Then
        Safelist = True
    Else
        Safelist = False
    End If
    If UDP = "Y" Then
        Access.UseUDP = False
    Else
        Access.UseUDP = True
    End If
    If StrComp(strProduct, "PX2D", vbTextCompare) = 0 Or StrComp(strProduct, "VD2D", vbTextCompare) = 0 Then
        Dii = True
    Else
        Dii = False
    End If
    Access.BNLSBotID = ""
    Access.BNLSBotPassword = ""
    Access.CDKey = strCDKey
    Access.Product = strProduct
    If StrComp(strProduct, "PX2D", vbTextCompare) = 0 Then
        Access.LODKey = strLODKey
    End If
    If strRealms = "Y" Then
        Access.Realm = strRealmName
        Access.Character = strRealmChar
        Access.UseRealm = True
    Else
        Access.UseRealm = False
    End If
    strTime = "[" & Time & "] "
    Access.HomeChannel = strHomeChannel
    Access.Password = strPassword
    Access.Username = strUsername
    Access.ChangePassword = False
    Access.Server = strServer
    Access.Accept = 579728
    booConnecting = True
    Access.Connect
error:
    IAm = strCDKey
    SB14 = strPassword
    If booConnecting = True Then
        Exit Sub
    Else
        MsgBox "Configuration file error. Please re-write your configuration file using the Setup dialog.", vbCritical, "Error"
        Exit Sub
    End If
End Sub

'BNLS EVENTS
Private Sub Access_BnetConnected()
    strTime = "[" & Time & "]"
    AddChat vbWhite, strTime & " ", vbGreen, "BNET: Connected!"
End Sub

Private Sub Access_BnetConnecting()
        strTime = "[" & Time & "]"
    AddChat vbWhite, strTime & " ", vbYellow, "BNET: Connecting..."
End Sub

Private Sub Access_BnetDisconnected()
    Access.Disconnect
    booConnected = False
    AddChat vbWhite, strTime & " ", vbRed, "BNET: Disconnected."
    frmChat.Caption = ":: StealthBot v1.39 Test Edition :: Disconnected ::"
    lblCurrentChannel.Caption = ""
    lvChannel.ListItems.Clear
    lbPing.Clear
    lbPing.AddItem " "
    lvChannel.ListItems.Add , , " "
    If Me.WindowState <> vbMinimized Then
    cboSend.SetFocus
    End If
    AddChat vbWhite, strTime & " ", vbRed, "BNET: Attempting to reconnect, please wait..."
    Pause 2, False
strTime = "[" & Time & "]"
        AddChat vbWhite, strTime & " ", vbGreen, "Connection initialized."
    If Me.WindowState <> vbMinimized Then
    cboSend.SetFocus
    End If
    Call Connect
    'timer
    If Idles = True Then
            lngTimerID = KillTimer(0, lngTimerID)
           
    ElseIf Idles = False Then
            Exit Sub
    End If

End Sub

Private Sub Access_BnetError(ErrorNumber As Integer, Description As String)
        strTime = "[" & Time & "]"
    AddChat vbWhite, strTime & " ", vbRed, "BNET:" & ErrorNumber & " -- " & Description
    If ErrorNumber = 10053 Then
        AddChat vbWhite, strTime & " ", vbRed, "BNET: Disconnected."
        AddChat vbWhite, strTime & " ", vbRed, "BNET: Attempting to reconnect..."
        Access.Disconnect
        booConnected = False
        lblCurrentChannel.Caption = ""
        lvChannel.ListItems.Clear
        lbPing.Clear
        lbPing.AddItem " "
        lvChannel.ListItems.Add , , " "
            If Me.WindowState <> vbMinimized Then
            cboSend.SetFocus
            End If
        Pause 1, False
        Call Connect
    ElseIf ErrorNumber = 10061 Then
        AddChat vbWhite, strTime & " ", vbRed, "BNET: Disconnected."
        AddChat vbWhite, strTime & " ", vbRed, "BNET: Attempting to reconnect..."
        Access.Disconnect
        booConnected = False
        lblCurrentChannel.Caption = ""
        lvChannel.ListItems.Clear
        lbPing.Clear
        lbPing.AddItem " "
        lvChannel.ListItems.Add , , " "
            If Me.WindowState <> vbMinimized Then
            cboSend.SetFocus
            End If
        Pause 1, False
        Call Connect
    End If
End Sub

Private Sub Access_BNLSAuthEvent(Success As Boolean)
        strTime = "[" & Time & "]"
    If Success = True Then
    AddChat vbWhite, strTime & " ", vbGreen, "BNLS: Authorized!"
    Else
    AddChat vbWhite, strTime & " ", vbRed, "BNLS: Authorization failed!"
    End If
End Sub

Private Sub Access_BNLSConnected()
        strTime = "[" & Time & "]"
    AddChat vbWhite, strTime & " ", vbGreen, "BNLS: Connected!"
End Sub

Private Sub Access_BNLSConnecting()
        strTime = "[" & Time & "]"
    AddChat vbWhite, strTime & " ", vbYellow, "BNLS: Connecting..."
End Sub

Private Sub Access_BNLSDataError(Message As Byte)
    strTime = "[" & Time & "]"
    If Message = 1 Then
        AddChat vbWhite, strTime & " ", vbRed, "BNLS: Error! Bad CDKey."
    ElseIf Message = 2 Then
        AddChat vbWhite, strTime & " ", vbRed, "BNLS: Error! Bad product version."
    ElseIf Message = 3 Then
        AddChat vbWhite, strTime & " ", vbRed, "BNLS: Error! Bad NLS revision."
    End If
End Sub

Private Sub Access_BNLSDisconnected()
    'empty
End Sub

Private Sub Access_BNLSError(ErrorNumber As Integer, Description As String)
        strTime = "[" & Time & "]"
    AddChat vbWhite, strTime & " ", vbRed, "BNLS: Error " & ErrorNumber & ": " & Description
End Sub


All i get is

[9:49:25 AM] BNLS: Connecting...
[9:49:26 AM] BNLS: Connected!
[9:49:26 AM] BNLS: Authorized!
[9:49:27 AM] BNET: Connecting...
[9:49:33 AM] BNET:10061 -- Connection is forcefully rejected
[9:49:33 AM] BNET: Disconnected.
[9:49:33 AM] BNET: Attempting to reconnect...

Blaze

Quote
    frmChat.Caption = ":: StealthBot v1.39 Test Edition :: Disconnected ::"
Nope, doesn't look like you learned much.

What server are you connecting to?  Try connecting to another one.
Quote
Mitosis: Haha, Im great arent I!
hismajesty[yL]: No

Pedlar

I was using the old SB code to see how to work it so i could do it myself. And  I got it to connect, but now i get a error "ImageList must be initalized before it can be used." and clicking Debug takes me to line ChanList.ListItems.Add , , Username, , 1
Whats that mean?

Stealth

#9
My God, you're using that code?! It's terrible!!

I highly recommend learning Visual Basic and rewriting it yourself using better conventions. I've rewritten every single line of what you see there since that code was produced.
- Stealth
Author of StealthBot

Pedlar

I jus needed something to connect to BNET for an Ops bot, and wanted to make my own Commands for it

Blaze

Quote from: Pedlar on April 22, 2005, 10:37 AM
I was using the old SB code to see how to work it so i could do it myself. And I got it to connect, but now i get a error "ImageList must be initalized before it can be used." and clicking Debug takes me to line ChanList.ListItems.Add , , Username, , 1
Whats that mean?
When a vb project fails to load a control it usually makes that object a picturebox. Try replacing that with the proper control.
Quote
Mitosis: Haha, Im great arent I!
hismajesty[yL]: No

Pedlar

Its a ListBox object

Warrior

Haha, I thought that code was leaked :p. Try setting the image list to point to the one in your list view
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?

Hdx

#14
Removed, Question got answered.

Now to answer the man's problem:
You need to assighn a ImageList to the ListView, As follows:

Right click and select properties (making sure you ahve a ImageList on the form already):


Then select the Image Lists tab and set the property to the image list you want:

~-~(HDX)~-~

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status