Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Blaze on May 18, 2004, 07:34 AM

Title: Removing things from a listbox
Post by: Blaze on May 18, 2004, 07:34 AM
Private Sub QueTimer_Timer()

Dim RemoveItem As String
If Que.ListCount = "0" Then
QueTimer.Interval = QueTimer.Interval - 300
End If

If Que.ListCount =>1 Then
Main.CleanSlateBot1.Send Que.List(0)
Que.RemoveItem Que.List(0)
QueTimer.Interval = QueTimer.Interval + 300
End If

If QueTimer.Interval < 1000 Then
QueTimer.Interval = 1000
End If

If QueTimer.Interval > 15000 Then
QueTimer.Interval = 15000
End If

If Que.ListCount > 30 Then
AddChat "Queue Cleared" & vbNewLine, vbRed
Que.Clear
End If
End Sub


That is my code for my que timer and its being evil. I really don't know how to use listboxs because I never use them... It keeps giving me an error on this line...


Que.RemoveItem Que.List(0)
Title: Re:Removing things from a listbox
Post by: Insecure on May 18, 2004, 08:38 AM
If you posted this on the vb section you might get more responces but...

As far as I know for a listbox to remove it you need to que.remove (i).

(If I am wrong I am sorry...pain pills are fun to have because I can't remember much)
Title: Re:Removing things from a listbox
Post by: Eli_1 on May 18, 2004, 09:48 AM
que.Remove takes in an integer as it's parameter, and your giving it a string.

Try

que.Remove 0



On a side note, your TAB key is dieing for some attention. :(
Title: Re:Removing things from a listbox
Post by: BinaryzL on May 18, 2004, 10:40 AM
Unfixed code but "formatted".

Private Sub QueTimer_Timer()
Dim RemoveItem As String
   
   If Que.ListCount = "0" Then
       QueTimer.Interval = QueTimer.Interval - 300
   End If
   
   If Que.ListCount >= 1 Then
       Main.CleanSlateBot1.Send Que.List(0)
       Que.RemoveItem Que.List(0)
       QueTimer.Interval = QueTimer.Interval + 300
   End If
   
   If QueTimer.Interval < 1000 Then
       QueTimer.Interval = 1000
   End If
   
   If QueTimer.Interval > 15000 Then
       QueTimer.Interval = 15000
   End If
   
   If Que.ListCount > 30 Then
       AddChat "Queue Cleared" & vbNewLine, vbRed
       Que.Clear
   End If
End Sub
Title: Re:Removing things from a listbox
Post by: Blaze on May 18, 2004, 02:39 PM
Quote from: Eli_1 on May 18, 2004, 09:48 AM
On a side note, your TAB key is dieing for some attention. :(

Actually I removed the tab space entries when adding my code here...


I think my code is working because its been saying hello all day without getting kicked...
Title: Re:Removing things from a listbox
Post by: FuzZ on May 18, 2004, 03:34 PM
Quote from: Blaze on May 18, 2004, 02:39 PM
Quote from: Eli_1 on May 18, 2004, 09:48 AM
On a side note, your TAB key is dieing for some attention. :(

Actually I removed the tab space entries when adding my code here...


I think my code is working because its been saying hello all day without getting kicked...
sure you're not muted? :P
Title: Re:Removing things from a listbox
Post by: Blaze on May 18, 2004, 06:58 PM
Yes because my my other bot picked up all the chating...

Now I have to find a way to make it display the text when it is sent rather then when it is typed and entered...
Title: Re:Removing things from a listbox
Post by: Eli_1 on May 18, 2004, 07:13 PM
Quote from: Blaze on May 18, 2004, 06:58 PM
Yes because my my other bot picked up all the chating...

Now I have to find a way to make it display the text when it is sent rather then when it is typed and entered...

You might be able to use Socket_SendComplete(), then again you might not...
Title: Re:Removing things from a listbox
Post by: MyndFyre on May 18, 2004, 07:43 PM
off-topic....

Mahaha, the first thing I thought of when I saw the title was....


ListBox1.Remove(things)


8)
Title: Re:Removing things from a listbox
Post by: Lenny on May 19, 2004, 02:00 PM
You should really use arrays to store your queue, especially if you're not displaying the listbox....

Also, the queue also depends on the size of the message, not just how many messages in an interval...

Quote
Now I have to find a way to make it display the text when it is sent rather then when it is typed and entered...

That's just a matter of how you send text, the Send function should both add the text to the display and actually send the data to battle.net...This function would be called every time the queue function has passed....