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?
Try re-installing VB6.
GAH I forgot how I fixed this. I used to get it a lot.
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
Make sure you are including the Form prefix if you're in a module or class. (Or other form but not practical)
Make sure when your setting rtbchat to a richtextbox, that richtextbox actually exists.
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...
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.
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?
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.
I jus needed something to connect to BNET for an Ops bot, and wanted to make my own Commands for it
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.
Its a ListBox object
Haha, I thought that code was leaked :p. Try setting the image list to point to the one in your list view
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):
(http://hdx.no-ip.org/imgs/imglst1.GIF)
Then select the Image Lists tab and set the property to the image list you want:
(http://hdx.no-ip.org/imgs/imglst2.GIF)
~-~(HDX)~-~
I got another quick question. How would i go abou retrieveing a string from a URL and puting it through AddChat? I was thinking do Open("http://URL/news.txt") and parsing it that way. But it didnt quite work :(
I don't use VB6 all that often (I use Python), but doesn't VB6 have a way to read the text stored in a text document from the internet? I think you might be able to use Inet for this task. I can't really go into detail on that for you though.
Yes, Simply using an Inet control will allow you to access any publically web-based text doccument.
Dim FileData as string
FileData = Inet1.OpenURL("Http://URL/File.txt")
~-~(HDX)~-~
Quote from: HdxBmx27 on April 23, 2005, 05:39 PM
Yes, Simply using an Inet control will allow you to access any publically web-based text doccument.
Dim FileData as string
FileData = Inet1.OpenURL("Http://URL/File.txt")
~-~(HDX)~-~
You can also split the data by character 10 (Chr(10)),
and then add it to chat.
What obj is Inet?
Ok, I found the dll with Inet :D, But now i have a not so easy question, How would i do the Url so in the txt file i can have AddChat "Blah"
and when i load the file have it do whats in the file? so i could do say Inet1.openURL("http://LovelyUrl/News.txt")
then it call the functions inside the file?
Edit: I can elaborate abit more if this question confuses someone.
Umm, Elaborate please You need to simply put the results of OpenURL() into a vareable, Like ArchAngel you can split it by Chr(&HA) witch would return all the line breaks.
Are you refering to VB code in the file, if so then youll have to look into the Scripting object control. If your jsut making a file where you can have news, simply so the AddChat with the data you get, Even make some special charecters for yourself to tell you how it should be displayed (bold, italic, underline, red, blue, clear, etc....)
~-~(HDX)~-~
yea what im asking is basicly a Remote VBScript
Edit: I ask for help to be pushed in the right direction, Ive never realy used VB before. Im more C, So dont think im jus building my bot off of what you all are telling me.
With help from HDX i was able to get what i needed, but now when i do ScriptSupportClass.AddChat vbCyan, "Hi" it shows it in black instead of Cyan, this is what i have for AddChat inside of the script suport class
Edit: Changed the AddChat
Public Sub AddChat(ParamArray saElements() As Variant)
Dim i As Integer
For i = LBound(saElements) To UBound(saElements) Step 2
With frmChat.rtbChat
.SelStart = Len(.text)
.SelLength = 0
.SelColor = saElements(i)
.SelText = saElements(i + 1) & Left$(vbCrLf, -2 * CLng((i + 1) = UBound(saElements)))
.SelStart = Len(.text)
End With
Next i
End Sub
and in form_load i have
Dim NewsData As String
Set ScriptSupportClass = New ScriptSupportClass
NewsData = Inet1.OpenURL("Http://Url/canews.txt")
caScript.AddCode (NewsData)
caScript.Run ("News")
and last but not least in canews.txt i have
Public Sub News()
ScriptSupportClass.AddChat vbWhite, "[" & Time & "] ", vbcyan , "Hi"
End Sub
Perhaps this could help you? Look at it and compare and see what your doing wrong.
Public Function Display(ByVal TextObject As RichTextBox, ByVal NewLine As Boolean, ByVal TimeStamp As Boolean, ByVal TextColor As Long, ByVal Text As String)
TextObject.SelStart = Len(TextObject.Text)
If NewLine = True And TextObject.Text <> "" Then TextObject.SelText = TextObject.SelText & vbCrLf
If TimeStamp = True Then
TextObject.SelColor = &H8000000F
TextObject.SelText = TextObject.SelText & "[" & Time & "] "
End If
TextObject.SelColor = TextColor
TextObject.SelText = TextObject.SelText & Text
TextObject.SelStart = Len(TextObject.Text)
End Function
Edit: Forgot to say how its used. Its used like this.
Display MyRTB, true, true, vbGreen, "Wee"
1st true = NewLine.
2nd true = Timestamp.
Put both to false if want to stay on same line, with no timestamp but change colour writing.
Hope this helps!
When i pass stuff through the script support class it removes there color...i can do AddChat Blah, and have color and do ScriptSupportClass..AddChat blah and it jus turned it black.
You really should use a socket, not INet, because INet sucks and often errors itself to death.
TIPS:
- Connect socket!
- On Connect:
Winsock1.SendData "GET http://yoursite/news.txt HTTP/1.0" & vbCrLf & _
"Connection: Keep-Alive" & vbCrLf & _
"Accept: */*" & vbCrLf & _
"Accept-Language: en" & vbCrLf & vbCrLf
- Data Arrives, and you parse data.
im not having a problem retriveing the info or even having the script work, the only thing thats wrong is that the AddChat in the ScriptSupportClass wont call color, but its identicle to the AddChat in frmChat whcih does show color. So any help with why puting something through the scriptsupportclass wonr show color is well apreciated.
[Edit]: Spelling.
Quote from: Archangel on April 24, 2005, 04:02 PM
TIPS:
- Connect socket!
- On Connect:
Winsock1.SendData "GET http://yoursite/news.txt HTTP/1.0" & vbCrLf & _
"Connection: Keep-Alive" & vbCrLf & _
"Accept: */*" & vbCrLf & _
"Accept-Language: en" & vbCrLf & vbCrLf
- Data Arrives, and you parse data.
That won't work :'(
Sock.SendData "GET /news.txt HTTP/1.1" & vbCrLf & _
"Host: www.site.com" & vbCrLf & _
"Accept: */*" & vbCrLf & _
"Accept-language: en" & vbrclf & vbCrLf
Did you connected the socker to the server ip?