Attribute VB_Name = "modQueueScript"
Public Function CalculateDelay(strText As String, B As BNCS) As Long
On Error GoTo hErr:
1   Dim M As Object, lngRetVal As Long, Found As Boolean
2   For Each M In frmBot.scQueue.Modules
3       If LCase$(M.Name) = LCase$(B.Config.Queue) Then
4           lngRetVal = CLng(Val(M.Run("CalculateDelay", strText, B.TickSend, B.QueueConsecutive, B.QueueTotal)))
5           B.TickQueue = lngRetVal
6           CalculateDelay = lngRetVal
            Found = True
            Exit Function
        End If
    Next
    If Found Then Exit Function
hErr:
    CalculateDelay = 5000
    B.TickQueue = 5000
    If Err Then ErrorHandler Err.Number, Err.Description, Erl, B.Config.Queue, "CalculateDelay", frmBot.scQueue.error, B.BotIndex
End Function

Public Sub RefreshQueues()
On Error Resume Next
    With frmBot
        Dim F() As String, I As Integer
        F = FileList(AppData & "Queues\*.queue")
        For I = .mnuQ.UBound To 1 Step -1
            Unload .mnuQ(I)
        Next
        .mnuQ(0).Caption = vbNS
        For I = 0 To UBound(F)
            If Len(F(I)) > 4 Then
                If Len(.mnuQ(0).Caption) Then Load .mnuQ(.mnuQ.Count)
                With .mnuQ(.mnuQ.UBound)
                    .Caption = Prefix(F(I), ".queue")
                    .Visible = True
                    If SelBot > -1 Then .Checked = LCase$(.Caption) = LCase$(frmBot.Bot(SelBot).Config.Queue)
                End With
            End If
        Next
    End With
End Sub

Public Function SequentialReset(B As BNCS) As Long
On Error GoTo hErr:
1   Dim M As Object, lngRetVal As Long, Found As Boolean
2   For Each M In frmBot.scQueue.Modules
3       If LCase$(M.Name) = LCase$(B.Config.Queue) Then
4           lngRetVal = CLng(Val(M.Run("SequentialReset")))
5           SequentialReset = lngRetVal
            Found = True
            Exit For
        End If
    Next
    If Found Then Exit Function
hErr:
    SequentialReset = 5000
    If Err Then ErrorHandler Err.Number, Err.Description, Erl, B.Config.Queue, "SequentialReset", frmBot.scQueue.error, B.BotIndex
End Function
