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.
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
any suggestions?
Make it check at a shorter interval?...
Quote from: CrAz3D on June 05, 2004, 04:03 PM
Make it check at a shorter interval?...
I have my incoming queue checked every 10 ms or so. That is sometimes barely enough time for a given thread to complete. :)
So make the interval about 5-10ms and then change it back to 3000 when there is more then 1 msg to be sent?
There's a good flood protection on the botdev (http://botdev.valhallalegends.com) website somewhere in the documents section. Go read the code and figure out how it works[/u][/i], then model a similar flood protection after it.
LoL Im not talking about flood protection. Im talking about the queue as a whole.
Flood protection is so YOUR CLIENT doesn't flood. It should be flood prevention, or something like that.
I posted a Queue System a few days ago that I finally got working perfectly.
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
My Timer's Interval is set at 50ms.
Instead of using someone elses coding i just added
If Form1.cboQueue.ListCount < 2 Then tmrQueue.Interval = GetStuff("Config", "Queue", "Delay")
If Form1.cboQueue.ListCount > 1 Then tmrQueue.Interval = GetStuff("Config", "Queue", "Delay2")
it seems to be working okay now.
You shouldn't use a form control for your queue.
Quote from: Eli_1 on June 05, 2004, 05:50 PM
There's a good flood protection on the botdev (http://botdev.valhallalegends.com) website somewhere in the documents section. Go read the code and figure out how it works[/u][/i], then model a similar flood protection after it.
Yeah, so that is of no use basically.
Quote from: Gangz on June 05, 2004, 07:46 PM
it seems to be working okay now.
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 from: Adron on June 06, 2004, 04:52 AM
Quote from: Gangz on June 05, 2004, 07:46 PM
it seems to be working okay now.
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.
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.
WHAT kind of logic is that?! Moderation bots are supposed to stay up no matter what.
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