Valhalla Legends Forums Archive | Battle.net Bot Development | Please help

AuthorMessageTime
Quarantine
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
[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
[/code]
April 27, 2004, 10:47 PM
Eli_1
Your accept is wrong, and that needs to be the first property you set.
April 27, 2004, 10:52 PM
Quarantine
Hmm ill try it thanks.
April 27, 2004, 11:06 PM
Eli_1
The correct accept number for CSB is 579728. So your code should work if it was:
[code]
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
[/code]

I also just noticed that your never calling CleanSlateBot1.Connect.
April 27, 2004, 11:19 PM
Quarantine
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?
April 27, 2004, 11:20 PM
Eli_1
[quote author=Quarantine link=board=17;threadid=6509;start=0#msg57169 date=1083108028]
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]

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. ;)
April 27, 2004, 11:22 PM
Quarantine
[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
April 27, 2004, 11:31 PM
Quarantine
nvm i got it i had quotes around my strserver like so

Before
[code] 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"[/code]
After
[code] 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"[/code]
April 27, 2004, 11:36 PM
Myndfyr
Having no idea about CSB or anything related, I saw this line that function to stick out:

[code]
Private Sub CleanSlateBot1_BnetConnected()
CleanSlateBot1.Connect
AddChat "Connected!" & vbNewLine, vbGreen
End Sub
[/code]

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]
April 27, 2004, 11:40 PM
Eli_1
[quote author=Quarantine link=board=17;threadid=6509;start=0#msg57174 date=1083108986]
nvm i got it i had quotes around my strserver like so[/quote]
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 author=Myndfyre link=board=17;threadid=6509;start=0#msg57175 date=1083109229]
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.[/quote]
Create a wannabe floodbot. :P

[quote author=Myndfyre link=board=17;threadid=6509;start=0#msg57175 date=1083109229]
Also, do you believe in whitespace?[/quote]
[me=Eli_1]breaks into song.[/me]
". . . I'm a believer . . . I'm in love, oooooooooooo" :)
April 27, 2004, 11:40 PM
Quarantine
Yea the CleanSlateBot1.Connect in
CleanSlateBot1_Connected
was a typo on my part. I Fixed it though
April 27, 2004, 11:59 PM
Myndfyr
[quote author=Eli_1 link=board=17;threadid=6509;start=0#msg57176 date=1083109255]
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]

Why don't you extend him the same courtesy? :P
April 28, 2004, 12:03 AM
Quarantine
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
April 28, 2004, 12:04 AM
Eli_1
[quote author=Quarantine link=board=17;threadid=6509;start=0#msg57186 date=1083110686]
Hey i connect but i get the error image list must be initialized before it can be used.[/quote]
You initialize it like so: :D
[code]
Private Sub Form_Load()
Set ListView.SmallIcons = ImageList
End Sub[/code]
Assuming you have an imagelist on your form with all the chat icons also.

[quote author=Myndfyre link=board=17;threadid=6509;start=0#msg57185 date=1083110623]
Why don't you extend him the same courtesy? :P[/quote]
Done. ::)
April 28, 2004, 12:11 AM
Quarantine
Thanks.
Now i just need to fix my image view lol
If i need anymore help ill post it
really thanks.
April 28, 2004, 12:35 AM
Newby
[quote author=Quarantine link=board=17;threadid=6509;start=0#msg57193 date=1083112536]
Thanks.
Now i just need to fix my image view lol
If i need anymore help ill post it
really thanks.

[/quote]
Image view?

You mean listview?
April 28, 2004, 1:00 AM
Quarantine
Eh yea my bad
Also make it able to recieve messages since i can only send them :-\
April 28, 2004, 2:49 AM
Eli_1
[quote author=Quarantine link=board=17;threadid=6509;start=15#msg57216 date=1083120571]
Eh yea my bad
Also make it able to recieve messages since i can only send them :-\
[/quote]
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.
April 28, 2004, 2:56 AM
Quarantine
Ok i got that. :)
April 28, 2004, 3:04 AM
Quarantine
Now its looking to be in good shape :-P
Anyways Thanks guys.
btw the lit view is erm whacky lol
April 28, 2004, 10:52 AM
hismajesty
What's wrong with the listview? It may help if you post your user join/leave/in channel/whatever else uses the listview code.
April 28, 2004, 11:09 AM
Quarantine
Ah nvm i fixed it. My Bot is going smothly now. Added quick Channels and other stuff thanks for the help guys :-D
April 28, 2004, 11:38 PM

Search