Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: blinkdude on August 06, 2003, 04:24 PM

Title: Code Help
Post by: 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
Title: Re:Code Help
Post by: sPlOrYgOn on August 06, 2003, 04:47 PM
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
?
Title: Re:Code Help
Post by: Soul Taker on August 06, 2003, 06:32 PM
Also note that no lag icon ranges from 0 to 8 ms ping times, IIRC.
Title: Re:Code Help
Post by: Grok on August 06, 2003, 09:02 PM
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.
Title: Re:Code Help
Post by: blinkdude on August 06, 2003, 11:43 PM
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
Title: Re:Code Help
Post by: 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
Title: Re:Code Help
Post by: Spht on August 07, 2003, 11:07 AM
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
Title: Re:Code Help
Post by: blinkdude on August 07, 2003, 03:35 PM
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
Title: Re:Code Help
Post by: Grok on August 07, 2003, 04:54 PM
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.
Title: Re:Code Help
Post by: blinkdude on August 07, 2003, 05:41 PM
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
Title: Re:Code Help
Post by: Grok on August 07, 2003, 07:40 PM
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.