Author Topic: VB6 Queue System  (Read 12535 times)

0 Members and 1 Guest are viewing this topic.

Offline rabbit

  • x86
  • Hero Member
  • *****
  • Posts: 8092
  • I speak for the entire clan (except Joe)
    • View Profile
VB6 Queue System
« on: May 03, 2005, 04:46:54 pm »
I wrote this for my new bot, and I find that it works very well.  It's influenced by Adron's RequiredDelay(), but with that I got rediculous delay times (like 3 days) for 4 byte messages.  Anyways, here it is:
Code: [Select]
Public Function GetDelay(strMessage As String) As Long
    Static LastTick As Long
    Const DelayPerByte As Long = 10
    Dim Tick As Long
    Dim Bytes As Long
    Dim Delay As Long
   
    Bytes = Len(strMessage) + 1
    Tick = GetTickCount()
    If LastTick = 0 Then LastTick = Tick 'the first time the function is called it's 0
    Delay = LastTick - Tick
   
    While Delay < 0
        Delay = Delay + (Bytes * DelayPerByte) * 200
    Wend
   
    Delay = Delay + 1  'sometimes it's 0, and that disables timers
   
    LastTick = Tick
    GetDelay = Delay
End Function

Offline Joe

  • B&
  • Moderator
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: VB6 Queue System
« Reply #1 on: May 29, 2005, 11:25:01 am »
If you're really paraniod, you should set Delay = IIf(Delay = 0, 1, Delay).
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: VB6 Queue System
« Reply #2 on: May 29, 2005, 11:59:38 am »
If you're really paraniod, you should set Delay = IIf(Delay = 0, 1, Delay).

Uh, this topic is almost a month old. :\