• Welcome to Valhalla Legends Archive.
 

Can you help me

Started by Warrior, April 30, 2004, 03:32 PM

Previous topic - Next topic

Warrior

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
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?

hismajesty

When you click save does it actually save? Post code.

Warrior

#2
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"

It will Actually Edit u just have to close and reopen bot for changes to take effct
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?

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().

Warrior

#4
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
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
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?

LordNevar

Do you have a SaveConfig, or a LoadConfig Function?

A good fortune may forbode a bad luck, which may in turn disguise a good fortune.
The greatest trick the Devil ever pulled, was convincing the world he didn't exsist.

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.
asdf.

LordNevar

Quote from: Maddox on April 30, 2004, 09:31 PM
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.

I agree maddox, but atleast he's trying to learn, and not just posting someone else's code saying can you fix this.

A good fortune may forbode a bad luck, which may in turn disguise a good fortune.
The greatest trick the Devil ever pulled, was convincing the world he didn't exsist.

Warrior

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?
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?

Tazo

It must be someone elses, because he posted using GetINI and now he says he doesnt even have a load cfg function...

Dyndrilliac

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


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.
Quote from: Edsger W. DijkstraIt is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.

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