• Welcome to Valhalla Legends Archive.
 

This Code look right :/

Started by blinkdude, July 12, 2003, 03:54 AM

Previous topic - Next topic

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

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
<Total-Assault@Azeroth> WTF IS THIS CLAN A BUNCH OF NERDS?
<Yoni[vL]@Azeroth> Yes.
<Grok> Yes.
<[vL]Kp> You sound surprised.
<Total-Assault> at least they admit it
&

Eternal

#1
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:

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



[EDIT] Forgot to add code tags :-/
^-----silly Brit
-----------------------------
www.brimd.com

blinkdude

with this code i get an runtime error "15" and sometimes "62"

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
<Total-Assault@Azeroth> WTF IS THIS CLAN A BUNCH OF NERDS?
<Yoni[vL]@Azeroth> Yes.
<Grok> Yes.
<[vL]Kp> You sound surprised.
<Total-Assault> at least they admit it
&

Eternal

#3
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>
^-----silly Brit
-----------------------------
www.brimd.com

drivehappy

#4

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


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...

Spht

Quote from: blinkdude on July 12, 2003, 04:27 AM
with this code i get an runtime error "15" and sometimes "62"

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


Why is the Warcraft II product written normally while all the others are backwards?

blinkdude

i dujno i have to fix that maybe thats y only wc2 incons show up :) thx spth!
<Total-Assault@Azeroth> WTF IS THIS CLAN A BUNCH OF NERDS?
<Yoni[vL]@Azeroth> Yes.
<Grok> Yes.
<[vL]Kp> You sound surprised.
<Total-Assault> at least they admit it
&

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

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
<Total-Assault@Azeroth> WTF IS THIS CLAN A BUNCH OF NERDS?
<Yoni[vL]@Azeroth> Yes.
<Grok> Yes.
<[vL]Kp> You sound surprised.
<Total-Assault> at least they admit it
&

DarkMinion


______

Quote from: blinkdude on July 12, 2003, 05:15 PM
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

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

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

blinkdude

i get a type error...... :/ i duno :)

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

<Total-Assault@Azeroth> WTF IS THIS CLAN A BUNCH OF NERDS?
<Yoni[vL]@Azeroth> Yes.
<Grok> Yes.
<[vL]Kp> You sound surprised.
<Total-Assault> at least they admit it
&

______


if lcase(username) then


if username equals what nothing .... that is where ur type error  is

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

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

the text file now is just Usernames just stacks on each other
<Total-Assault@Azeroth> WTF IS THIS CLAN A BUNCH OF NERDS?
<Yoni[vL]@Azeroth> Yes.
<Grok> Yes.
<[vL]Kp> You sound surprised.
<Total-Assault> at least they admit it
&

______

#13
instead of like  use    =  

if lcase(username) = lcase(shit)

blinkdude

ah k everything wokrs but when some1 has a name with "[" "]"
in there tag it dosn't ban them :/
<Total-Assault@Azeroth> WTF IS THIS CLAN A BUNCH OF NERDS?
<Yoni[vL]@Azeroth> Yes.
<Grok> Yes.
<[vL]Kp> You sound surprised.
<Total-Assault> at least they admit it
&