Valhalla Legends Forums Archive | Battle.net Bot Development | Channel Display Help.

AuthorMessageTime
Jaquio
Ok, I have a problem in order to show game Icons by usernames do you have to have a file on your form for the icons? If so where can I find this file, If not can someone point me in the direction of find out how to make it show the icons.
January 18, 2004, 1:06 AM
o.OV
Use the search facility and search for

.bni

That will give you information about the icon file from bnet.

What I did when I first made a chat bot with icon next to username is have an array of imageboxes..

I don't know if that is the best way to go but it is a start.
January 18, 2004, 3:17 AM
UserLoser.
Assuming you're using Visual Basic, you can just use a ListView along with the ImageList controls, then just have the ListView load images from the ImageList
January 18, 2004, 5:42 AM
Jaquio
Ok thank you. I got all that working now I just can't get Warcraft 3:tft to work... How would I do that like I did with these

[code]
If Product = "STAR" Then
InChannel.ListItems.add , , Username, , 6
ElseIf Product = "SEXP" Then
InChannel.ListItems.add , , Username, , 9
ElseIf Product = "D2DV" Then
InChannel.ListItems.add , , Username, , 5
ElseIf Product = "D2XP" Then
InChannel.ListItems.add , , Username, , 13
ElseIf Product = "W2BN" Then
InChannel.ListItems.add , , Username, , 10
ElseIf Product = "WAR3" Then
InChannel.ListItems.add , , Username, , 61
ElseIf Product = "CHAT" Then
InChannel.ListItems.add , , Username, , 2
ElseIf Product = "DRTL" Then
InChannel.ListItems.add , , Username, , 12
ElseIf Product = "DSHR" Then
InChannel.ListItems.add , , Username, , 1
ElseIf Product = "JSTR" Then
InChannel.ListItems.add , , Username, , 11
ElseIf Product = "SSHR" Then
InChannel.ListItems.add , , Username, , 1
Else
InChannel.ListItems.add , , Username, , 8
End If
lbPing.AddItem Ping
[/code]

What would the war3:tft be?
January 18, 2004, 4:02 PM
UserLoser.
Warcraft III: The Frozen Throne's id would be W3XP - As far as adding the images to the listview, you'll need to find the W3XP icon if you don't already have one
January 18, 2004, 5:47 PM
Kp
That code could be improved. Instead of having each branch invoke add with a common username and an ID# unique to the product, set it up as such:

if product is starcraft, then id = 6
else if product is brood war, then id = 9
etc. Alternately, you could use a select case statement. After the branching, id will be set to the number of the icon. Then you can have InChannel.ListItems.add , , Username, , id. This has the advantage of (probably) being smaller in code size, and certainly easier to maintain if you change how you add people to the listview.
January 18, 2004, 6:19 PM
hismajesty
[code] Select Case product
Case = "STAR"
InChannel.ListItems.add , , Username, , 6
Case = "SEXP"
InChannel.ListItems.add , , Username, , 9
Case = "D2DV"
InChannel.ListItems.add , , Username, , 5
Case = "D2XP"
InChannel.ListItems.add , , Username, , 13
Case = "W2BN"
InChannel.ListItems.add , , Username, , 10
Case = "WAR3"
InChannel.ListItems.add , , Username, , 61
Case = "W3XP"
InChannel.ListItems.add , , Username, , 62 'Replace with whatever your icon # is
Case = "DSHR"
InChannel.ListItems.add , , Username, , 1
Case = "DRTL"
InChannel.ListItems.add , , Username, , 12
Case = "JSTR"
InChannel.ListItems.add , , Username, , 11
Case = "SSHR"
InChannel.ListItems.add , , Username, , 1
Case = "CHAT"
InChannel.ListItems.add , , Username, , 2
Case Else
InChannel.ListItems.add , , Username, , 8
End Select
lbPing.AddItem Ping[/code]

Change the W3XP image number.
January 18, 2004, 7:51 PM
Grok
Kp is correct. There are multiple ways to implement, each as correct as the others. They vary in efficiency, readability, and maintainability.

Since you are using an imagelist, you could name each icon the same as the product. The imagelist image key for "STAR" would be "STAR". The advantage here being that selecting an image by product is made easier:

[code] 'do this in Form_Load
InChannel.Icons = ImgLstIcons
InChannel.SmallIcons = ImgLstSmallIcons
InChannel.ColumnHeaderIcons = ImgLstSmallIcons

'do this as users are added to the channel list
InChannel.ListItems.Add , , UserName, Product, Product[/code]

This method assumes you associated two imagelists with the listview.

After you get comfortable with this method, you should look at the VB code required to download and parse icons.bni, and use the resulting images to load into the ImageList with ListImages.Add LoadPicture(...)

[code] 'add parsed images to imagelist
ImageList1.ListImages.Add LoadPicture("STAR.jpg", vbLPSmall, vbLPColor)[/code]

Hope this helps.
January 18, 2004, 8:11 PM
UserLoser.
[quote author=Grok link=board=17;threadid=4774;start=0#msg40062 date=1074456712]
Kp is correct. There are multiple ways to implement, each as correct as the others. They vary in efficiency, readability, and maintainability.

Since you are using an imagelist, you could name each icon the same as the product. The imagelist image key for "STAR" would be "STAR". The advantage here being that selecting an image by product is made easier:

[code] 'do this in Form_Load
InChannel.Icons = ImgLstIcons
InChannel.SmallIcons = ImgLstSmallIcons
InChannel.ColumnHeaderIcons = ImgLstSmallIcons

'do this as users are added to the channel list
InChannel.ListItems.Add , , UserName, Product, Product[/code]

This method assumes you associated two imagelists with the listview.

After you get comfortable with this method, you should look at the VB code required to download and parse icons.bni, and use the resulting images to load into the ImageList with ListImages.Add LoadPicture(...)

[code] 'add parsed images to imagelist
ImageList1.ListImages.Add LoadPicture("STAR.jpg", vbLPSmall, vbLPColor)[/code]

Hope this helps.
[/quote]

Converting the TGA to a JPG/BMP - isn't that a bit hard to do?
January 18, 2004, 8:13 PM
Grok
You can use DirectX to convert Targa to JPG. There are probably other libraries in Windows which can do it, and if not, it's very likely you can find a public-domain DLL.

I think ReaJpeg 1.1 does it, but I haven't tested it.
http://download.com.com/3001-2192-10194049.html
January 18, 2004, 8:22 PM
UserLoser.
[quote author=Grok link=board=17;threadid=4774;start=0#msg40069 date=1074457334]
You can use DirectX to convert Targa to JPG. There are probably other libraries in Windows which can do it, and if not, it's very likely you can find a public-domain DLL.
[/quote]

I can extract the entire list of icons with no problem, separate the flags, product and everything except splitting up each image (so it's just one big list of icons together); perhaps you can show an example? :P
January 18, 2004, 8:24 PM
Grok
Here is a site with a list of file formats:

http://www.opennet.ru/docs/formats/
January 18, 2004, 8:34 PM
UserLoser.
[quote author=Grok link=board=17;threadid=4774;start=0#msg40071 date=1074458069]
Here is a site with a list of file formats:

http://www.opennet.ru/docs/formats/
[/quote]

Seen that TGA.txt already, but thanks I don't think i've seen any of the other ones ;)
January 18, 2004, 8:47 PM
Arta
Converting TGA to BMP isn't particularly difficult. Targa files as used by Battle.net are basically the same as BMPs, except with a different header, a slightly different pixel format and some (trivial) compression. They can vary in their format but for this purpose, it's not complicated.
January 19, 2004, 9:07 AM
DarkMinion
Owner drawn listbox > * ;D
January 19, 2004, 10:26 AM
Jaquio
Wow, thanks for all the help. I did make my code smaller in size with the code and info you all told me and now I have W3XP image showing instead of when someone joins the channel the bot quits. Thank you all for helping me, If I ever need help with anything I always come here and get the problem figured out.
January 19, 2004, 3:28 PM
DrivE
By the way... you're signature is even more obnoxious than Feanor's.
January 19, 2004, 5:03 PM
ChR0NiC
[quote author=Jaquio link=board=17;threadid=4774;start=0#msg40043 date=1074441773]
Ok thank you. I got all that working now I just can't get Warcraft 3:tft to work... How would I do that like I did with these

[code]
If Product = "STAR" Then
InChannel.ListItems.add , , Username, , 6
ElseIf Product = "SEXP" Then
InChannel.ListItems.add , , Username, , 9
ElseIf Product = "D2DV" Then
InChannel.ListItems.add , , Username, , 5
ElseIf Product = "D2XP" Then
InChannel.ListItems.add , , Username, , 13
ElseIf Product = "W2BN" Then
InChannel.ListItems.add , , Username, , 10
ElseIf Product = "WAR3" Then
InChannel.ListItems.add , , Username, , 61
ElseIf Product = "CHAT" Then
InChannel.ListItems.add , , Username, , 2
ElseIf Product = "DRTL" Then
InChannel.ListItems.add , , Username, , 12
ElseIf Product = "DSHR" Then
InChannel.ListItems.add , , Username, , 1
ElseIf Product = "JSTR" Then
InChannel.ListItems.add , , Username, , 11
ElseIf Product = "SSHR" Then
InChannel.ListItems.add , , Username, , 1
Else
InChannel.ListItems.add , , Username, , 8
End If
lbPing.AddItem Ping
[/code]

What would the war3:tft be?
[/quote]

I don't mean to be a jerk but I think Select Case might be better :D
[code]
Select Case Product

Case "STAR"
InChannel.ListItems.add , , Username, , 6
Case "SEXP"
InChannel.ListItems.add , , Username, , 9
Case "D2DV"
InChannel.ListItems.add , , Username, , 5
Case "D2XP"
InChannel.ListItems.add , , Username, , 13
Case "W2BN"
InChannel.ListItems.add , , Username, , 10
Case "WAR3"
InChannel.ListItems.add , , Username, , 61
Case "CHAT"
InChannel.ListItems.add , , Username, , 2
Case "DTRL"
InChannel.ListItems.add , , Username, , 12
Case "DSHR"
InChannel.ListItems.add , , Username, , 1
Case "JSTR"
InChannel.ListItems.add , , Username, , 11
Case "SSHR"
InChannel.ListItems.add , , Username, , 1
Case Else
InChannel.ListItems.add , , Username, , 8
End Select
lbPing.AddItem Ping
[/code]

Just incase you weren't aware of Select Case......it saves alot of time and space. And I have had more efficient results when using it. So just a suggestion :P
January 20, 2004, 1:08 AM
R.a.B.B.i.T
Why not use Public or Global Integer Consts instead of a seperate add?
[code]
On Error GoTo OnErr1
Dim ICON As Integer
Select Case varProd
Case "RATS"
ICON = i_STAR
Case "PXES"
ICON = i_SEXP
Case "VD2D"
ICON = i_D2DV
Case "PX2D"
ICON = i_D2XP
Case "NB2W"
ICON = i_W2BN
Case "3RAW"
ICON = i_WAR3
Case "PX3W"
ICON = i_W3XP
Case "TAHC"
ICON = i_CHAT
Case "LTRD"
ICON = i_DRTL
Case "RHSD"
ICON = i_DSHR
Case "RHSS"
ICON = i_SSHR
Case Else
ICON = i_UNWN
End Select
InChannel.ListItems.Add , , UserName, , ICON
Exit Sub
OnErr1:
InChannel.ListItems.Add , , UserName, , i_UNWN
[/code]
It's a lot better.
January 20, 2004, 2:16 AM
hismajesty
[quote]Just incase you weren't aware of Select Case......it saves alot of time and space. And I have had more efficient results when using it. So just a suggestion :P
[/quote]

Yeah, using a switch has been said two or three times already. :P
January 20, 2004, 2:27 PM
Grok
Should also consider wrapping that into a function.

[code]Private Function GetProductIdFromType(ProductType As String) As Integer
...
[/code]
January 20, 2004, 6:43 PM
R.a.B.B.i.T
[quote author=Grok link=board=17;threadid=4774;start=15#msg40360 date=1074624227]
Should also consider wrapping that into a function.

[code]Private Function GetProductIdFromType(ProductType As String) As Integer
...
[/code]

[/quote]
Long function name..why not just GetIcon(Product As String) As Integer?
January 20, 2004, 11:14 PM
SKiLLs
[quote author=UserLoser. link=board=17;threadid=4774;start=0#msg40064 date=1074456828]Converting the TGA to a JPG/BMP - isn't that a bit hard to do?
[/quote]

I use IrfanView :
http://download.com.com/3000-2192-10223761.html

and it's FREE!!
January 23, 2004, 3:18 AM
Tuberload
[quote author=R.a.B.B.i.T link=board=17;threadid=4774;start=15#msg40393 date=1074640474]
[quote author=Grok link=board=17;threadid=4774;start=15#msg40360 date=1074624227]
Should also consider wrapping that into a function.

[code]Private Function GetProductIdFromType(ProductType As String) As Integer
...
[/code]

[/quote]
Long function name..why not just GetIcon(Product As String) As Integer?
[/quote]

Some people like to use long, descriptive method/variabled names because it makes it easier for others to understand, as well as yourself if you leave a project and come back to it after a long period of time.
January 23, 2004, 7:03 AM

Search