• Welcome to Valhalla Legends Archive.
 

ICON CODE

Started by Gangz, June 04, 2004, 06:10 AM

Previous topic - Next topic

Gangz

Well, none of my previous bots have ever used icons or lagicons before so you can imagine the problems im having now. I searched the previous posts but cannot get anything.


'Image Constants
Public Const ICON_GAVEL    As Integer = 1
Public Const ICON_CHAT     As Integer = 2
Public Const ICON_DRTL     As Integer = 3
Public Const ICON_DSHR     As Integer = 4
Public Const ICON_D2DV     As Integer = 5
Public Const ICON_STAR     As Integer = 6
Public Const ICON_SSHR     As Integer = 7
Public Const ICON_SPAWN    As Integer = 8
Public Const ICON_SEXP     As Integer = 9
Public Const ICON_W2BN     As Integer = 10
Public Const ICON_JSTR     As Integer = 11
Public Const ICON_QUES     As Integer = 12
Public Const ICON_D2XP     As Integer = 13
Public Const ICON_SQUELCH  As Integer = 14
Public Const ICON_LAG1     As Integer = 15
Public Const ICON_LAG2     As Integer = 16
Public Const ICON_LAG3     As Integer = 17
Public Const ICON_LAG4     As Integer = 18
Public Const ICON_LAG5     As Integer = 19
Public Const ICON_LAG6     As Integer = 20
Public Const ICON_PLUG     As Integer = 21
Public Const ICON_ROG0     As Integer = 22
Public Const ICON_ROG1     As Integer = 23
Public Const ICON_ROG2     As Integer = 24
Public Const ICON_ROG3     As Integer = 25
Public Const ICON_SOR0     As Integer = 26
Public Const ICON_SOR1     As Integer = 27
Public Const ICON_SOR2     As Integer = 28
Public Const ICON_SOR3     As Integer = 29
Public Const ICON_WAR0     As Integer = 30
Public Const ICON_WAR1     As Integer = 31
Public Const ICON_WAR2     As Integer = 32
Public Const ICON_WAR3     As Integer = 33
Public Const ICON_SC0W     As Integer = 34
Public Const ICON_SC1W     As Integer = 35
Public Const ICON_SC2W     As Integer = 36
Public Const ICON_SC3W     As Integer = 37
Public Const ICON_SC4W     As Integer = 38
Public Const ICON_SC5W     As Integer = 39
Public Const ICON_SC6W     As Integer = 40
Public Const ICON_SC7W     As Integer = 41
Public Const ICON_SC8W     As Integer = 42
Public Const ICON_SC9W     As Integer = 43
Public Const ICON_SC10W    As Integer = 44
Public Const ICON_SCL      As Integer = 45
Public Const ICON_SCT10    As Integer = 46
Public Const ICON_SC       As Integer = 47
Public Const ICON_WC0W     As Integer = 48
Public Const ICON_WC1W     As Integer = 49
Public Const ICON_WC2W     As Integer = 50
Public Const ICON_WC3W     As Integer = 51
Public Const ICON_WC4W     As Integer = 52
Public Const ICON_WC5W     As Integer = 53
Public Const ICON_WC6W     As Integer = 54
Public Const ICON_WC7W     As Integer = 55
Public Const ICON_WC8W     As Integer = 56
Public Const ICON_WC9W     As Integer = 57
Public Const ICON_WC10W    As Integer = 58
Public Const ICON_WCL      As Integer = 59
Public Const ICON_JSTRSPAWN    As Integer = 60
Public Const ICON_3RAW As Integer = 61
Public Const ICON_BLIZZ     As Integer = 62
Public Const ICON_GLASSES  As Integer = 63
Public Const ICON_SYSOP    As Integer = 64
Public Const ICON_ZEROPING As Integer = 65
Public Const ICON_TFT As Integer = 66

'Flags Constants
Public Const BNFLAGS_BLIZZ = &H1
Public Const BNFLAGS_OP = &H2
Public Const BNFLAGS_SPKR = &H4
Public Const BNFLAGS_SYSOP = &H8
Public Const BNFLAGS_PLUG = &H10
Public Const BNFLAGS_SQUELCH = &H20
Public Const BNFLAGS_GLASSES = &H40




Public Function GetIconCode(Optional ByVal Client As String, Optional ByVal Flags As Long, Optional ByVal Username As String) As Integer
Dim Code As Integer
Dim pA() As String
Dim Spawn As Integer
Dim Stats As Boolean
On Error GoTo GetIconCode_Error
If Len(Client) > 4 Then Stats = True
If Len(Client) <> 0 Then
   If (BNFLAGS_BLIZZ And Flags) = BNFLAGS_BLIZZ Then
       GetIconCode = ICON_BLIZZ
       Exit Function
   ElseIf (BNFLAGS_OP And Flags) = BNFLAGS_OP Then
       GetIconCode = ICON_GAVEL
       Exit Function
   ElseIf (BNFLAGS_SYSOP And Flags) = BNFLAGS_SYSOP Then
       GetIconCode = ICON_SYSOP
       Exit Function
   ElseIf (BNFLAGS_SQUELCH And Flags) = BNFLAGS_SQUELCH And Username <> m_User Then
       GetIconCode = ICON_SQUELCH
       Exit Function
   ElseIf (BNFLAGS_GLASSES And Flags) = BNFLAGS_GLASSES Then
       GetIconCode = ICON_GLASSES
       Exit Function
   ElseIf Flags = 48 Then
       GetIconCode = ICON_SQUELCH
       Exit Function
   ElseIf Flags = 0 Then: GoTo Product
   End If
Product:
Select Case Client
 Case "TAHC"
     Code = ICON_CHAT
 Case "RATS"
     Code = ICON_STAR
 Case "RTSJ"
     Code = ICON_JSTR
 Case "RHSS"
     Code = ICON_SSHR
 Case "VD2D"
     Code = ICON_D2DV
 Case "RHSD"
     Code = ICON_DSHR
 Case "3RAW"
     Code = ICON_3RAW
 Case "PX3W"
     Code = ICON_3RAW
 Case "PX2D"
     Code = ICON_D2XP
 Case "NB2W"
   Code = ICON_W2BN
 Case "PXES"
   Code = ICON_SEXP
 Case "LTRD"
   Code = ICON_DRTL
 Case "IGNO"
   Code = ICON_SQUELCH
 Case Else
   Code = ICON_QUES
End Select
End If

GetIconCode = Code
Exit Function
GetIconCode_Error:

End Function




Public Function GetLagIcon(ByVal lPing As Long, Optional ByVal Flags As Long) As Integer
Dim IconCode As Integer
If (Flags And BNFLAGS_PLUG) = BNFLAGS_PLUG Then
           GetLagIcon = ICON_PLUG
           Exit Function
End If

'If (lPing >= 5) And (lPing <= 199) Then
If (lPing <= 199) Then

   IconCode = ICON_LAG1
End If
If (lPing >= 200) And (lPing <= 300) Then
   IconCode = ICON_LAG2
End If
If (lPing >= 301) And (lPing <= 400) Then
   IconCode = ICON_LAG3
End If
If (lPing >= 401) And (lPing <= 600) Then
   IconCode = ICON_LAG4
End If
If (lPing >= 601) And (lPing <= 1200) Then
  IconCode = ICON_LAG5
End If
If lPing > 1201 Then
   IconCode = ICON_LAG6
End If
If (lPing < 0) Then
   IconCode = ICON_LAG6
End If
If (lPing = 0) Then
   IconCode = ICON_ZEROPING
End If
GetLagIcon = IconCode
End Function




   Case &H1 ' HERE
       AddChat Form1.RTB, vbGreen, Username & " is here with a ping of " & Ping & "ms and flags of " & Flag & " using " & Client & " (" & Splt(3) & " wins, rating of " & Splt(1) & " with a high of " & Splt(6) & ")"
       Dim pinger As Integer
       Dim icon As Integer
       icon = GetIconCode(Client, Flags)
       Dim lagicoN As Integer
       lagicoN = GetLagIcon(Ping, Flags)
       If icon = ICON_GAVEL Then
           With Form1.lvchannel.ListItems.Add(1, Username, Username, , icon)
           .ListSubItems.Add , , , lagicoN
       End With
       End If
       If icon <> ICON_GAVEL Then
           With Form1.lvchannel.ListItems.Add(, , Username, , icon)
           .ListSubItems.Add , , , lagicoN
       End With
End If



see any problems? I appreciate allt he help ahead of time.

CrAz3D

If icon = ICON_GAVEL Then
           With Form1.lvchannel.ListItems.Add(1, Username, Username, , icon)
           .ListSubItems.Add , , , lagicoN
       End With
       End If
       If icon <> ICON_GAVEL Then
           With Form1.lvchannel.ListItems.Add(, , Username, , icon)
           .ListSubItems.Add , , , lagicoN
       End With


This is alot cleaner

Private Sub Form_Load()
If Icon = ICON_GAVEL Then
   Form1.lvChannel.ListItems.Add 1, , Username, , Icon
   Form1.lvChannel.ListItems(1).ListSubItems.Add , , , lagicon
Else
   Form1.lvChannel.ListItems.Add , , Username, , Icon
   Form1.lvChannel.ListItems(Form1.lvChannel.ListItems.Count).ListSubItems.Add , , , lagicon
End Sub

rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

Gangz

Well Since I have posted i have gotten a little further. now it gives me an error because it says image list is not initialized. I put the image list in the form and named it ClientIcons. But still the same error

______

right click on your listview properties, somewhere in the property tabs do set smallicons to your imagelist name.

Gangz

#4
I got it thanks all

Eli_1

Quote from: ___/\___ on June 04, 2004, 12:43 PM
right click on your listview properties, somewhere in the property tabs do set smallicons to your imagelist name.
I'm a Nazi when it comes to setting up listview settings with the property window, so:

Set ListView1.SmallIcons = ImageList1

phvckmeh

where could i get all thease icons? (like download em)


phvckmeh

how would implement them in my VB bot

hismajesty

Put them in an imagelist.