Valhalla Legends Forums Archive | General Programming | How can i add a say command and a Ban command.

AuthorMessageTime
OuTLawZ-GoSu
Sup... I need some help. I need to add a .say command and a .ban command for my bot. I dont get how to do that. Can you plz post the full code here?

Thx

L8terZ
June 28, 2003, 4:20 PM
Noodlez
I would suggest you not posting the same thing in more then one forum.
June 28, 2003, 4:33 PM
Kp
[quote author=Noodlez link=board=5;threadid=1724;start=0#msg13128 date=1056817999]
I would suggest you not posting the same thing in more then one forum.
[/quote]Especially when his cross-post is in an inappropriate forum. :)
June 28, 2003, 5:32 PM
Camel
Assuming you're using VB, here's a start:

Call this function whenever someone says something in chat or whispers your bot (use True for the whisper paramater if it's a whisper).
[code]Public Sub CheckCommand(UserName As String, Chat As String, Optional Whisper As Boolean = False)
If (Chat = "?trigger") Then
Commands.pCommand UserName, "trigger", ""
Exit Sub
End If

Dim S As Long
S = InStr(1, Chat, " ")

If Left(Chat, 1) = <TRIGGER> Then
If S = 0 Then
pCommand UserName, Mid(Chat, 2), ""
Else
pCommand UserName, Mid(Chat, 2, S - 2), Mid(Chat, S + 1)
End If
ElseIf Whisper Then
If S = 0 Then
pCommand UserName, Chat, ""
Else
pCommand UserName, Left(Chat, S - 1), Mid(Chat, S + 1)
End If
End If
End Sub[/code]

[code]Public Sub pCommand(ByVal strUser As String, ByVal strCommand As String, ByVal strValue As String)
If (Len(strCommand) = 0) Then Exit Sub
If (Left(strCommand, 1) = ".") Then Exit Sub 'very annoying crap like '...' will be parsed w/o this

strUser = Right(strUser, Len(strUser) - InStr(1, strUser, "*")) 'charactor@realm*account@server
strCommand = LCase(strCommand)

Dim AuthUser As Long
AuthUser = GetRank(strUser)
Dim AuthRequired As String 'This should ALWAYS be a number, but lets not crash if it isn't!
AuthRequired = "?"
'The following requests access from a databse; dont use it unless you're using a database too. Look in to the GetPrivateProfileString API call to get information out of an INI file.
SQLStr = "SELECT access FROM cmds WHERE command=" & MkSQLStr(strCommand) & ";"
With ExecSQL(SQLStr)
If Not .EOF Then AuthRequired = .Fields(0)
End With

If Not IsNumeric(AuthRequired) Then
'Addtext ColAnError, "Warning: command """ & strCommand & """ is not recognized" & vbCrLf, True
Exit Sub
End If

If AuthUser < AuthRequired Then
If AuthUser > 0 Then SendText "Your rank is only " & AuthUser & "; A rank of " & AuthRequired & " is required to use command """ & strCommand & """", strUser
Addtext ColAnError, "Warning: " & strUser & " cannot use command """ & strCommand & """ (ranked " & AuthUser & "/" & AuthRequired & ")" & vbCrLf, True
Else
Select Case strCommand
Case "ver"
SendText "BNU`Bot v" & version & " by BNU-Camel", strUser
Case "kick"
SendText "/kick " & strValue
Case "ban"
SendText "/ban " & strValue
'Add more commands here
End Select
End If
End Sub[/code]
June 28, 2003, 7:31 PM
OuTLawZ-GoSu
Eh... ye srry bout that. I for got that I posted this in the other forum.
June 29, 2003, 12:00 AM
gosumoo
gosu i have seen many things of your bot if you would like help i would be more than happy to help you, just aim me on GoSuMoO or e-mail me : mbekillaofds@yahoo.com 8)
---
420
Smoking is bad for you.... Better light up
HEY! you only live once :o
July 2, 2003, 4:20 AM

Search