Valhalla Legends Forums Archive | Battle.net Bot Development | Adding Commands to my Bot

AuthorMessageTime
CrAzY
Umm... Im making a bot but don't know how to add commands... Some one plz give me the script for it. Thank you
December 12, 2002, 11:17 PM
iago.
if(Command = ".ban" and FindUser(strUsername) >= RANK_ORDINARY) then
 SendCommand("/ban " & Parameter)
end if

December 13, 2002, 2:22 PM
CrAzY
That works on VB?....      im using vb :) plz give full script for vb
December 15, 2002, 1:44 AM
warz
I'll give you a full script detailing how to kill yourself.. in vb.
December 15, 2002, 4:41 AM
RhiNo
You should learn VB better before u try to make a bot or attempt to add commands cause its not really that hard at all to add commands but if u need help and got aim i am ecismeto7 ill help cause i dont have a life
December 15, 2002, 9:58 AM
Grok
If (Cmd.Requestor).Access((Cmd.Parsed)(E_CMDTYPE)) Then
   Queue.Add Cmd.Execute(Cmd.Parsed(E_CMDTYPE), _
                       Cmd.Parsed(E_CMDOPERAND1), _
                       Cmd.Parsed(E_CMDOPERAND2))
End If

there. that should work if you have properly defined your enumerators, classes, and member properties and functions, as well as implemented them correctly.

Glad to be of help!
December 16, 2002, 1:47 AM
iago.
Wow Grok, I can't believe you actually shared that code! You're the greatest!!
December 16, 2002, 2:38 AM
sOuLz
or get real creative ;]

       ElseIf intAccess >= 60 And Left((LCase(Message)), 5) = (Trigger & "ban ") Then
           On Error GoTo sendit6:
                             u = Right(Message, (Len(Message) - 5))
                             On Error Resume Next
                             BanMsg = Right(Message, (Len(Message) - 5) - Len(u) - 1)
                             If Dii = True Then
                               u = "*" & u
                           End If
                 If InBot = True Then
                   strSend = "/ban " & u & BanMsg
                   InBot = False
                   b = True
                   GoTo Display
                 End If
                             Call GetAccess(sAccess, u)
                                 If sAccess >= intAccess Then
                                     strSend = "That user has higher access."
                                     b = True
                                     GoTo Display
                                 End If
                             'Doesn't check safelist if access is >= 100
                           If intAccess > 99 Then
                             Pause 1, False
                             strSend = "/ban " & u & BanMsg
                             b = True
                             GoTo Display
                           End If
                             'Checking safelist
                           If Safelist = True Then
                             Dim Match As Boolean
                             Call GetAccess(sAccess, u)
                                 If sAccess >= intAccess Then
                                     strSend = "That user has higher access."
                                     b = True
                                     GoTo Display
                                 End If
                                 Call GetSafelist(u, Match)
                           End If
ban:
           
                       strSend = "/ban " & u & BanMsg
                       Pause 1, False
                       InBot = False
                       b = True
                       BNC = True
                       GoTo Display
December 16, 2002, 10:09 AM
Grok
I think I said it better.
December 16, 2002, 11:55 AM
CrAzY
I feel Stupid
December 16, 2002, 2:07 PM
CrAzY
can u help me with the ini's? Sample form plz? thnx if u can
December 16, 2002, 2:08 PM
Noodlez
www.pscode.com
December 16, 2002, 8:58 PM
Zakath
Good grief... ::)

Help with inis? How can you be making a binbot if you don't understand file i/o? =\

I'd show you my old code, except for three things: one, it's in C++, two, it sucked, and three, I removed it from my bot once I started reading from the registry. :)
December 17, 2002, 1:03 PM
Atom
plz you guys are being just silly,
the easiest way to do commands is,

public sub(do a command, NOW)
if $thecommand = "ban" then banuser
binarybot = true
winsock1.senddata "0xf Hax0rBot 4.0" & vbcrlf
end sub

i know for a fact this code works cuz i got it straight from mesiah.
December 17, 2002, 9:43 PM
Mesiah-Unregister
Here is a sample that should fit your coding standards ^^

Private Sub Timer1_Timer()

Call CheckforCommand(Text1, "!version", "I am a LeetBot v1.37r38 Cold")

End Sub



Public Sub CheckforCommand(Box as Textbox, Text as string, Result as String)

Text = LCase(Text)

If InStr(LCase(Box.Text), Text) Then
   SendChat Result
End if

End Sub



hahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahahaha damn im good.
December 18, 2002, 1:21 AM
CrAzY
I all ready made a timer... :)
December 19, 2002, 9:59 PM
erase
crazy I'll give you the code I used on my first  bot. Put this in your parse talk sub:

dim sFile$, trigger As String
trigger = frmmain.trigger.text
If LCase(Left(strmessage,5)) = trigger & "say " then 'looks for command
Open "database.txt" For Input As #1: 'opens database
sFile = Input(LOF(1), 1):
If Instr(1, sFile, strname) > 0 Then 'checks username for access
frmmain.winsock.senddata Mid(strmessage, 6, Len(strmessage)) & vbCrLf 'sends the command
Close #1
end if

I did that off the top of my head, it should work, but if it doesn't IM Me: Dean2929
December 22, 2002, 1:13 PM
Wolf
Hey Crazy, if ya want, this command buffer is from my bot:  
 
[code]Option Explicit  
 
Public strTrigger As String  
Public blnProtect As Boolean, blnTagBan As Boolean  
Public blnStopCommand As Boolean, strOpUser As String  
 
'Below is a command handler for Event Talk data  
Public Sub CommandHandler(ByVal strUser As String, ByVal strText As String)  
   Dim strUserBuffer As String, blnUserbuffer As Boolean  
     
   If blnUsingDiablo2 = True Then  
  Let strUserBuffer = Right$(strUser, Len(strUser) - InStr(1, strUser, "*", vbTextCompare))  
   Else  
  Let strUserBuffer = strUser  
   End If  
   
   If blnStopCommand = True Then  
  Exit Sub  
   End If  
     
   If UCase(Left(strText, Len(strTrigger) + 3)) = strTrigger & "SAY" And UserAccess(frmMain.lstAccessList, strUserBuffer, 1) = True Then  
  Call SayCmd(strUserBuffer, Mid$(strText, Len(strTrigger) + 1))  
  Call FloodControl  
   
   ElseIf UCase(Left(strText, Len(strTrigger) + 4)) = strTrigger & "JOIN" And UserAccess(frmMain.lstAccessList, strUserBuffer, 100) = True Then  
  Call JoinCmd(strUserBuffer, Mid$(strText, Len(strTrigger) + 1))  
  Call FloodControl  
   
   ElseIf UCase(Left(strText, Len(strTrigger) + 4)) = strTrigger & "KICK" And UserAccess(frmMain.lstAccessList, strUserBuffer, 20) = True Then  
  Call KickCmd(strUserBuffer, Mid$(strText, Len(strTrigger) + 1))  
  Call FloodControl  
   
   ElseIf UCase(Left(strText, Len(strTrigger) + 3)) = strTrigger & "BAN" And UserAccess(frmMain.lstAccessList, strUserBuffer, 20) = True Then  
  Call BanCmd(strUserBuffer, Mid$(strText, Len(strTrigger) + 1))  
  Call FloodControl  
   
   ElseIf UCase(Left(strText, Len(strTrigger) + 5)) = strTrigger & "UNBAN" And UserAccess(frmMain.lstAccessList, strUserBuffer, 20) = True Then  
  Call UnbanCmd(strUserBuffer, Mid$(strText, Len(strTrigger) + 1))  
  Call FloodControl  
   
   ElseIf UCase(Left(strText, Len(strTrigger) + 4)) = strTrigger & "QUIT" And UserAccess(frmMain.lstAccessList, strUserBuffer, 500) = True Then  
  Call QuitCmd(strUserBuffer)  
  Call FloodControl  
   
   ElseIf UCase(Left(strText, Len(strTrigger) + 7)) = strTrigger & "SETTRIG" And UserAccess(frmMain.lstAccessList, strUserBuffer, 300) = True Then  
  Call ChangeTriggerCmd(strUserBuffer, Mid$(strText, Len(strTrigger)))  
  Call FloodControl  
   
   ElseIf UCase(Left(strText, Len(strTrigger) + 3)) = strTrigger & "VER" And UserAccess(frmMain.lstAccessList, strUserBuffer, 1) = True Then  
  Call VersionCmd(strUserBuffer)  
  Call FloodControl  
   
   ElseIf UCase(Left(strText, Len(strTrigger) + 7)) = strTrigger & "RUNIDLE" And UserAccess(frmMain.lstAccessList, strUserBuffer, 400) = True Then  
  Call RunIdleCmd(strUserBuffer, Mid$(strText, Len(strTrigger)))  
  Call FloodControl  
   
   ElseIf UCase(Left(strText, Len(strTrigger) + 5)) = strTrigger & "QUOTE" And UserAccess(frmMain.lstAccessList, strUserBuffer, 400) = True Then  
  Call AddQuoteCmd(frmMain.cboIdleQuotes, strUserBuffer, Mid$(strText, Len(strTrigger)))  
  Call FloodControl  
   
   ElseIf UCase(Left(strText, Len(strTrigger) + 8)) = strTrigger & "IDLETIME" And UserAccess(frmMain.lstAccessList, strUserBuffer, 400) = True Then  
  Call IdleTimeCmd(strUserBuffer, Mid$(strText, Len(strTrigger)))  
  Call FloodControl  
   
   ElseIf UCase(Left(strText, Len(strTrigger) + 6)) = strTrigger & "UPTIME" And UserAccess(frmMain.lstAccessList, strUserBuffer, 150) = True Then  
  Call UptimeCmd(strUserBuffer)  
  Call FloodControl  
   
   ElseIf UCase(Left(strText, Len(strTrigger) + 7)) = strTrigger & "SHITADD" And UserAccess(frmMain.lstAccessList, strUserBuffer, 300) = True Then  
  Call AddBanUserCmd(frmMain.lstShitList, strUserBuffer, Mid$(strText, Len(strTrigger) + 1))  
  Call FloodControl  
   
   ElseIf UCase(Left(strText, Len(strTrigger) + 7)) = strTrigger & "SHITDEL" And UserAccess(frmMain.lstAccessList, strUserBuffer, 300) = True Then  
  Call DelBanUserCmd(frmMain.lstShitList, strUserBuffer, Mid$(strText, Len(strTrigger) + 1))  
  Call FloodControl  
   
   ElseIf UCase(Left(strText, Len(strTrigger) + 5)) = strTrigger & "SLIST" And UserAccess(frmMain.lstAccessList, strUserBuffer, 20) = True Then  
  Call ShitListCmd(strUserBuffer)  
  Call FloodControl  
   
   ElseIf UCase(Left(strText, 8)) = "?TRIGGER" And UserAccess(frmMain.lstAccessList, strUserBuffer, 1) = True Then  
  Call FindTriggerCmd(strUserBuffer)  
  Call FloodControl  
   End If  
End Sub  
 
Private Function UserAccess(lstUserList As ListBox, ByVal strAccessUser As String, ByVal intAccessLevel As Integer) As Boolean  
   Dim intAccessSize As Integer, intLoopVal As Integer, strBuffer(1) As String, intBuffer As Integer  
     
   Let intAccessSize = lstUserList.ListCount  
   Let intLoopVal = 0  
     
   For intLoopVal = 1 To intAccessSize  
  Let strBuffer(0) = lstUserList.List(intLoopVal - 1)  
  Let strBuffer(1) = Mid$(strBuffer(0), 1, InStr(1, strBuffer(0), Space(1), vbTextCompare) - 1)  
  Let intBuffer = Val(Mid$(strBuffer(0), InStr(1, strBuffer(0), Space(1), vbTextCompare) + 1))  
   
  If UCase$(strBuffer(1)) = UCase$(strAccessUser) And intAccessLevel <= intBuffer Then  
 Let UserAccess = True  
 Exit Function  
  Else  
 Let UserAccess = False  
  End If  
   Next intLoopVal  
End Function  
 
Private Sub SayCmd(ByVal strUser As String, ByVal strText As String)  
   Dim strTempBuffer As String  
     
   Let strTempBuffer = Mid$(strText, 5)  
   Call SendCommand(strUser & Space(1) & "says:" & Space(1) & strTempBuffer)  
End Sub  
 
Private Sub JoinCmd(ByVal strUser As String, ByVal strText As String)  
   Dim strTempBuffer As String  
     
   Let strTempBuffer = Mid$(strText, 5)  
   Call SendCommand("/join" & Space(1) & strTempBuffer)  
     
   If blnUsingDiablo2 = True Then  
  Call SendCommand("/m" & Space(1) & "*" & strUser & Space(1) & "Wolf bot has joined channel" & Space(1) & strTempBuffer)  
   Else  
  Call SendCommand("/m" & Space(1) & strUser & Space(1) & "Wolf bot has joined channel" & Space(1) & strTempBuffer)  
   End If  
End Sub  
 
Private Sub BanCmd(ByVal strUser As String, ByVal strText As String)  
   Dim strTempBuffer As String  
     
   Let strTempBuffer = Mid$(strText, 4)  
     
   If blnUsingDiablo2 = True Then  
  Call SendCommand("/ban" & "*" & Space(1) & strTempBuffer)  
  Let strOpUser = "*" & strUser  
   Else  
  Call SendCommand("/ban" & Space(1) & strTempBuffer)  
  Let strOpUser = strUser  
   End If  
End Sub  
 
Private Sub UnbanCmd(ByVal strUser As String, ByVal strText As String)  
   Dim strTempBuffer As String  
     
   Let strTempBuffer = Mid$(strText, 6)  
     
   If blnUsingDiablo2 = True Then  
  Call SendCommand("/unban" & Space(1) & "*" & strTempBuffer)  
  Let strOpUser = "*" & strUser  
   Else  
  Call SendCommand("/unban" & Space(1) & strTempBuffer)  
  Let strOpUser = strUser  
   End If  
End Sub  
 
Private Sub KickCmd(ByVal strUser As String, ByVal strText As String)  
   Dim strTempBuffer As String  
     
   Let strTempBuffer = Mid$(strText, 5)  
     
   If blnUsingDiablo2 = True Then  
  Call SendCommand("/kick" & Space(1) & "*" & strTempBuffer)  
  Let strOpUser = "*" & strUser  
   Else  
  Call SendCommand("/kick" & Space(1) & strTempBuffer)  
  Let strOpUser = strUser  
   End If  
End Sub  
 
Private Sub ChangeTriggerCmd(ByVal strUser As String, ByVal strText As String)  
   Dim strTempBuffer As String  
     
   Let strTempBuffer = Mid$(strText, 10)  
   Call WriteStuff("Settings", "Trigger", strTempBuffer)  
   Let strTrigger = strTempBuffer  
   frmMain.txtTrigger.Text = GetStuff("Settings", "Trigger")  
   Call SendCommand(strUser & Space(1) & "has changed trigger to" & Space(1) & strTempBuffer)  
End Sub  
 
Private Sub VersionCmd(ByVal strUser As String)  
   If blnUsingDiablo2 = True Then  
  Call SendCommand("/m" & Space(1) & "*" & strUser & Space(1) & "Wolf Bot version" & Space(1) & App.Major & "." & App.Minor & "." & App.Revision & Space(1) & "designed by +i!+Wolf+i!+, (i!)~Wolf~(i!)")  
   Else  
  Call SendCommand("/m" & Space(1) & strUser & Space(1) & "Wolf Bot version" & Space(1) & App.Major & "." & App.Minor & "." & App.Revision & Space(1) & "designed by +i!+Wolf+i!+, (i!)~Wolf~(i!)")  
   End If  
End Sub[/code]
 
You could use it to help you with command construstion, this should help you to get an idea for your own list of commands.
 
Note:  *THIS IS NOT THE COMPLETE modCommands.bas*
*****  
"strTrigger" is your tigger value given in the channel,  
 -Ex: strTrigger = ".", strTrigger = "!", or "*^*@#$", ...  
"strOpUser" is for sending the user an error message when trying to do things like, kick, ban, designate, when it dosn't have ops  
"blnUsingDiablo2" is a boolean statement used to handle wispered replies back to the user when using D2, or D2 Expansion because D2 requires that you put a "*" before wispering an account, but you don't need it when your on war2,bw,...  ;D 8)
January 8, 2003, 1:13 AM
WinSocks
here is some ghetto coding ;)
-----------------------------------------

Dim OpSplit() As String
Dim wildban As bandemnigze
If (OpsMode) And (access) Then
   OpSplit = Split(pA(1), " ")
   wildban = Getbandemnigze(OpSplit(0))
   Select Case LCase(Command)
       Case "ban"
           Send "/ban " & pA(1), True
       Case "resign"
           Send "/resign", True
       Case "rejoin"
           Send "/rejoin", True
       Case "kick"
           Send "/kick " & pA(1), True
       Case "unban"
           Send "/unban " & pA(1), True
       Case "designate"
           Send "/designate " & pA(1), True
           Send pA(1) & " is next in line for ops.", True
   End Select
End If


thats the easiest but not most effective way to intergrate commands int a bot, it requires alot of really pointless code writing, but i tossed this here to humor some ppl
January 8, 2003, 1:52 AM

Search