Valhalla Legends Forums Archive | Battle.net Bot Development | Can you help me

AuthorMessageTime
Quarantine
Im having trouble with my CSB Bot. I type in the things to Edit the Config Click Save and when i try to connect it connects with my old Configuration.\

I have a theory but i havent tried it yet.
Should i fetch the Config Things like GetStuff
On mnuconnect_click
Idk if it will work any feed back would be appreciated
April 30, 2004, 8:32 PM
hismajesty
When you click save does it actually save? Post code.
April 30, 2004, 10:53 PM
Quarantine
[code]Private Sub cmdSave_Click()
WriteStuff "Login", "User", txtUsername.Text
WriteStuff "Login", "Password", txtPassword.Text
WriteStuff "Login", "Cd-Key", txtCdkey.Text
WriteStuff "Login", "Home-Channel", txthomechan.Text



If optStar = True Then
WriteStuff "Login", "Client", "RATS"
End If

If optW2BN = True Then
WriteStuff "Login", "Client", "NB2W"
End If

If optDiablo2 = True Then
WriteStuff "Login", "Client", "VD2D"
End If

If optSEXP = True Then
WriteStuff "Login", "Client", "PXES"
End If
If Option1 = True Then
WriteStuff "Login", "Server", "useast.battle.net"
End If

If Option2 = True Then
WriteStuff "Login", "Server", "uswest.battle.net"
End If

If Option3 = True Then
WriteStuff "Login", "Server", "asia.battle.net"
End If

If Option4 = True Then
WriteStuff "Login", "Server", "europe.battle.net"
[/code]
It will Actually Edit u just have to close and reopen bot for changes to take effct
April 30, 2004, 11:02 PM
hismajesty
No you don't, when you go to connect just have it check the values, like what you would do in your configuration forms Form_Load().
April 30, 2004, 11:09 PM
Quarantine
[code]CleanSlateBot1.Disconnect
Form2.txtUsername.Text = GetStuff("Login", "User")
Form2.txtPassword.Text = GetStuff("Login", "Password")
Form2.txtCdkey.Text = GetStuff("Login", "Cd-Key")
Form2.txthomechan.Text = GetStuff("Login", "Home-Channel")
Form2.Text1.Text = GetStuff("Login", "Trigger")
If GetStuff("Login", "Client") = "RATS" Then
Form2.optStar.Value = True
Form2.optW2BN.Value = False
Form2.optDiablo2.Value = False
Form2.optSEXP.Value = False
End If
If GetStuff("Login", "Client") = "PXES" Then
Form2.optStar.Value = False
Form2.optW2BN.Value = False
Form2.optDiablo2.Value = False
Form2.optSEXP.Value = True
End If
If GetStuff("Login", "Client") = "VD2D" Then
Form2.optStar.Value = False
Form2.optW2BN.Value = False
Form2.optDiablo2.Value = True
Form2.optSEXP.Value = False
End If
If GetStuff("Login", "Client") = "NB2W" Then
Form2.optStar.Value = False
Form2.optW2BN.Value = True
Form2.optDiablo2.Value = False
Form2.optSEXP.Value = False
End If

If GetStuff("Login", "Server") = "useast.battle.net" Then
Form2.Option1.Value = True
Form2.Option2.Value = False
Form2.Option3.Value = False
Form2.Option4.Value = False
End If
If GetStuff("Login", "Server") = "uswest.battle.net" Then
Form2.Option1.Value = False
Form2.Option2.Value = True
Form2.Option3.Value = False
Form2.Option4.Value = False
End If
If GetStuff("Login", "Server") = "Asia.battle.net" Then
Form2.Option1.Value = False
Form2.Option2.Value = False
Form2.Option3.Value = True
Form2.Option4.Value = False
End If
If GetStuff("Login", "Server") = "Europe.battle.net" Then
Form2.Option1.Value = False
Form2.Option2.Value = False
Form2.Option3.Value = False
Form2.Option4.Value = True
End If[/code] I put this in the config and it still dont work
Edit: the CleanSlateBot1.Disconnect goes before i connect so it destroys the earlier connections making rejoin possible
May 1, 2004, 12:30 AM
LordNevar
Do you have a SaveConfig, or a LoadConfig Function?
May 1, 2004, 2:20 AM
Maddox
Threads like these need to be deleted.

Don't try to create a bot without knowing the language first.
Don't ask questions without debugging.
May 1, 2004, 2:31 AM
LordNevar
[quote author=Maddox link=board=17;threadid=6581;start=0#msg57833 date=1083378686]
Threads like these need to be deleted.

Don't try to create a bot without knowing the language first.
Don't ask questions without debugging.
[/quote]

I agree maddox, but atleast he's trying to learn, and not just posting someone else's code saying can you fix this.
May 1, 2004, 4:20 AM
Quarantine
No i dont have a LoadConfig function or anything. If i needed one could you Explain to me how to make one and ill make it to the best of my abilities?
May 1, 2004, 11:06 AM
laurion
It must be someone elses, because he posted using GetINI and now he says he doesnt even have a load cfg function...
May 1, 2004, 2:58 PM
Dyndrilliac
[code]Public Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long

Public Sub LoadConfig()

With frmMain 'Name Of Form With CSB. Replace "C" with the CSB control's name.
.C.UserName = GetStuff("Config.ini", "Main", "UserName")
.C.Password = GetStuff("Config.ini", "Main", "Password")
.C.NewPassword = GetStuff("Config.ini", "Main", "New Password")
.C.Product = GetStuff("Config.ini", "Main", "Product")
.C.Server = GetStuff("Config.ini", "Main", "Server")
.C.Character = GetStuff("Config.ini", "Main", "Realm Character")
.C.CDKey = GetStuff("Config.ini", "Main", "CDKey")
.C.LODKey = GetStuff("Config.ini", "Main", "LOD CDKey")
.C.HomeChannel = GetStuff("Config.ini", "Main", "Home Channel")
End With

'// Options
varChangePassword = GetStuff("Config.ini", "Options", "Change Password")
varUseRealm = GetStuff("Config.ini", "Options", "UseRealm")
varUDPPlug = GetStuff("Config.ini", "Options", "LagPlug")

If varChangePassword = "1" Then frmMain.C.ChangePassword = True Else frmMain.C.ChangePassword = False
If varUseRealm = "1" Then frmMain.C.UseRealm = True Else frmMain.C.UseRealm = False
If varUDPPlug = "1" Then frmMain.C.UseUDP = False Else frmMain.C.UseUDP = True

varServer = frmMain.C.Server
Select Case (varServer)
Case "uswest.battle.net"
frmMain.C.Realm = "USWest"
Case "useast.battle.net"
frmMain.C.Realm = "USEast"
Case "europe.battle.net"
frmMain.C.Realm = "Europe"
Case "asia.battle.net"
frmMain.C.Realm = "Asia"
End Select

End Sub

Public Sub SaveConfig()

Dim pfNum As Integer
pfNum = FreeFile

Open App.Path & "\Config.ini" For Output As #pfNum
Print #pfNum, "[Main]"
Print #pfNum, "UserName=" & varUsername
Print #pfNum, "Password=" & varPassword
Print #pfNum, "New Password=" & varNewPassword
Print #pfNum, "Home Channel=" & varHome
Print #pfNum, "Server=" & varServer
Print #pfNum, "CDKey=" & varCDKey
Print #pfNum, "LOD CDKey=" & varCDKey2
Print #pfNum, "Realm Character=" & varCharacter
Print #pfNum, "Product=" & varProduct
Print #pfNum, "[Options]"
Print #pfNum, "LagPlug=" & varUDPPlug
Print #pfNum, "Change Password=" & varChangePassword
Print #pfNum, "UseRealm=" & varUseRealm
Close #pfNum

End Sub

Function GetStuff(Filename As String, SectionName As String, Data As String) As String
Dim sFile As String
Dim sDefault As String
Dim lSize As Integer
Dim l As Long
Dim sUser As String
sUser = Space$(128)
lSize = Len(sUser)
sFile = App.Path & "\" & Filename
sDefault = ""
l = GetPrivateProfileString(SectionName, Data, sDefault, sUser, lSize, sFile)
sUser = Mid(sUser, 1, InStr(sUser, Chr(0)) - 1)
GetStuff = sUser
End Function[/code]

Replace the ".C."'s with the "." then the CSB control name then another ".". Replace frmMain with the name of the form containing the control.

Assuming you declare your variables and set it up right in the form, your good to go from there. If you still can't figure it out, you should be shot.

Note that you don't really need the load config, it just makes it easier to load your config files by having the code you use repeatedly in a callable procedure. It makes the code more modular, and easier to reload your setup after you save it.
May 1, 2004, 2:59 PM
eXShadow
ok assuming you have stuff like GetStuff(Login", "User", txtUsername.Text) ect under Form_Load in your config form, copy and paste it under the mnuconnect_click, like you were thinking. There a simple fix.

Hope this helps
May 2, 2004, 3:08 PM

Search