Valhalla Legends Forums Archive | Battle.net Bot Development | Sweep Ban Problem

AuthorMessageTime
Gangz
[code]
Dim va1 As String
Dim va2 As String
If Form1.chksweep = vbChecked And InStr(message, ",") <> 0 Then
va1 = Split(message, ", ")(0)
banname = va1
Dim banname1 As String
Dim banname2 As String
If Left(banname, 1) = "[" And Right(banname, 1) = "]" And UCase(banname) = banname Then
banname1 = Right(message, Len(banname) - 1) & Right(message, Len(banname1) - 1)
Form1.cboQueue.AddItem "/ban " & banname2 & " Superior Sweep"
Else
Form1.cboQueue.AddItem "/ban " & banname & " Superior Sweep"
End If
va2 = Split(message, ", ")(1)
banname = va2
If Left(banname, 1) = "[" And Right(banname, 1) = "]" And UCase(banname) = banname Then
banname1 = Right(message, Len(banname) - 1)
banname1 = Left(message, Len(banname) - 1)
Form1.cboQueue.AddItem "/ban " & banname1 & " Superior Sweep"
Else
Form1.cboQueue.AddItem "/ban " & banname & " Superior Sweep"
End If
End If
If Form1.chkci = vbChecked And InStr(message, ",") <> 0 Then
va1 = Split(message, ", ")(0)
banname = va1
If Left(banname, 1) = "[" And Right(banname, 1) = "]" And UCase(banname) = banname Then
banname1 = Right(message, Len(banname) - 1)
banname1 = Left(message, Len(banname) - 1)
Form1.cboQueue.AddItem "/ignore " & banname1
Else
Form1.cboQueue.AddItem "/ignore " & banname
End If
va2 = Split(message, ", ")(1)
banname = va2
If Left(banname, 1) = "[" And Right(banname, 1) = "]" And UCase(banname) = banname Then
banname1 = Right(message, Len(banname) - 1)
banname1 = Left(message, Len(banname) - 1)
Form1.cboQueue.AddItem "/ignore " & banname1
Else
Form1.cboQueue.AddItem "/ignore " & banname
End If
End If
[/code]

With the Help of dda-trick-e I have come up with this code for "Sweeping" a channel. I keep getting an error on the ops though


[code]
If Left(banname, 1) = "[" And Right(banname, 1) = "]" And UCase(banname) = banname Then
banname1 = Right(message, Len(banname) - 1)
banname1 = Left(message, Len(banname) - 1)
[/code]
I have alost tried
[code]
If Left(banname, 1) = "[" And Right(banname, 1) = "]" And UCase(banname) = banname Then
banname1 = Right(message, Len(banname) - 1) & Left(message, Len(banname) - 1)
[/code]

anyone got any suggest i have tried a few other combos but its not looking any closer then the 2 of these

Edit: Fixed the Code tags
Edit(Grok): Indented so I could read it :)
May 7, 2004, 5:38 AM
Newby
Try using a Mid$() statement. Starting at 2 ending 1 away from the end of the string.
May 7, 2004, 5:48 AM
Eli_1
[quote author=Gangz link=board=17;threadid=6687;start=0#msg58898 date=1083908335]
[code]
Dim va1 As String
Dim va2 As String
. . .
va1 = Split(message, ", ")(0)
banname = va1
...
va2 = Split(message, ",")(0)
...
[/code]
[/quote]

Since your using split, shouldn't those be arrays?

And on a side note, your code is fugly. >:(
May 7, 2004, 10:50 AM
Gangz
[quote author=Eli_1 link=board=17;threadid=6687;start=0#msg58911 date=1083927013]
[quote author=Gangz link=board=17;threadid=6687;start=0#msg58898 date=1083908335]
[code]
Dim va1 As String
Dim va2 As String
. . .
va1 = Split(message, ", ")(0)
banname = va1
...
va2 = Split(message, ",")(0)
...
[/code]
[/quote]

Since your using split, shouldn't those be arrays?

And on a side note, your code is fugly. >:(
[/quote]

Does it matter what it looks like? It gets the job done...
May 7, 2004, 2:14 PM
Newby
Use Mid$()

[code]Mid$(Username, 2, Len(Username) - 2)[/code]

And I agree with Eli, your coding is very fucking ugly. :(
May 7, 2004, 2:32 PM
Eli_1
[quote author=Gangz link=board=17;threadid=6687;start=0#msg58923 date=1083939282]
Does it matter what it looks like? It gets the job done...
[/quote]
Yes it does matter. Clean coding is a part of good programming practice, and it will make your code much easier to understand in the future and will be easier to update.
May 7, 2004, 4:21 PM
Adron
[quote author=Gangz link=board=17;threadid=6687;start=0#msg58923 date=1083939282]
Does it matter what it looks like? It gets the job done...
[/quote]

As long as you are the only one reading it and you can understand it perfectly, it doesn't matter.

As soon as you show it to other people and ask them to help you with your code, it does matter. If they can understand your code easier, they'll be able to help you more effectively.

I also think that you yourself would be helped by prettier code, although you may not realize it yet.
May 7, 2004, 4:46 PM
Gangz
Thanks for the help eli and newby ill give it a shot...
May 7, 2004, 4:58 PM
hismajesty
Yes, you should work on cleaning up your code. I didn't even read the entire code since I have a headache and it made it worse. >:(
May 7, 2004, 6:45 PM
Gangz
Sorry, I know im not the best of coders... But i do whats needed to get the job done


Thanks everyone for the help... I got it to work..
May 7, 2004, 9:36 PM

Search