• Welcome to Valhalla Legends Archive.
 

Sweep Ban Problem

Started by Gangz, May 07, 2004, 12:38 AM

Previous topic - Next topic

Gangz


   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


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



   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)

I have alost tried

   If Left(banname, 1) = "[" And Right(banname, 1) = "]" And UCase(banname) = banname Then
banname1 = Right(message, Len(banname) - 1) & Left(message, Len(banname) - 1)


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 :)

Newby

Try using a Mid$() statement. Starting at 2 ending 1 away from the end of the string.
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

Eli_1

Quote from: Gangz on May 07, 2004, 12:38 AM

Dim va1 As String
Dim va2 As String
. . .
va1 = Split(message, ", ")(0)
banname = va1
...
va2 = Split(message, ",")(0)
...


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

And on a side note, your code is fugly.  >:(

Gangz

Quote from: Eli_1 on May 07, 2004, 05:50 AM
Quote from: Gangz on May 07, 2004, 12:38 AM

Dim va1 As String
Dim va2 As String
. . .
va1 = Split(message, ", ")(0)
banname = va1
...
va2 = Split(message, ",")(0)
...


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

And on a side note, your code is fugly.  >:(

Does it matter what it looks like? It gets the job done...

Newby

Use Mid$()

Mid$(Username, 2, Len(Username) - 2)

And I agree with Eli, your coding is very fucking ugly. :(
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

Eli_1

#5
Quote from: Gangz on May 07, 2004, 09:14 AM
Does it matter what it looks like? It gets the job done...
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.

Adron

Quote from: Gangz on May 07, 2004, 09:14 AM
Does it matter what it looks like? It gets the job done...

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.

Gangz

#7
Thanks for the help eli and newby ill give it a shot...

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

Gangz

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