Valhalla Legends Forums Archive | Battle.net Bot Development | better queue system

AuthorMessageTime
Gangz
Currently i have my queue checking every 3 seconds if there is a message that needs to be sent. You can imagine when i need it to respond fast it does not.

[code]

Private Sub tmrQueue_Timer()
If tmrQueue.Interval = tmrQueue.Interval * GetStuff("Config", "Queue", "Reset") Then
tmrQueue.Interval = GetStuff("Config", "Queue", "Delay")
End If
If Left(cboQueue.List(0), 4) = "/ban" Then
splt = Split(cboQueue.List(0), "/ban ")(1)
splt = Split(splt, " ")(0)
For i = 0 To Form1.safelist.ListCount - 1
If LCase(Form1.safelist.List(i)) = LCase(splt) Then
cboQueue.RemoveItem 0
cboQueue.AddItem "This user cannot be banned due to the safelist!"
Exit Sub
End If
Next i
ElseIf Left(cboQueue.List(0), 5) = "/kick" Then
splt = Split(cboQueue.List(0), "/kick ")(1)
splt = Split(splt, " ")(0)
For i = 0 To Form1.safelist.ListCount - 1
If LCase(Form1.safelist.List(i)) = LCase(splt) Then
cboQueue.RemoveItem 0
cboQueue.AddItem "This user cannot be kicked due to the safelist!"
Exit Sub
End If
Next i
ElseIf Left(cboQueue.List(0), 8) = "/squelch" Then
splt = Split(cboQueue.List(0), "/squelch ")(1)
splt = Split(splt, " ")(0)
For i = 0 To Form1.safelist.ListCount - 1
If LCase(Form1.safelist.List(i)) = LCase(splt) Then
cboQueue.RemoveItem 0
cboQueue.AddItem "This user cannot be ignored due to the safelist!"
Exit Sub
End If
Next i
ElseIf Left(cboQueue.List(0), 7) = "/ignore" Then
splt = Split(cboQueue.List(0), "/ignore ")(1)
splt = Split(splt, " ")(0)
For i = 0 To Form1.safelist.ListCount - 1
If LCase(Form1.safelist.List(i)) = LCase(splt) Then
cboQueue.RemoveItem 0
cboQueue.AddItem "This user cannot be ignored due to the safelist!"
Exit Sub
End If
Next i
End If

If cboQueue.List(0) <> "" Then
Dim y As Integer, X As Integer
Form1.Send cboQueue.List(0)
cboQueue.RemoveItem 0
tmrQueue.Interval = tmrQueue.Interval + GetStuff("Config", "Queue", "Add")
lblDelay.Caption = "Delay: " & tmrQueue.Interval
End If
End Sub
[/code]

any suggestions?
June 5, 2004, 8:52 PM
CrAz3D
Make it check at a shorter interval?...
June 5, 2004, 9:03 PM
Myndfyr
[quote author=CrAz3D link=board=17;threadid=7109;start=0#msg63728 date=1086469434]
Make it check at a shorter interval?...
[/quote]

I have my incoming queue checked every 10 ms or so. That is sometimes barely enough time for a given thread to complete. :)
June 5, 2004, 9:11 PM
Gangz
So make the interval about 5-10ms and then change it back to 3000 when there is more then 1 msg to be sent?
June 5, 2004, 9:46 PM
Eli_1
There's a good flood protection on the botdev website somewhere in the documents section. Go read the code and [u]figure out how it works[/u], then model a similar flood protection after it.
June 5, 2004, 10:50 PM
Gangz
LoL Im not talking about flood protection. Im talking about the queue as a whole.
June 5, 2004, 11:24 PM
CrAz3D
Flood protection is so YOUR CLIENT doesn't flood. It should be flood prevention, or something like that.
June 5, 2004, 11:28 PM
Dyndrilliac
I posted a Queue System a few days ago that I finally got working perfectly.

[code]Public Queue() As String
Public QNum As Integer
Public QDelay As Single
Public sFloodThresh As String
Public iFloodThresh As Single

Public Sub AddQ(Message As String)
On Error GoTo ErrorHandle
If sFloodThresh = Message Or Len(sFloodThresh) = Len(Message) Then
iFloodThresh = iFloodThresh + 1
If iFloodThresh >= 4 Then
Pause 2, True
iFloodThresh = 0
End If
Else
iFloodThresh = 0
End If
TryAgain:
Do Until Queue(QNum) = vbNullString
QNum = QNum + 1
Loop
Queue(QNum) = Message
sFloodThresh = Message
Exit Sub
ErrorHandle:
QNum = 0
ReDim Preserve Queue(1000)
Queue(0) = vbNullString
GoTo TryAgain
End Sub

Private Sub tQueue_Timer()
If Connected = False Then
Exit Sub
End If

If Queue(QNum) = vbNullString Then
Exit Sub
End If

Dim i As Integer
For i = 0 To QNum
QDelay = ((Len(Queue(i)) / 10) / 2)
If Len(Queue(i)) <= 10 & QDelay <= 0.5 Then
QDelay = QDelay + 0.5
End If
Pause QDelay, True
QDelay = 0
Send Queue(i)
Queue(i) = vbNullString
Next i
End Sub[/code]

My Timer's Interval is set at 50ms.
June 5, 2004, 11:31 PM
Gangz
Instead of using someone elses coding i just added

[code]
If Form1.cboQueue.ListCount < 2 Then tmrQueue.Interval = GetStuff("Config", "Queue", "Delay")
If Form1.cboQueue.ListCount > 1 Then tmrQueue.Interval = GetStuff("Config", "Queue", "Delay2")
[/code]

it seems to be working okay now.
June 6, 2004, 12:46 AM
hismajesty
You shouldn't use a form control for your queue.
June 6, 2004, 12:53 AM
BinaryzL
[quote author=Eli_1 link=board=17;threadid=7109;start=0#msg63758 date=1086475825]
There's a good flood protection on the botdev website somewhere in the documents section. Go read the code and [u]figure out how it works[/u], then model a similar flood protection after it.
[/quote]

Yeah, so that is of no use basically.
June 6, 2004, 1:55 AM
Adron
[quote author=Gangz link=board=17;threadid=7109;start=0#msg63781 date=1086482786]
it seems to be working okay now.
[/quote]

Won't that code make you flood if you're typing fast (as opposed to pasting or automatically generating)? Sounds like you'll first send one message fast, because it's the only one, then another, then another, and ... flood.
June 6, 2004, 9:52 AM
Gangz
[quote author=Adron link=board=17;threadid=7109;start=0#msg63827 date=1086515534]
[quote author=Gangz link=board=17;threadid=7109;start=0#msg63781 date=1086482786]
it seems to be working okay now.
[/quote]

Won't that code make you flood if you're typing fast (as opposed to pasting or automatically generating)? Sounds like you'll first send one message fast, because it's the only one, then another, then another, and ... flood.
[/quote]

Actually If you type fast enough to send more then 1 message a second then it raises the queue. My bot is a moderation bot withought a chat inferface. If You are using commands at 1 msg per second then your probably abuse the the use of the bot and deserve to have it dropped.
June 6, 2004, 6:30 PM
CrAz3D
WHAT kind of logic is that?! Moderation bots are supposed to stay up no matter what.
June 6, 2004, 7:12 PM
Gangz
Its true, but the chances of anyone dropping it is [bold]VERY[/bold] slim. I added everyone i know and did my best to try and drop it and it could not be done. The only possbile way to drop it is add a chat interface and spam all over
June 6, 2004, 8:27 PM
tA-Kane
[quote author=Gangz link=board=17;threadid=7109;start=0#msg63873 date=1086553660][bold]VERY[/bold][/quote]FYI, it's b, not bold.
June 6, 2004, 11:57 PM

Search