Author | Message | Time |
---|---|---|
blinkdude | I saw this some where on this fourm and modded it a little bit tell me if it looks right i get a loop error when trying to complie the exe so i know soemthing is wrong :) plz help me [code] Private Sub CleanSlateBot1_UserJoins(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long, ByVal Product As String, SimulatedEvent As Boolean) Do Close #1 Open (App.Path & "shitlist.txt") For Input As #1 Do Input #1, Username If LCase(Username) Then CleanSlateBot1.Send "/ban " & Username & " Auto-Ban" rtbAdd " [" & time & "]" & " < " & Username & " > " & "Was Banned By: " & CleanSlateBot1.Username & " Auto-Ban" & vbNewLine, vbYellow Close #1 Else rtbAdd " [" & time & "]" & " < " & Username & " > " & "Has Joined The Channel Using " & Flags & vbNewLine, vbYellow Close #1 End If Dim MyItem As ListItem Set MyItem = ListView1.ListItems.Add() Select Case Product Case "3RAW": MyItem.SmallIcon = 12 Case "VD2D": MyItem.SmallIcon = 11 Case "RATS": MyItem.SmallIcon = 7 Case "PX2D": MyItem.SmallIcon = 11 Case "PXES": MyItem.SmallIcon = 10 Case "W2BN": MyItem.SmallIcon = 8 End Select MyItem.Text = Username MyItem.SubItems(1) = Ping & " ms" Text2.Text = "" Text2.Text = Text2.Text & txtChanel.Text Text2.Text = Text2.Text & " (" & ListView1.ListItems.Count & ")" End Sub [/code[/code] | July 12, 2003, 8:54 AM |
Eternal | Do? Do what? You need to add a Loop if you are using Do. Not sure why you have a Do in the opening line...you only need to open the text file once. You should also have a "\" in front of the textfile name really. Try this: [code]Private Sub CleanSlateBot1_UserJoins(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long, ByVal Product As String, SimulatedEvent As Boolean) Close #1 Open (App.Path & "\shitlist.txt") For Input As #1 Do Input #1, Username If LCase(Username) Then CleanSlateBot1.Send "/ban " & Username & " Auto-Ban" rtbAdd " [" & time & "]" & " < " & Username & " > " & "Was Banned By: " & CleanSlateBot1.Username & " Auto-Ban" & vbNewLine, vbYellow Close #1 Else rtbAdd " [" & time & "]" & " < " & Username & " > " & "Has Joined The Channel Using " & Flags & vbNewLine, vbYellow Close #1 End If Loop Dim MyItem As ListItem Set MyItem = ListView1.ListItems.Add() Select Case Product Case "3RAW": MyItem.SmallIcon = 12 Case "VD2D": MyItem.SmallIcon = 11 Case "RATS": MyItem.SmallIcon = 7 Case "PX2D": MyItem.SmallIcon = 11 Case "PXES": MyItem.SmallIcon = 10 Case "W2BN": MyItem.SmallIcon = 8 End Select MyItem.Text = Username MyItem.SubItems(1) = Ping & " ms" Text2.Text = "" Text2.Text = Text2.Text & txtChanel.Text Text2.Text = Text2.Text & " (" & ListView1.ListItems.Count & ")" End Sub[/code] [EDIT] Forgot to add code tags :-/ | July 12, 2003, 9:11 AM |
blinkdude | with this code i get an runtime error "15" and sometimes "62" [code] Private Sub CleanSlateBot1_UserJoins(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long, ByVal Product As String, SimulatedEvent As Boolean) Close #1 Open (App.Path & "\shitlist.txt") For Input As #1 Do Input #1, Username If LCase(Username) Then CleanSlateBot1.Send "/ban " & Username & " Auto-Ban" rtbAdd " [" & time & "]" & " < " & Username & " > " & "Was Banned By: " & CleanSlateBot1.Username & " Auto-Ban" & vbNewLine, vbYellow Close #1 Else Do rtbAdd " [" & time & "]" & " < " & Username & " > " & "Has Joined The Channel Using " & Flags & vbNewLine, vbYellow Loop Close #1 End If Loop Dim MyItem As ListItem Set MyItem = ListView1.ListItems.Add() Select Case Product Case "3RAW": MyItem.SmallIcon = 12 Case "VD2D": MyItem.SmallIcon = 11 Case "RATS": MyItem.SmallIcon = 7 Case "PX2D": MyItem.SmallIcon = 11 Case "PXES": MyItem.SmallIcon = 10 Case "W2BN": MyItem.SmallIcon = 8 End Select MyItem.Text = Username MyItem.SubItems(1) = Ping & " ms" Text2.Text = "" Text2.Text = Text2.Text & txtChanel.Text Text2.Text = Text2.Text & " (" & ListView1.ListItems.Count & ")" End Sub [/code] | July 12, 2003, 9:27 AM |
Eternal | You have an extra 'Do' in there. I'm not sure what the runtime errors are (a quick search on MSDN would tell you). However, the extra Do is definately wrong... Try pasting the code I amended. <shrugs> | July 12, 2003, 9:36 AM |
drivehappy | [code] Private Sub CleanSlateBot1_UserJoins(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long, ByVal Product As String, SimulatedEvent As Boolean) Close #1 Open (App.Path & "\shitlist.txt") For Input As #1 Do Until EOF(1) Input #1, Username If LCase(Username) Then CleanSlateBot1.Send "/ban " & Username & " Auto-Ban" rtbAdd " [" & time & "]" & " < " & Username & " > " & "Was Banned By: " & CleanSlateBot1.Username & " Auto-Ban" & vbNewLine, vbYellow Else rtbAdd " [" & time & "]" & " < " & Username & " > " & "Has Joined The Channel Using " & Flags & vbNewLine, vbYellow End If Loop Close #1 Dim MyItem As ListItem Set MyItem = ListView1.ListItems.Add() Select Case Product Case "3RAW": MyItem.SmallIcon = 12 Case "VD2D": MyItem.SmallIcon = 11 Case "RATS": MyItem.SmallIcon = 7 Case "PX2D": MyItem.SmallIcon = 11 Case "PXES": MyItem.SmallIcon = 10 Case "W2BN": MyItem.SmallIcon = 8 End Select MyItem.Text = Username MyItem.SubItems(1) = Ping & " ms" Text2.Text = "" Text2.Text = Text2.Text & txtChanel.Text Text2.Text = Text2.Text & " (" & ListView1.ListItems.Count & ")" End Sub [/code] I'm not sure what you're trying to do here. What ever the case within your IF statement you have it close the file... | July 12, 2003, 5:23 PM |
Spht | [quote author=blinkdude link=board=17;threadid=1881;start=0#msg14576 date=1058002065] with this code i get an runtime error "15" and sometimes "62" [code] Private Sub CleanSlateBot1_UserJoins(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long, ByVal Product As String, SimulatedEvent As Boolean) Close #1 Open (App.Path & "\shitlist.txt") For Input As #1 Do Input #1, Username If LCase(Username) Then CleanSlateBot1.Send "/ban " & Username & " Auto-Ban" rtbAdd " [" & time & "]" & " < " & Username & " > " & "Was Banned By: " & CleanSlateBot1.Username & " Auto-Ban" & vbNewLine, vbYellow Close #1 Else Do rtbAdd " [" & time & "]" & " < " & Username & " > " & "Has Joined The Channel Using " & Flags & vbNewLine, vbYellow Loop Close #1 End If Loop Dim MyItem As ListItem Set MyItem = ListView1.ListItems.Add() Select Case Product Case "3RAW": MyItem.SmallIcon = 12 Case "VD2D": MyItem.SmallIcon = 11 Case "RATS": MyItem.SmallIcon = 7 Case "PX2D": MyItem.SmallIcon = 11 Case "PXES": MyItem.SmallIcon = 10 Case "W2BN": MyItem.SmallIcon = 8 End Select MyItem.Text = Username MyItem.SubItems(1) = Ping & " ms" Text2.Text = "" Text2.Text = Text2.Text & txtChanel.Text Text2.Text = Text2.Text & " (" & ListView1.ListItems.Count & ")" End Sub [/code] [/quote] Why is the Warcraft II product written normally while all the others are backwards? | July 12, 2003, 5:39 PM |
blinkdude | i dujno i have to fix that maybe thats y only wc2 incons show up :) thx spth! | July 12, 2003, 10:01 PM |
blinkdude | ah i still get a run error type mismatch i am trying to read from an auto ban file ... shitlist.txt when they join the channel it reads form the text file and bans / or dosn't heres the code [code] Private Sub CleanSlateBot1_UserJoins(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long, ByVal Product As String, SimulatedEvent As Boolean) Close #1 Open (App.Path & "\shitlist.txt") For Input As #1 Do Until EOF(1) Input #1, Username If LCase(Username) Then CleanSlateBot1.Send "/ban " & Username & " Auto-Ban" rtbAdd " [" & time & "]" & " < " & Username & " > " & "Was Banned By: " & CleanSlateBot1.Username & " Auto-Ban" & vbNewLine, vbYellow Else rtbAdd " [" & time & "]" & " < " & Username & " > " & "Has Joined The Channel Using " & Flags & vbNewLine, vbYellow End If Loop Close #1 Dim MyItem As ListItem Set MyItem = ListView1.ListItems.Add() Select Case Product Case "WAR3": MyItem.SmallIcon = 12 Case "D2DV": MyItem.SmallIcon = 11 Case "STAR": MyItem.SmallIcon = 7 Case "D2XP": MyItem.SmallIcon = 11 Case "SEXP": MyItem.SmallIcon = 10 Case "W2BN": MyItem.SmallIcon = 8 End Select MyItem.Text = Username MyItem.SubItems(1) = Ping & " ms" Text2.Text = "" Text2.Text = Text2.Text & txtChanel.Text Text2.Text = Text2.Text & " (" & ListView1.ListItems.Count & ")" End Sub [/code] | July 12, 2003, 10:15 PM |
DarkMinion | *gets a headache* | July 13, 2003, 1:35 AM |
______ | [quote author=blinkdude link=board=17;threadid=1881;start=0#msg14603 date=1058048104] ah i still get a run error type mismatch i am trying to read from an auto ban file ... shitlist.txt when they join the channel it reads form the text file and bans / or dosn't heres the code [code] Private Sub CleanSlateBot1_UserJoins(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long, ByVal Product As String, SimulatedEvent As Boolean) Close #1 Open (App.Path & "\shitlist.txt") For Input As #1 Do Until EOF(1) Input #1, Username If LCase(Username) Then CleanSlateBot1.Send "/ban " & Username & " Auto-Ban" rtbAdd " [" & time & "]" & " < " & Username & " > " & "Was Banned By: " & CleanSlateBot1.Username & " Auto-Ban" & vbNewLine, vbYellow Else rtbAdd " [" & time & "]" & " < " & Username & " > " & "Has Joined The Channel Using " & Flags & vbNewLine, vbYellow End If Loop Close #1 Dim MyItem As ListItem Set MyItem = ListView1.ListItems.Add() Select Case Product Case "WAR3": MyItem.SmallIcon = 12 Case "D2DV": MyItem.SmallIcon = 11 Case "STAR": MyItem.SmallIcon = 7 Case "D2XP": MyItem.SmallIcon = 11 Case "SEXP": MyItem.SmallIcon = 10 Case "W2BN": MyItem.SmallIcon = 8 End Select MyItem.Text = Username MyItem.SubItems(1) = Ping & " ms" Text2.Text = "" Text2.Text = Text2.Text & txtChanel.Text Text2.Text = Text2.Text & " (" & ListView1.ListItems.Count & ")" End Sub [/code] [/quote] im confused why do you need a close #1 at the start of the code above Open (App.Path & "\shitlist.txt") For Input As #1 | July 13, 2003, 3:07 AM |
blinkdude | i get a type error...... :/ i duno :) [code] Private Sub CleanSlateBot1_UserJoins(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long, ByVal Product As String, SimulatedEvent As Boolean) Open (App.Path & "\shitlist.txt") For Input As #1 Do Until EOF(1) Input #1, Username If LCase(Username) Then CleanSlateBot1.Send "/ban " & Username & " Auto-Ban" rtbAdd " [" & time & "]" & " < " & Username & " > " & "Was Banned By: " & CleanSlateBot1.Username & " Auto-Ban" & vbNewLine, vbYellow Else rtbAdd " [" & time & "]" & " < " & Username & " > " & "Has Joined The Channel Using " & Flags & vbNewLine, vbYellow End If Loop Close #1 Dim MyItem As ListItem Set MyItem = ListView1.ListItems.Add() Select Case Product Case "WAR3": MyItem.SmallIcon = 12 Case "D2DV": MyItem.SmallIcon = 11 Case "STAR": MyItem.SmallIcon = 7 Case "D2XP": MyItem.SmallIcon = 11 Case "SEXP": MyItem.SmallIcon = 10 Case "W2BN": MyItem.SmallIcon = 8 End Select MyItem.Text = Username MyItem.SubItems(1) = Ping & " ms" Text2.Text = "" Text2.Text = Text2.Text & txtChanel.Text Text2.Text = Text2.Text & " (" & ListView1.ListItems.Count & ")" End Sub [/code] | July 13, 2003, 3:44 AM |
______ | [code] if lcase(username) then [/code] if username equals what nothing .... that is where ur type error is | July 13, 2003, 3:57 AM |
blinkdude | ok i got it wokring but now i need to know how do i add them to the file it works with this code but dons't ban i think i have to add something into the text file look at this and tell me how the shitlist.txt file would look like [code] Open (App.Path & "\shitlist.txt") For Input As #1 Dim Shit As String Do Until EOF(1) Input #1, Shit If LCase(Username) Like LCase(Shit) Then CleanSlateBot1.Send "/ban " & Username Else rtbAdd " [" & time & "]" & " < " & Username & "> Has Joined The Chat Room" & vbNewLine, vbGreen End If Loop Close #1 [/code] the text file now is just Usernames just stacks on each other | July 13, 2003, 5:22 AM |
______ | instead of like use = [code] if lcase(username) = lcase(shit) [/code] | July 13, 2003, 5:30 AM |
blinkdude | ah k everything wokrs but when some1 has a name with "[" "]" in there tag it dosn't ban them :/ | July 13, 2003, 5:35 AM |
______ | your code works fine for me with tags | July 13, 2003, 5:56 AM |
blinkdude | lol i had his name spelled wrong | July 13, 2003, 6:11 AM |
Camel | [code]Public Function Matches(ByVal UserName As String, ByVal Format As String) As Boolean 'MSDN: Note To match the special characters left bracket ([), question mark (?), number sign (#), and asterisk (*), enclose them in brackets. The right bracket (]) can't be used within a group to match itself, but it can be used outside a group as an individual character. Format = Replace(Format, "[", "[[]") Format = Replace(Format, "#", "[#]") Matches = (UserName Like Format) End Function[/code] | July 13, 2003, 10:56 PM |