• Welcome to Valhalla Legends Archive.
 

Icon Troubles

Started by Death-Merchant, September 16, 2003, 09:50 PM

Previous topic - Next topic

Death-Merchant

For some reason when I squelch someone then unsquelch them all the icons and lab bars disapear and the icon turns to unknown.  Anyway to fix this?  I'm working with VB.

Spht

Quote from: Death-Merchant on September 16, 2003, 09:50 PM
For some reason when I squelch someone then unsquelch them all the icons and lab bars disapear and the icon turns to unknown.  Anyway to fix this?  I'm working with VB.

Paste some code.

iago

#2
put [code ] and [/code ] tags around your code, please.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Death-Merchant

This is my ChangeFlags


Public Function ChangeFlags(Flags As String)
On Error Resume Next
Dim Code As Integer
If Flags = "2" Then
Code = ICON_GAVEL
ElseIf Flags = "32" Then
Code = ICON_IGNORE
ElseIf Flags = "1" Then
Code = ICON_BLIZZ
ElseIf Flags = "4" Then
Code = ICON_MEGA
Else
Code = ICON_QUES
End If
ChangeFlags = Code
End Function


GetIconCode

Public Function GetIconCode(Client As String, Optional Flags As String) As Integer
On Error Resume Next
Dim Code As Integer
Select Case Client
 Case "[CHAT]": Code = ICON_CHAT
 Case "[DRTL]": Code = ICON_DRTL
 Case "[DSHR]": Code = ICON_DSHR
 Case "[D2XP]": Code = ICON_D2XP
 Case "[STAR]": Code = ICON_STAR
 Case "[SEXP]": Code = ICON_SEXP
 Case "[SSHR]": Code = ICON_SSHR
 Case "[W2BN]": Code = ICON_W2BN
 Case "[D2DV]": Code = ICON_D2DV
 Case "[JSTR]": Code = ICON_JSTR
 Case "[BRX]":  Code = ICON_IGNORE
 Case "[WAR3]": Code = ICON_WAR3
 Case "[W3XP]": Code = ICON_W3XP
 
 Case Else: Code = ICON_QUES
End Select
If Flags = "2" Then Code = ICON_GAVEL
If Flags = "18" Then Code = ICON_GAVEL
If Flags = "32" Then Code = ICON_IGNORE
If Flags = "1" Then Code = ICON_BLIZZ
If Flags = "4" Then Code = ICON_MEGA
GetIconCode = Code
End Function


And this is my Event_Flags()

Public Sub Event_Flags(strUser, strFlag)

Dim newicon As Integer
newicon = ChangeFlags(strFlag)

   Dim i As Integer
   On Error Resume Next


For i = 0 To frmBot.ChannelUsers.ListItems.Count
       If frmBot.ChannelUsers.ListItems(i) = "" Then
           GoTo hi
       End If
       If frmBot.ChannelUsers.ListItems(i).Text = strUser Then
               If strFlag = "0000" Then
       If frmBot.ChannelUsers.ListItems(i).SmallIcon = ICON_IGNORE Then GoTo muaha
       Exit Sub
       End If
       If strFlag = "0010" Then
       If frmBot.ChannelUsers.ListItems(i).SmallIcon = ICON_IGNORE Then GoTo muaha
       Exit Sub
       End If
muaha:
               frmBot.ChannelUsers.ListItems.Remove (i)
           Exit For
       End If
hi:
   Next i
frmBot.ChannelUsers.ListItems.Add (i), , strUser, , newicon
End Sub

Skywing

You should be using the And operator and not the = operator.  To do this you should probably convert the flags to a Long value and do tests on integral constants, not string constants.

Camel

Quote from: Skywing on September 17, 2003, 12:41 AM
You should be using the And operator and not the = operator.  To do this you should probably convert the flags to a Long value and do tests on integral constants, not string constants.

Someone should write a hack for YaBB that finds this sort of thing automaticly -- for example, search for "if flags = " -- and highlights it with a link to an explanation of why it's wrong.  ;D

BlazingKnight