Grok's code didn't work when I tested it. I have a bot written by me, but I need Flood Protection. Somone help! Thanx.
this is probably safe flood protection:
if len(txt) > 60 then txt = left(txt, 60)
sleep 3000
But terrible.
Add all send events to a queue and have a timer empty it and write to bnet.
Quote from: St0rm.iD on October 21, 2003, 07:43 PM
But terrible.
Add all send events to a queue and have a timer empty it and write to bnet.
nonono, use a stack! Then your messages will display backwards; but don't tell the person you send your bot to, have the messages displayed as soon as he hits send on the client side, then watch the hilarity ensue! :)
Quote from: Adron on October 21, 2003, 05:14 PM
this is probably safe flood protection:
if len(txt) > 60 then txt = left(txt, 60)
sleep 3000
You can also get a funny version of the same protection method if you replace "left" with "right"
For an infinite sequence of long messages, is the flood protection I suggested more than 20% off? For an infinite sequence of short messages, is it more than 30% off? I don't think it's that bad at all if it's within 30%!
Well.. Using
if len(txt) > 60 then txt = left(txt, 60)
sleep 3000
Why only 60? And...Should I put this for all the data sending? Or..What? Cause im slightly confused.
What that does is
If the length of 'txt' is greater than 60, replace text with the first 60 characters fro the left side of the string. Then pause for 3000 milliseconds before proceeding.
Basically he is saying you need that long of a duration before you send anymore data, for every 60 characters sent.
I'm saying that the ultra flood protection should be around 60 characters somewhere and that for 60 characters you get a waiting time that is somewhere close to 3 seconds anyway.
While waiting, I came up with my own Flood Protection... Its rather 'Ghetto' if you will, and im sure buggy.. Buts it worked not bad so far.
Public Function SendData(Text As String)
frmMain.FloodC.Text = frmMain.FloodC.Text + 1
'Basicaly, just adds one digit to the Flood Counter Txt
'Then sends the actual text through Clean Slate...
frmMain.CSB1.Send Text
'But if the FloodC is >= 1, then it'll wait until it
'drops back down to 0, before it proceeds to send
'more data.
If frmMain.FloodC.Text >= "1" Then
Do Until frmMain.FloodC.Text = "0"
DoEvents
Loop
End If
DoEvents
End Function
Private Sub FloodProtecion_Timer()
'Interval: 1300
'Slowely takes away the digit back down to 0,
'So it wont send until its 0...So gives time in between
If FloodC.Text > "0" Then FloodC.Text = FloodC.Text - 1
End Sub
The algorithm they use is actually rather complicated, but 60 characters is the most efficient length. I would recommend figureing out what the lowest safe time/character is for each possible length and calculating the formula. It will involve getting banned from b.net a lot, but it'll be fun!
Incidently, use [code ] and [/ code] tags around your source code to make it easier to read.
Thanks!
QuoteIf frmMain.FloodC.Text >= "1" Then
Do Until frmMain.FloodC.Text = "0"
DoEvents
Loop
End If
I'm confused; why are you checking if the text > "1"? That makes no sense..
No, if FloodC.Text is >= 1. Thats the Flood Counter text box. When you call the Send command, it adds 1 to that text box. If the Text is greater than 0, it'll stall until its back to zero, causing the pause. The timer checks to see if the Flood Counter is greater than 0 to know whether or not it should decrease at a rate before it sends the next set of data.
Quote from: pyropk on October 23, 2003, 03:05 AM
No, if FloodC.Text is >= 1. Thats the Flood Counter text box. When you call the Send command, it adds 1 to that text box. If the Text is greater than 0, it'll stall until its back to zero, causing the pause. The timer checks to see if the Flood Counter is greater than 0 to know whether or not it should decrease at a rate before it sends the next set of data.
That's a nice idea. My original flood protection was something like:
Add 200 + the number of characters in the message to the flood counter when sending a message.
Decrease the flood counter by 1 every 11 ms.
Only send a message if the resulting flood counter after sending the message would be less than 600.
Edit:
You can't set a timer for 11 ms and get it to decrease the flood counter reliably, you'd have to set it for 110 ms and decrease by 10 or something like that.
Don't use a textbox, use a variable.
Ditto!
Quote from: bmwrb16 on October 23, 2003, 09:53 PM
Ditto!
May I ask what the purpose of this post was?
Quote from: Tuberload on October 24, 2003, 03:34 AM
Quote from: bmwrb16 on October 23, 2003, 09:53 PM
Ditto!
May I ask what the purpose of this post was?
Making a useless post asking why someone made a useless post is a waste of time.
I suppose this post is rather useless too.
Quote from: Hitmen on October 24, 2003, 02:33 PM
Quote from: Tuberload on October 24, 2003, 03:34 AM
Quote from: bmwrb16 on October 23, 2003, 09:53 PM
Ditto!
May I ask what the purpose of this post was?
Making a useless post asking why someone made a useless post is a waste of time.
I suppose this post is rather useless too.
Mine wasn't really a useless post because I was trying to figure something out. He clearly was not and neither were you. So you guys posted the useless posts. My curiosity gave mine a point. ;D
Here is a queue system i designed for my zonebot use it if you like its very stable note set timer5.interval to 100 and timer2.interval to 4000
Public Sub Send(ByVal strText As String)
On Error Resume Next
QueueCount = QueueCount + 1
Bot.mnuQ.Caption = "Queue(" & QueueCount & ")"
Bot.List1.AddItem strText
End Sub
Public Sub QueueClear()
QueueCount = 0
Bot.List1.Clear
LastQueue = ""
Bot.mnuQ.Caption = "Queue(" & QueueCount & ")"
End Sub
'no double ban queue
Public Sub CheckQueue(Queue1 As String, Queue2 As String)
If LCase(Left(Queue1, 4)) = "/ban" And LCase(Left(Queue2, 4)) = "/ban" Then
If LCase(Queue1) = LCase(Queue2) Then
Allowed = flase
Else
Allowed = True
End If
Else
Allowed = True
End If
End Sub
Private Sub Timer5_Timer()
If Timer2.Enabled = True Then
Else
If List1.ListCount = "0" Then
Else
QueueCount = QueueCount - 1
Bot.mnuQ.Caption = "Queue(" & QueueCount & ")"
Call CheckQueue(LastQueue, Bot.List1.List(0))
If Allowed = True Then
'AddChat "<" & varuser & ">", vbYellow, Bot.List1.List(0), vbWhite
CleanSlateBot1.Send Bot.List1.List(0)
If LCase(Left(Bot.List1.List(0), 1)) = "/" Then
'
Else
AddChat "<" & varUsername & ">", vbYellow, Bot.List1.List(0) & vbNewLine, vbWhite
End If
LastQueue = Bot.List1.List(0)
Bot.List1.RemoveItem (0)
Timer2.Enabled = True
End If
If Allowed = False Then
Bot.List1.RemoveItem (0)
Call CheckQueue(LastQueue, Bot.List1.List(0))
End If
End If
End If
End Sub
Michael... your code is pretty hard 2 read u know. You have no enters in any of it or indentations.
WOW! Two years dead.
The nested ifs are pretty ugh too.
oh dear! 2 years 10 months 6 days dead.
thats right break it down!!
-Mouse drifts around for the lock topic button as if it were really there-
Quote from: ImaWh0re on September 22, 2006, 12:54 PM
-Mouse drifts around for the lock topic button as if it were really there-
You're not a moderator. Stop bitching about it. You're just contributing to the problem.
I wasn't bitching I was putting my 2 cents in. Hence why I said 'as if it were really there', being I am obviously NOT a moderator. It was a joke, you understand that right?
hehehe....newbie talks back to Myndy :P
I'm not a newbie :( I'm not gosu but defiantly far from a newbie. And my tag lies.
ROFL..."gosu".... I can't believe that's still floating around...
Quote from: rabbit on September 22, 2006, 07:59 PM
ROFL..."gosu".... I can't believe that's still floating around...
I thought it died as well.
im a newbie so what. =P