i was wondering how you can do a auto-reconnect function, i was thinking a timer and every so often seconds it checks to see if you are connected, but that would just waste memory,
i am using visual basics, and running csb(cleanslatebot).
On the BnetDisconnected event, call csb.connect I believe.
i know but what if you disconnect from the mnuDisconnect() function
then when you do that it will just reconnect
Have a boolean variable like "ShouldBeConnected".
This variable will be True when the bot should be connected, or False when the bot should be disconnected.
Then, when you disconnect intentionally (i.e. from the mnuDisconnect function):
ShouldBeConnected = False
CSB.Close ' or whatever the function name is
And in the BnetDisconnected event:
If ShouldBeConnected Then CSB.Connect
If you're using CleanSlateBot1.Disconnect as part of your mnuDisconnect sub, then reconnecting on disconnect will be fine. The .Disconnect method intentionally does not raise the BnetDisconnected, RealmDisconnected, and/or BNLSDisconnected events.
I've never heard of visual basics.
This code i am using for VB.Net:
Handles the CleanSlateBot.OCX Event Disconnected:
Private Sub BNET_Disconnected(ByVal sender As Object, ByVal e As System.EventArgs) Handles csb.BnetDisconnected
AddChat(Col.FromKnownColor(Color_Text_Error), "Disconnected from Battle.Net.")
csb.Connect()
End Sub
Handles your mnuDisconnect() Event:
Private Sub mnuDisconnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuDisconnect.Click
If csb.Connected = True Then csb.Disconnect()
End Sub
csb = CleanSlateBot.ocx