Im sorry to pester you guys with my newbie questions. Im having trouble with connecting my bot. It uses CSB. It will just show Connecting to Bnls.
Can someone please help.
BTW heres the code
Private Sub Form_Load()
AddChat "Warrior Bot 1.0 - LW-Warrior" & vbNewLine, vbBlue
AddWhisper "Whisper Box" & vbNewLine, vbBlue
End Sub
Private Sub mnuDisconnect_Click()
AddChat "Disconnected " & vbNewLine, vbRed
CleanSlateBot1.Disconnect
End Sub
Private Sub mnuConnect_Click()
strProduct = GetStuff("Login", "Client") 'Set Values For Your Variables
strUsername = Form2.txtUsername.Text
strPassword = Form2.txtpassword.Text
strCDKey = Form2.txtcdkey
strServer = Form2.txtserver.Text
strHomeChannel = Form2.txthomechan.Text
CleanSlateBot1.BNLSBotID = ""
CleanSlateBot1.BNLSBotPassword = '"
CleanSlateBot1.CDKey = "strcdkey"
CleanSlateBot1.Product = "strProduct"
CleanSlateBot1.HomeChannel = "strHomeChannel"
CleanSlateBot1.Password = "strPassword"
CleanSlateBot1.Username = "strUsername"
CleanSlateBot1.Server = "strServer"
CleanSlateBot1.Accept = "-65"
AddChat "Attempting Connection To Battle.Net " & vbNewLine, vbYellow
End Sub
Private Sub mnuconfig_Click()
Form2.Show
End Sub
Private Sub CleanSlateBot1_BnetError(ErrorNumber As Integer, Description As String)
AddChat "Bnet error: " & ErrorNumber & " - " & Description & vbNewLine, vbRed
End Sub
Private Sub CleanSlateBot1_BnetConnected()
CleanSlateBot1.Connect
AddChat "Connected!" & vbNewLine, vbGreen
End Sub
Private Sub CleanSlateBot1_FlagsUpdate(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long, SimulatedEvent As Boolean)
Dim intstr As Integer 'Declare The integers
Dim lagicoN As Integer
Dim icon As Integer
icon = GetIconCodeFLAGS(Message, Flags)
lagicoN = GetLagIcon(Ping, Flags)
If InStr(1, Username, "*", vbTextCompare) <> 0 Then
intstr = InStr(1, Username, "*", vbTextCompare)
Username = Right(Username, Len(Username) - intstr)
End If
If (Flags And BNFLAGS_OP) = BNFLAGS_OP Then
icon = ICON_GAVEL
Form1.lvchannel.ListItems.Remove Form1.lvchannel.FindItem(Username).Index
With Form1.lvchannel.ListItems.Add(1, , Username, , icon)
.ListSubItems.Add 1, , , lagicoN
End With
Else
With Form1.lvchannel
.ListItems(.FindItem(Username).Index).SmallIcon = icon
End With
End If
End Sub
Private Sub CleanSlateBot1_BnetConnecting()
AddChat "Connecting..." & vbNewLine, vbYellow
End Sub
Private Sub txtsend_KeyPress(keyascii As Integer)
On Error Resume Next
strCurrentUsername = Form2.txtUsername.Text
If keyascii = 13 And txtsend.Text <> "" Then
keyascii = 0
Dim strSend As String
strSend = txtsend.Text
CleanSlateBot1.Send txtsend.Text
AddChat "<" & Form2.txtUsername & "> ", vbCyan, strSend & vbNewLine, vbWhite
txtsend.Text = ""
End If
End Sub
Private Sub CleanSlateBot1_LoggedOnAs(Username As String, Product As String)
AddChat "Successfully logged on as: ", vbCyan, Username & vbNewLine, vbYellow
End Sub
Private Sub CleanSlateBot1_LogonEvent(Message As Byte)
If Message = 0 Then
AddChat "Account doesn't exist!" & vbNewLine, vbRed
ElseIf Message = 1 Then
AddChat "Invalid Password!" & vbNewLine, vbRed
ElseIf Message = 2 Then
AddChat "Login successfull" & vbNewLine, vbGreen
ElseIf Message = 3 Then
AddChat "Attempting to create account.." & vbNewLine, vbYellow
ElseIf Message = 4 Then
AddChat "Account creation was a success!" & vbNewLine, vbGreen
End If
End Sub
Private Sub CleanSlateBot1_ServerError(ByVal Message As String, SimulatedEvent As Boolean)
AddChat Message & vbNewLine, vbRed
End Sub
Private Sub CleanSlateBot1_ServerInfo(ByVal Message As String, SimulatedEvent As Boolean)
AddChat Message & vbNewLine, vbYellow
End Sub
Private Sub CleanSlateBot1_SomethingUnknown(ByVal UnknownString As String, SimulatedEvent As Boolean)
AddChat "Unknown Bot Error" & vbNewLine, vbRed
End Sub
Private Sub CleanSlateBot1_UserInChannel(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long, ByVal Product As String, StatUpdate As Boolean, SimulatedEvent As Boolean)
strSexp = Product
strSTAR = Product
strd2 = Product
strD2XP = Product
strW2BN = Product
strw3 = Product
strDw3xp = Product
Dim icon As Integer
icon = GetIconCode(Product, Flags)
Dim lagicoN As Integer
lagicoN = GetLagIcon(Ping, Flags)
If icon = ICON_GAVEL Then
With Form1.lvchannel.ListItems.Add(1, Username, Username, , icon)
.ListSubItems.Add lvchannel.FindItem(Username).Index, , , lagicoN
End With
End If
If icon <> ICON_GAVEL Then
With Form1.lvchannel.ListItems.Add(, , Username, , icon)
.ListSubItems.Add , , , lagicoN
End With
End If
End Sub
Private Sub CleanSlateBot1_UserEmote(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, SimulatedEvent As Boolean)
If Dii = True Then
Username = Right(Username, Len(Username) - 1)
End If
Dim intstr As Integer
If InStr(1, Username, "*", vbTextCompare) <> 0 Then
intstr = InStr(1, Username, "*", vbTextCompare)
Username = Right(Username, Len(Username) - intstr)
End If
AddChat "<" & Username & " " & Message & ">" & vbNewLine, vbCyan
End Sub
Private Sub CleanSlateBot1_UserJoins(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long, ByVal Product As String, SimulatedEvent As Boolean)
If Dii = True Then
Username = Right(Username, Len(Username) - 1)
End If
Dim intstr As Integer
If InStr(1, Username, "*", vbTextCompare) <> 0 Then
intstr = InStr(1, Username, "*", vbTextCompare)
Username = Right(Username, Len(Username) - intstr)
End If
strSexp = Product
strSTAR = Product
strd2 = Product
strD2XP = Product
strW2BN = Product
strw3 = Product
strw3xp = Product
strProduct = Product
Dim icon As Integer
icon = GetIconCode(Product, Flags)
Dim lagicoN As Integer
lagicoN = GetLagIcon(Ping, Flags)
If icon = ICON_GAVEL Then
With Form1.lvchannel.ListItems.Add(1, Username, Username, , icon)
.ListSubItems.Add lvchannel.FindItem(Username).Index, , , lagicoN
End With
End If
If icon <> ICON_GAVEL Then
With Form1.lvchannel.ListItems.Add(, , Username, , icon)
.ListSubItems.Add , , , lagicoN
End With
End If
If LCase(strSexp) = "SEXP" Then
Product = "Starcraft: Broodwar"
ElseIf LCase(strSTAR) = "STAR" Then
Product = "Starcraft"
ElseIf LCase(strd2) = "D2DV" Then
Product = "Diablo II"
ElseIf LCase(strD2XP) = "D2XP" Then
Product = "Diablo II: Lord of Destruction"
ElseIf LCase(strW2BN) = "W2BN" Then
Product = "Warcraft II"
ElseIf LCase(strw3) = "WAR3" Then
Product = "Warcraft III: Reign of Chaos"
End If
AddChat Username & " has joined the channel using " & vbNewLine, &H808080
End Sub
Private Sub CleanSlateBot1_UserLeaves(ByVal Username As String, ByVal Flags As Long, SimulatedEvent As Boolean)
Dim intstr As Integer
If InStr(1, Username, "*", vbTextCompare) <> 0 Then
intstr = InStr(1, Username, "*", vbTextCompare)
Username = Right(Username, Len(Username) - intstr)
End If
AddChat Username & " has left the channel" & vbNewLine, &H808080
On Error Resume Next
Form1.lvchannel.ListItems.Remove Form1.lvchannel.FindItem(Username).Index
End Sub
Private Sub CleanSlateBot1_UserTalk(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long, SimulatedEvent As Boolean)
If Dii = True Then
Username = Right(Username, Len(Username) - 1)
End If
Dim intstr As Integer
If InStr(1, Username, "*", vbTextCompare) <> 0 Then
intstr = InStr(1, Username, "*", vbTextCompare)
Username = Right(Username, Len(Username) - intstr)
End If
AddChat "<" & Username & ">", vbYellow, Space(1) & Message & vbNewLine, vbWhite
End Sub
Private Sub CleanSlateBot1_VersionCheck(Message As Byte, ExtraInfo As String)
If Message = 0 Then
AddChat "Client Has Been Accepted!" & vbNewLine, vbGreen
ElseIf Message = 1 Then
AddChat "Version Check Failed!" & vbNewLine, vbRed
ElseIf Message = 2 Then
AddChat "Version Check Passed!" & vbNewLine, vbGreen
ElseIf Message = 3 Then
AddChat "Version Check Failed!" & vbNewLine, vbRed
ElseIf Message = 4 Then
AddChat "Version Check Passed!" & vbNewLine, vbGreen
ElseIf Message = 5 Then
AddChat "Version Check Passed!" & vbNewLine, vbWhite
ElseIf Message = 6 Then
AddChat "Cd-Key In Use By " & ExtraInfo & vbNewLine, vbRed
End If
End Sub
Private Sub CleanSlateBot1_WhisperFromUser(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, SimulatedEvent As Boolean)
AddChat "<From: " & Username & "> " & Message & vbNewLine, vbCyan
End Sub
Private Sub CleanSlateBot1_WhisperToUser(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long, SimulatedEvent As Boolean)
AddWhisper "<To: " & Username & "> " & Message & vbNewLine, vbCyan
End Sub
Private Sub CleanSlateBot1_JoinedChannel(ByVal ChannelName As String, ByVal Flags As Long, SimulatedEvent As Boolean)
AddWhisper "Joined channel: " & ChannelName & vbNewLine, vbYellow
lvchannel.ListItems.Clear
End Sub
Your accept is wrong, and that needs to be the first property you set.
Hmm ill try it thanks.
The correct accept number for CSB is 579728. So your code should work if it was:
Private Sub mnuConnect_Click()
strProduct = GetStuff("Login", "Client") 'Set Values For Your Variables
strUsername = Form2.txtUsername.Text
strPassword = Form2.txtpassword.Text
strCDKey = Form2.txtcdkey
strServer = Form2.txtserver.Text
strHomeChannel = Form2.txthomechan.Text
CleanSlateBot1.Accept = "579728"
CleanSlateBot1.BNLSBotID = ""
CleanSlateBot1.BNLSBotPassword = ""
CleanSlateBot1.CDKey = "strcdkey"
CleanSlateBot1.Product = "strProduct"
CleanSlateBot1.HomeChannel = "strHomeChannel"
CleanSlateBot1.Password = "strPassword"
CleanSlateBot1.Username = "strUsername"
CleanSlateBot1.Server = "strServer"
AddChat "Attempting Connection To Battle.Net " & vbNewLine, vbYellow
End Sub
I also just noticed that your never calling CleanSlateBot1.Connect.
Hey Thanks Alot man i moved all the cleanslate bot stuff to the Form_load and left the connect.
As i did this another problem arose
When itry to Connect i get a bot that says Invalid Version and then i get
[7:18:25 PM] Attempting Connection To Battle.Net
[7:18:26 PM] Connecting...
[7:18:33 PM] Bnet error: 11001 - Authoritative answer: Host not found
Thanks for helping so far all i need is this so can u please help?
Quote from: Quarantine on April 27, 2004, 06:20 PM
Hey Thanks Alot man i moved all the cleanslate bot stuff to the Form_load and left the connect.
As i did this another problem arose
When itry to Connect i get a bot that says Invalid Version and then i get
[7:18:25 PM] Attempting Connection To Battle.Net
[7:18:26 PM] Connecting... '// <-------------
[7:18:33 PM] Bnet error: 11001 - Authoritative answer: Host not found
Thanks for helping so far all i need is this so can u please help?
Change that to AddText("Connecting to: " & CleanSlateBot1.Server, vbGreen) -- or whatever your AddText/AddChat function is and I'm almost positive you'll find your problem. ;)
[7:31:23 PM] Connecting to:useast.battle.net
[7:31:23 PM] Connected!
[7:31:23 PM] Bnet error: 10053 - Connection is aborted due to timeout or other failure
I know this means im ipbanned or something
but before that i get a invalid version box. I REALLY Apreciate your help so far
nvm i got it i had quotes around my strserver like so
Before
CleanSlateBot1.BNLSBotID = ""
CleanSlateBot1.BNLSBotPassword = ""
CleanSlateBot1.CDKey = "strCDKey"
CleanSlateBot1.Product = "strProduct"
CleanSlateBot1.HomeChannel= "strHomeChannel"
CleanSlateBot1.Password = "strPassword"
CleanSlateBot1.Username = "strUsername"
CleanSlateBot1.Server = "strServer"
CleanSlateBot1.Accept = "579728"
After
CleanSlateBot1.BNLSBotID = ""
CleanSlateBot1.BNLSBotPassword = ""
CleanSlateBot1.CDKey = strCDKey
CleanSlateBot1.Product = strProduct
CleanSlateBot1.HomeChannel = strHomeChannel
CleanSlateBot1.Password = strPassword
CleanSlateBot1.Username = strUsername
CleanSlateBot1.Server = strServer
CleanSlateBot1.Accept = "579728"
Having no idea about CSB or anything related, I saw this line that function to stick out:
Private Sub CleanSlateBot1_BnetConnected()
CleanSlateBot1.Connect
AddChat "Connected!" & vbNewLine, vbGreen
End Sub
As I recall, you call CSB.Connect() before it's connected. I don't know what this would do by having it hear, but I'm sure it can't be good.
Also, do you believe in whitespace?
[edit] In the future, rather than posting twice in a row, when nobody has posted since your last post, utilize the Modify feature up and to the right of your post. It's a convention here, and it is nice to see. [/edit]
Quote from: Quarantine on April 27, 2004, 06:36 PM
nvm i got it i had quotes around my strserver like so
That's why I wanted you to use that code I told you, I don't know how you got useast.battle.net though.
Maybe I'm wrong, but I thought CSB.Accept needed to be set first.
Also, I highly suggest you remove your BNLSBotID and BNLSBotPassword from your posted code via modify -- as to stop others from making a bot using your BNLS ID.Quote from: Myndfyre on April 27, 2004, 06:40 PM
Having no idea about CSB or anything related, I saw this line that function to stick out:
I don't know what this would do by having it hear, but I'm sure it can't be good.
Create a wannabe floodbot. :P
Quote from: Myndfyre on April 27, 2004, 06:40 PM
Also, do you believe in whitespace?
/me breaks into song.
". . . I'm a believer . . . I'm in love, oooooooooooo" :)
Yea the CleanSlateBot1.Connect in
CleanSlateBot1_Connected
was a typo on my part. I Fixed it though
Quote from: Eli_1 on April 27, 2004, 06:40 PM
Also, I highly suggest you remove your BNLSBotID and BNLSBotPassword from your posted code via modify -- as to stop others from making a bot using your BNLS ID.
Why don't you extend him the same courtesy? :P
Id like to say how i apreciate both of your help man.
I dont know what i would of done
I had no idea i used the Accept from cupheads site
lmao.
Well thanks.
Hey i connect but i get the error image list must be initialized before it can be used. Hmm if you can can you help me. Im sorry if i sound like a pest
Quote from: Quarantine on April 27, 2004, 07:04 PM
Hey i connect but i get the error image list must be initialized before it can be used.
You initialize it like so: :D
Private Sub Form_Load()
Set ListView.SmallIcons = ImageList
End Sub
Assuming you have an imagelist on your form with all the chat icons also.
Quote from: Myndfyre on April 27, 2004, 07:03 PM
Why don't you extend him the same courtesy? :P
Done. ::)
Thanks.
Now i just need to fix my image view lol
If i need anymore help ill post it
really thanks.
Quote from: Quarantine on April 27, 2004, 07:35 PM
Thanks.
Now i just need to fix my image view lol
If i need anymore help ill post it
really thanks.
Image view?
You mean listview?
Eh yea my bad
Also make it able to recieve messages since i can only send them :-\
Quote from: Quarantine on April 27, 2004, 09:49 PM
Eh yea my bad
Also make it able to recieve messages since i can only send them :-\
If you mean receive messages from battle.net, you will always receive data. CleanSlateBot will parse these 0x0F packets , "behind the scenes", and raise their corresponding events for you. If you want to deal with messages someone says, you would put your code in the CleanSlateBot1_UserTalk(...) event.
Ok i got that. :)
Now its looking to be in good shape :-P
Anyways Thanks guys.
btw the lit view is erm whacky lol
What's wrong with the listview? It may help if you post your user join/leave/in channel/whatever else uses the listview code.
Ah nvm i fixed it. My Bot is going smothly now. Added quick Channels and other stuff thanks for the help guys :-D