Author | Message | Time |
---|---|---|
The-Rabid-Lord | 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. [code] 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 [/code] Any help would be appreciated. Thanks | December 20, 2003, 7:46 PM |
Havoc | 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. | December 20, 2003, 7:57 PM |
The-Rabid-Lord | I wanto do that but im not that clever at it. :( | December 20, 2003, 8:12 PM |
Null | Try This [code] 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 [/code] | December 21, 2003, 12:23 AM |
13-yr-Old-Newb | [quote author=Null link=board=17;threadid=4366;start=0#msg36541 date=1071966231] Try This [code] 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 [/code] [/quote] | December 21, 2003, 4:38 PM |
Havoc | [quote author=Null link=board=17;threadid=4366;start=0#msg36541 date=1071966231] Try This [code] 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 [/code] [/quote] 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. | December 21, 2003, 4:59 PM |
The-Rabid-Lord | 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? | December 21, 2003, 5:49 PM |
TheMinistered | 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 | December 21, 2003, 6:13 PM |
Null | [quote author=Havoc link=board=17;threadid=4366;start=0#msg36608 date=1072025997] [quote author=Null link=board=17;threadid=4366;start=0#msg36541 date=1071966231] Try This [code] 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 [/code] [/quote] 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. [/quote] 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. | December 21, 2003, 9:46 PM |
Havoc | Im sorry. I didnt mean WRONG. But i dont think thats what he wanted. I thought he wanted multi user. | December 21, 2003, 11:35 PM |
Grok | [quote author=NuLL link=board=17;threadid=4366;start=0#msg36641 date=1072043199] [quote author=Havoc link=board=17;threadid=4366;start=0#msg36608 date=1072025997] [quote author=Null link=board=17;threadid=4366;start=0#msg36541 date=1071966231] Try This [code] 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 [/code] [/quote] 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. [/quote] 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. [/quote] 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. | December 22, 2003, 12:00 AM |
Null | There is no rest :p , i just wrote it out once i red his post | December 22, 2003, 12:58 AM |
Havoc | Ok this is how you would add access that would write to a txt file and read from it. [code] 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 [/code] 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. | December 22, 2003, 2:44 PM |
Grok | -1 for those Runtime errors. Fix with explanation and I'll +1 again. | December 22, 2003, 3:41 PM |
The-Rabid-Lord | Thanks for all the help. Ill try them out now :) | December 22, 2003, 3:49 PM |
The-Rabid-Lord | 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 | December 22, 2003, 5:05 PM |