• Welcome to Valhalla Legends Archive.
 

Code Help

Started by blinkdude, August 06, 2003, 04:24 PM

Previous topic - Next topic

blinkdude

Any see why i get an error here with "item" from  ImageList1.Item highlighted

If Ping > 0 And Ping < 200 Then MyItem.ListSubItems(1).SmallIcon = ImageList1.Item(4).Picture
If Ping > 201 And Ping < 300 Then MyItem.ListSubItems(1).SmallIcon = ImageList1.Item(5).Picture
If Ping > 301 And Ping < 400 Then MyItem.ListSubItems(1).SmallIcon = ImageList1.Item(6).Picture
If Ping > 401 And Ping < 500 Then MyItem.ListSubItems(1).SmallIcon = ImageList1.Item(7).Picture
If Ping > 501 Then MyItem.ListSubItems(1).SmallIcon = ImageList1.Item(8).Picture
<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
&

sPlOrYgOn

Quote from: blinkdude on August 06, 2003, 04:24 PM
Any see why i get an error here with "item" from  ImageList1.Item highlighted

If Ping > 0 And Ping < 200 Then MyItem.ListSubItems(1).SmallIcon = ImageList1.Item(4).Picture
If Ping > 201 And Ping < 300 Then MyItem.ListSubItems(1).SmallIcon = ImageList1.Item(5).Picture
If Ping > 301 And Ping < 400 Then MyItem.ListSubItems(1).SmallIcon = ImageList1.Item(6).Picture
If Ping > 401 And Ping < 500 Then MyItem.ListSubItems(1).SmallIcon = ImageList1.Item(7).Picture
If Ping > 501 Then MyItem.ListSubItems(1).SmallIcon = ImageList1.Item(8).Picture


don't u mean
MyItem.ListSubItems(1).ReportIcon
and
ImageList1.ListImages.Item(1).Picture
?

Soul Taker

Also note that no lag icon ranges from 0 to 8 ms ping times, IIRC.

Grok

#3
You're also completely missing some values.
negative numbers, and 0, 200, 201, 300, 301, 400, 401, 500, 501
are all unaccounted for.  Try this structure:


Select Case Ping
Case Is <= 0
  picSmallIcon = 3
Case Is <= 200
  picSmallIcon = 4
Case Is <= 300
  picSmallIcon = 5
Case Is <= 400
  picSmallIcon = 6
Case Is <= 500
  picSmallIcon = 7
Case Else
  picSmallIcon = 8
End Select
MyItem.ListSubItems(1).SmallIcon = ImageList1.Item(picSmallIcon).Picture


That is of course assuming the given is the correct syntax for loading the smallicon from an imagelist.  I haven't done that in a while and it may be inaccurate.

blinkdude

OK it will run with now errors but when i connect and join a channel i get this error

Run Time 35600
Index Out Of bounds
<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
&

Maddox

#5
If you want to keep consistency with the client, negative ping times have an icon of 6 red.

This should fix it:

Select Case Ping
Case Is < 0
 picSmallIcon = 8
Case 0
 picSmallIcon = 3
Case Is <= 200
 picSmallIcon = 4
Case Is <= 300
 picSmallIcon = 5
Case Is <= 400
 picSmallIcon = 6
Case Is <= 500
 picSmallIcon = 7
Case Else
 picSmallIcon = 8
End Select
asdf.

Spht

#6
Quote from: Maddox on August 07, 2003, 03:09 AM
If you want to keep consistency with the client, negative ping times have an icon of 6 red.

This should fix it:

Select Case Ping
Case Is < 0
 picSmallIcon = 8
Case 0
 picSmallIcon = 3
Case Is <= 200
 picSmallIcon = 4
Case Is <= 300
 picSmallIcon = 5
Case Is <= 400
 picSmallIcon = 6
Case Is <= 500
 picSmallIcon = 7
Case Else
 picSmallIcon = 8
End Select


Ping 0-9 renders no icon on real game clients. Also, 10-199 is one latency bar, not 1-200 which you show. So it should look something like this:

Select Case Ping
   Case Is < 0, Is >= 600
       ' SIX latency bars
   Case Is < 10
       ' No latency bars
   Case Is < 200
       ' ONE latency bar
   Case Is < 300
       ' TWO latency bars
   Case Is < 400
       ' THREE latency bars
   Case Is < 500
       ' FOUR latency bars
   Case Is < 600
       ' FIVE latency bars
End Select

blinkdude

the case's are right its this code that gets the error

MyItem.ListSubItems(1).SmallIcon = ImageList1.Item(picSmallIcon).Picture

It says index is out of bounds
<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
&

Grok

The value you are passing for 'picSmallIcon' is too high.  You need to look at your image list and make sure you have a bitmap inserted for each value you wish to use.

blinkdude

oki got the values right but i get the error on this code.. ".Item" is highlighted when i gover over it when i run th e program it says this


MyItem.ListSubItems(1).SmallIcon = <index out of bouds>


MyItem.ListSubItems(1).SmallIcon = ImageList1.Item(picSmallIcon).Picture
<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
&

Grok

Once again, the ImageList1 does not contain enough images.

For example, say the value of picSmallIcon is 8.  Look in your ImageList1 and you will see the image list only goes up to some value 7 or less.