Im trying to add commands to my bot so that the master can control it. I have this code which a freind put together for me but i cant get it working.
Private Sub CleanSlateBot1_UserTalk(ByVal Username As String, ByVal Flags As Long, ByVal message As String, ByVal Ping As Long, SimulatedEvent As Boolean)
strmaster = Form2.TXTMSTR.Text
trigger = Form2.txttrigger.Text
If Dii = True Then
Username = Right(Username, Len(Username) - 1)
End If
Dim intstr As Integer
If InStr(1, Username, "*", vbTextCompare) <> 0 Then
intstr = InStr(1, Username, "*", vbTextCompare)
Username = Right(Username, Len(Username) - intstr)
If Username = strmaster And Left((LCase(message)), 5) = (trigger & "ban ") Then
u = Right(message, (Len(message) - 5))
g = Right(message, (Len(message) - 5) - Len(u) - 1)
CleanSlateBot1.Send "/ban " & u & g
End If
End If
AddChat "<" & Username & ">", vbYellow, Space(1) & message & vbNewLine, vbWhite
Any help would be appreciated. Thanks
Wouldnt it be easier to set-up a flag system or access? Then you can have it go by the access. Seems to me, the way your doing it, you can only have 1 person with access or the only rank you can give out is master. If you go the access way, you can have it read/write from a txt file.
I wanto do that but im not that clever at it. :(
Try This
Private Sub CleanSlateBot1_UserTalk(ByVal Username As String, ByVal Flags As Long, ByVal message As String, ByVal Ping As Long, SimulatedEvent As Boolean)
IF Username = "The-Rabbit-Lord" Then
IF Left((LCase(Message)), 5) = (Trigger & "ban ") Then
BannedName = Right(LCase(Message), Len(LCase(Message)) - 5)
Cleanslatebot1.send "/ban " & BannedName
End If
End If
Quote from: Null on December 20, 2003, 06:23 PM
Try This
Private Sub CleanSlateBot1_UserTalk(ByVal Username As String, ByVal Flags As Long, ByVal message As String, ByVal Ping As Long, SimulatedEvent As Boolean)
IF Username = "The-Rabbit-Lord" Then
IF Left((LCase(Message)), 5) = (Trigger & "ban ") Then
BannedName = Right(LCase(Message), Len(LCase(Message)) - 5)
Cleanslatebot1.send "/ban " & BannedName
End If
End If
Quote from: Null on December 20, 2003, 06:23 PM
Try This
Private Sub CleanSlateBot1_UserTalk(ByVal Username As String, ByVal Flags As Long, ByVal message As String, ByVal Ping As Long, SimulatedEvent As Boolean)
IF Username = "The-Rabbit-Lord" Then
IF Left((LCase(Message)), 5) = (Trigger & "ban ") Then
BannedName = Right(LCase(Message), Len(LCase(Message)) - 5)
Cleanslatebot1.send "/ban " & BannedName
End If
End If
That code is wrong. The only person who would have have access would be you. I dont remeber the code for the database but if it comes back, i will reply.
I know it would only be for me but i just want a basic homemade bot to run my clan. I would add access once i had properly found out how to do basic commands. I can find an article on this in the forums. Does anyone know where one is?
If I were you I would take an object oriented approach at this... I would start by developing an object called... user? This user object will manage details such as their access flags. Then you can go even further and create an object to manage a collection of users called... userlist?
Then of course you have to create some procedure to load each user with their specific details and load them into the list... you get the point
Quote from: Havoc on December 21, 2003, 10:59 AM
Quote from: Null on December 20, 2003, 06:23 PM
Try This
Private Sub CleanSlateBot1_UserTalk(ByVal Username As String, ByVal Flags As Long, ByVal message As String, ByVal Ping As Long, SimulatedEvent As Boolean)
IF Username = "The-Rabbit-Lord" Then
IF Left((LCase(Message)), 5) = (Trigger & "ban ") Then
BannedName = Right(LCase(Message), Len(LCase(Message)) - 5)
Cleanslatebot1.send "/ban " & BannedName
End If
End If
That code is wrong. The only person who would have have access would be you. I dont remeber the code for the database but if it comes back, i will reply.
The code is not wrong , it works just fine and was intended NOT to be a multi user management system , just a small piece to get him on his way.
Im sorry. I didnt mean WRONG. But i dont think thats what he wanted. I thought he wanted multi user.
Quote from: NuLL on December 21, 2003, 03:46 PM
Quote from: Havoc on December 21, 2003, 10:59 AM
Quote from: Null on December 20, 2003, 06:23 PM
Try This
Private Sub CleanSlateBot1_UserTalk(ByVal Username As String, ByVal Flags As Long, ByVal message As String, ByVal Ping As Long, SimulatedEvent As Boolean)
IF Username = "The-Rabbit-Lord" Then
IF Left((LCase(Message)), 5) = (Trigger & "ban ") Then
BannedName = Right(LCase(Message), Len(LCase(Message)) - 5)
Cleanslatebot1.send "/ban " & BannedName
End If
End If
That code is wrong. The only person who would have have access would be you. I dont remeber the code for the database but if it comes back, i will reply.
The code is not wrong , it works just fine and was intended NOT to be a multi user management system , just a small piece to get him on his way.
Oh yes, it's wrong. I don't even know how to begin explaining :)
I can tell from this snippet that the rest is spaghetti code.
There is no rest :p , i just wrote it out once i red his post
Ok this is how you would add access that would write to a txt file and read from it.
Private Sub make a command button to add()
Dim x As String
x = txtUsername.Text & Space(1) & txtAccess.Text
List.AddItem (s)
txtUsername.Text = ""
txtAccess.Text = ""
End Sub
Private Sub make a command button to save/done()
Dim i As Integer, add As String, i2 As Integer
Open (App.Path & "\users.txt") For Output As #1
On Error Resume Next
For i = 0 To List.ListCount
add = List.List(i2)
i2 = i2 + 1
Print #1, add
Next i
Close #1
Unload Me
End Sub
'this reads from the users.txt
Private Sub form_load()
Close #1
Dim s As String
s = Dir$(App.Path & "\users.txt")
If s = "" Then
Open (App.Path & "\users.txt") For Output As #1
Close #1
End If
Open (App.Path & "\users.txt") For Input As #1
Dim z As String
On Error Resume Next
Do
Input #1, z
List.AddItem (z)
Loop Until EOF(1)
Close #1
End Sub
You would make it another form. Add a listview and the 3 commands. This is how you would add access. If anyone wants to add/change it go ahead. It worked for me.
-1 for those Runtime errors. Fix with explanation and I'll +1 again.
Thanks for all the help. Ill try them out now :)
I have done what was said to add access and now i want to add commands whcih include access. I know i must have a que list and a timer but i dont know how top program them> any help on the making of commands in a module using an access of 0-100 would be great. 100 being owner.
Thanks