Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Yegg on August 21, 2004, 05:01 PM

Title: Connect on Startup
Post by: Yegg on August 21, 2004, 05:01 PM
Ok, Im trying to get my bot to connect as soon as the bot is opened, and I also want to be able to check a checkbox to determine if this will happen or not. Can anyone help me with the code I need to enter to make this happen?
Title: Re:Connect on Startup
Post by: Kp on August 21, 2004, 05:16 PM
Yes.  Create a button; on exit from the program, save whether the button was checked.  On startup, load that setting from registry/disk/wherever, and if it says the button was checked, call your connect method immediately.
Title: Re:Connect on Startup
Post by: Yegg on August 21, 2004, 06:12 PM
Im not sure i really understand that, but is there a way I can make something automatically "run" when I open the bot. I cna figure out the rest on my own.
Title: Re:Connect on Startup
Post by: Kp on August 21, 2004, 06:40 PM
Quote from: Yegg on August 21, 2004, 06:12 PMIm not sure i really understand that, but is there a way I can make something automatically "run" when I open the bot. I cna figure out the rest on my own.

Yes.  Put it in the entry point function, which is typically main (Win32 console / Unix), or WinMain (Win32 GUI).  Alternate names are needed if you want to get Unicode native parameters.
Title: Re:Connect on Startup
Post by: LordNevar on August 22, 2004, 07:22 AM
Or on Form_Load, just call your connect call and it should start the logon sequence. Or you can do what was previoulsy posted and make a button to call on when you load your bot.
Title: Re:Connect on Startup
Post by: l2k-Shadow on August 22, 2004, 03:27 PM
Supposing that you have Getstuff and WriteStuff functions:

In config form:


Private Sub SaveButton_Click()
Writestuff "Misc","ConnectOnStartup", YourCheckBoxName
End Sub

Private Sub Form_Load()
YourCheckBoxName = Getstuff("Misc","ConnectOnStartup")
End Sub

'Main Form
Private Sub Form_Load()
If Getstuff("Misc","ConnectOnStartup") = "1" Then
'Connect Coding Goes Here
End if
End Sub

:)