Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: TriCk on May 26, 2003, 01:48 AM

Title: How Would I make a Command Queue?
Post by: TriCk on May 26, 2003, 01:48 AM
How would i make a working command queue?
Like when Channel LockDown is on sometimes my bot will flood out from banning username too many times, with this thought i would also like to know how to smartban like if someone joins 9 times ban once.... but i'd like queue first.
I've asked this question a few times but noone has given me much help with it... i need to know how to add them to a queue to be banned and send them every couple of seconds instead of like 10 at a time when my bot fails to ban a flood or mass joins...
Title: Re:How Would I make a Command Queue?
Post by: ______ on May 26, 2003, 01:52 AM
sigh....im just gonna shut up now.
Title: Re:How Would I make a Command Queue?
Post by: TriCk on May 26, 2003, 01:54 AM
The thing is ive looked over most of the other ones... and they use Winsocks
And im using csb...
so some of the stuff doesnt work...
Title: Re:How Would I make a Command Queue?
Post by: ______ on May 26, 2003, 01:55 AM
Most of the time it doesnt matter.
Title: Re:How Would I make a Command Queue?
Post by: TriCk on May 26, 2003, 01:58 AM
is SendQueue transferrable to CSB ?
Title: Re:How Would I make a Command Queue?
Post by: ______ on May 26, 2003, 01:59 AM
http://forum.valhallalegends.com/phpbbs/index.php?board=17;action=display;threadid=999
go there i gave some code

just change the list view into a list box and change listitsms(i).text to  .list(i)

and Remove(i)  when removing them and it should work.

Edit: it should give you an idea of how to do this.
Title: Re:How Would I make a Command Queue?
Post by: TriCk on May 26, 2003, 02:04 AM
OK 1 question what was easy to fix ???
And something about sending more than 1... Thats not what i want i want it to wait ...
Title: Re:How Would I make a Command Queue?
Post by: ______ on May 26, 2003, 02:12 AM
Make a list box name lquemsg
make a timer named que1 give it an interval of 1800

Private Sub Que1_Timer()

Dim quetick1 As Integer
Dim queinterval1 As Integer


queinterval1 = 1800



If LQueMsg.ListCount >= 1 Then
quetick1 = quetick1 + 1
If quetick1 >= queinterval1 Then
Send LQueMsg.List(0), True 'cleanslatebot1.send LQueMsg.List(0)
LQueMsg.RemoveItem (0)
quetick1 = 0
End If
End If

End Sub

thats how i que them  when a command is issued like !ver
Lquemsg.additem "version"

but so far as i know of this is not a good way of queueing messages becasues it slower but i dont care it works fine for me.
Title: Re:How Would I make a Command Queue?
Post by: TriCk on May 26, 2003, 02:15 AM
So i'll need two timers and to Call it in a command like this ban code ...



If Username = Form2.txtMaster Then
 If Left((LCase(Message)), 5) = (Form2.txtTrigger.Text & "ban ") Then
  Dim bannedname As String
  banned2name = Right(Message, (Len(Message) - 5))
  Text1.Text = Text1.Text + 1
  Dim banCount As String
  banCount = Text1.Text
   If ProtectedUsers.IsOnList(Username) = True Then
   'Don't Ban
   Else
   'Ban
   CleanSlateBot1.Send "/ban " & banned2name & " Jew #" & banCount
   End If
  End If
End If


Where would it go ???
Title: Re:How Would I make a Command Queue?
Post by: ______ on May 26, 2003, 02:18 AM
instead of saying cleanslatebot use  Lquemsg.additem "/ban " & banned2name & " Jew #" & banCount

and i said u only need 1 timer for my lquemsg
Title: Re:How Would I make a Command Queue?
Post by: TriCk on May 26, 2003, 02:20 AM
Would where CleanSlateBot1.Send "/ban " etc....

Be

CleanSlateBot1.Send LQueMsg.AddItem   then something here i dont know what though ....   :-X
Title: Re:How Would I make a Command Queue?
Post by: TriCk on May 26, 2003, 02:21 AM
oh that last post was sent before i read ur last one...
ummm
but then how does the Que1_Timer() send the Item ??
Title: Re:How Would I make a Command Queue?
Post by: ______ on May 26, 2003, 02:23 AM
under this

Private Sub Que1_Timer()

Dim quetick1 As Integer
Dim queinterval1 As Integer


queinterval1 = 1800



If LQueMsg.ListCount >= 1 Then
quetick1 = quetick1 + 1
If quetick1 >= queinterval1 Then
cleanslatebot1.send LQueMsg.List(0)
LQueMsg.RemoveItem (0)
quetick1 = 0
End If
End If

End Sub


and on your !ban code replace cleanslatebot with lquemsg.additem "ban " etc.
Title: Re:How Would I make a Command Queue?
Post by: TriCk on May 26, 2003, 02:25 AM
ok..
Its triggering an error on this...
CleanSlateBot1.Send LQueMsg.List(0), True
Title: Re:How Would I make a Command Queue?
Post by: ______ on May 26, 2003, 02:27 AM
Quote from: TriCk on May 26, 2003, 02:25 AM
ok..
Its triggering an error on this...
CleanSlateBot1.Send LQueMsg.List(0), True
of course get rid of ,true
Title: Re:How Would I make a Command Queue?
Post by: TriCk on May 26, 2003, 02:29 AM
i did that ...
but i was wondering if i use & in commands will it still add it all to the list ??
Title: Re:How Would I make a Command Queue?
Post by: ______ on May 26, 2003, 02:31 AM
if you mean like
lquemsg.additem "you are " & username & "using " & product  

then yes
Title: Re:How Would I make a Command Queue?
Post by: TriCk on May 26, 2003, 02:32 AM
Ummm
Its enqueueing the commands
But
CleanSlateBot is not sending them....
i made the ListBox visible and its adding them to queue but its not actually sending through csb...
Title: Re:How Would I make a Command Queue?
Post by: ______ on May 26, 2003, 02:34 AM
what do u have under Private Sub Que1_Timer()
Title: Re:How Would I make a Command Queue?
Post by: TriCk on May 26, 2003, 02:35 AM

Private Sub Que1_Timer()

Dim quetick1 As Integer
Dim queinterval1 As Integer


queinterval1 = 1800



If LQueMsg.ListCount >= 1 Then
quetick1 = quetick1 + 1
If quetick1 >= queinterval1 Then
CleanSlateBot1.Send LQueMsg.List(0)
LQueMsg.RemoveItem (0)
quetick1 = 0
End If
End If

End Sub
Title: Re:How Would I make a Command Queue?
Post by: TriCk on May 26, 2003, 02:36 AM
And ____ do u have AIM or MSN so i dont have to be waiting ages for a reply ...?
Title: Re:How Would I make a Command Queue?
Post by: ______ on May 26, 2003, 02:39 AM
2 things   1  did u set the que interval in its proerties to 1800?  

2nd put

if cleanslatebot.connected then  'added

If LQueMsg.ListCount >= 1 Then
quetick1 = quetick1 + 1
If quetick1 >= queinterval1 Then
cleanslatebot1.send LQueMsg.List(0)
LQueMsg.RemoveItem (0)
quetick1 = 0
End If
End If


Endif    ' added

End Sub

Edit:   put this right above cleanslatebot.send
Addtext vbBlue, txtName.Text & ": ", vbWhite, LQueMsg.List(0)
so you can see it

txtname.text is my username on logon change it to whatever fits.
Title: Re:How Would I make a Command Queue?
Post by: TriCk on May 26, 2003, 02:56 AM
First thing its not removing them...
And its not banning them...
Title: Re:How Would I make a Command Queue?
Post by: TriCk on May 26, 2003, 02:58 AM
And i just read some of the comments on the other post u gave me earlier it says u used a ListView... I'm using a listbox... should i change to listview ??
Title: Re:How Would I make a Command Queue?
Post by: ______ on May 26, 2003, 03:03 AM
Then the way your checking the user is prob somewhat off, this code works fine. for cleanslate bot and winsocks.

' you 5's seem they should be 4's if u have only 1 letter trigger
If Username = Form2.txtMaster Then
 If Left((LCase(Message)), 5) = (Form2.txtTrigger.Text & "ban ") Then
 Dim bannedname As String
 banned2name = Right(Message, (Len(Message) - 5))
 Text1.Text = Text1.Text + 1
 Dim banCount As String
 banCount = Text1.Text
   If ProtectedUsers.IsOnList(Username) = True Then
   'Don't Ban
   Else
   'Ban
   lquemsg.additem "/ban " & banned2name & " Jew #" & banCount  ' this has been added, this hsould work if it worked for cleanslatebot
   End If
 End If
End If

hmm on ur form2.txtmaster   you dont have form2txtmaster.text
shouldnt bancount be dim'ed as an integer?
Title: Re:How Would I make a Command Queue?
Post by: TriCk on May 26, 2003, 03:07 AM
well they're 5's because i made it "$ban " the space is there because i havent added if User types.. "$ban" then nothin happens coz "$ban" on its own causes the bot to crash ... ??? and it still doesnt work  >:(
Title: Re:How Would I make a Command Queue?
Post by: ______ on May 26, 2003, 03:11 AM
nvm about the 4's your right about the 5 i missed the space...
the only thing i could see wrong with this is that

If Username = Form2.txtMaster Then

make it

If lcase(Username) = lcase(Form2.txtMaster) Then
Title: Re:How Would I make a Command Queue?
Post by: TriCk on May 26, 2003, 03:13 AM
nvm i found the problem....
CleanSlateBot1.Send LQueMsg.List(1)
LQueMsg.RemoveItem (0)


u gave me

CleanSlateBot1.Send LQueMsg.List(0)
LQueMsg.RemoveItem (0)

I only just realised that then because i know for a fact that List(0) would select the Zero on the List... which there is none 1 selected Item 1 and RemoveItem(0) removes Item(1)
Thanks ____ for all the help
PS: We got a Very Hot Topic hehe  ;D

Later...
-TriCk
Title: Re:How Would I make a Command Queue?
Post by: ______ on May 26, 2003, 03:15 AM
np  ;D
Title: Re:How Would I make a Command Queue?
Post by: TriCk on May 26, 2003, 03:17 AM
______ ****
i been callin u ____ soz  :P
Title: Re:How Would I make a Command Queue?
Post by: Camel on May 26, 2003, 12:00 PM
use the [ code ] tag plz.