Valhalla Legends Forums Archive | Battle.net Bot Development | Coloring Battle.net text

AuthorMessageTime
Luxer
How do I color my battle.net text? I am using the chat gateway, if that means anything..
I asked in Blizzard Tech Support, and all they said was to us ascii characters.
July 29, 2004, 6:30 PM
ChR0NiC
[quote author=Luxer link=board=17;threadid=7954;start=0#msg73245 date=1091125846]
How do I color my battle.net text? I am using the chat gateway, if that means anything..
I asked in Blizzard Tech Support, and all they said was to us ascii characters.
[/quote]

You gotta use the "Á" letter to initiate the colors then follow it by another letter to specify the color. This is what I have discovered with colors.
[code]
"Y" = Red
"U", "P", "T", "U", "V = Light Blue
"S", "Z = Yellow
"V", "R" = Green
"Z" = Magenta
"X", "W" = White
"Q" = Grey (whisper color)
[/code]

So for example I would type on BNET, (not client).
[quote]
ÁYSup ÁUNiGGa
[/quote]

Hope this helps.

Edit: btw this has nothing to do with Bot Development, so it should probably go in the "General" category.
July 29, 2004, 6:43 PM
tA-Kane
If you're meaning on a local client that you're developing, you need to do it yourself. Using the "color codes" as other people put it isn't going to work.

I know you're writing your bot with REALbasic, so here's help.

Create an EditField, make sure its Styled property is set to true. I do not beleive its modifiable at runtime, so you should set it in the REALbasic IDE.

After that, here's a simple way of adding text in various colors:[code]Sub AddColoredText(Field As EditField, Text As String, TextColor As Color)
Field.SelStart = Len(Field.Text)'set the location to the end of the field
Field.SelTextColor = TextColor'set text color
Field.SelText = Text'set text
End Sub[/code]
July 31, 2004, 4:30 PM
Luxer
When would color codes work?
August 1, 2004, 4:08 PM
ChR0NiC
[quote author=Luxer link=board=17;threadid=7954;start=0#msg73619 date=1091376532]
When would color codes work?
[/quote]

WTF? All the time...
August 1, 2004, 6:10 PM
Myndfyr
[quote author=ChR0NiC link=board=17;threadid=7954;start=0#msg73641 date=1091383832]
[quote author=Luxer link=board=17;threadid=7954;start=0#msg73619 date=1091376532]
When would color codes work?
[/quote]

WTF? All the time...
[/quote]

No Chr0nic, they wouldn't work all of the time. As I recall, REALBasic is a Mac equivalent of Visual Basic.

As I recall, the "color codes" information is actually a bug with the way Windows handles UTF-8 encoding. Thus, color codes would NOT work on a Mac.
August 1, 2004, 7:44 PM
K
[quote author=Myndfyre link=board=17;threadid=7954;start=0#msg73659 date=1091389452]
[quote author=ChR0NiC link=board=17;threadid=7954;start=0#msg73641 date=1091383832]
[quote author=Luxer link=board=17;threadid=7954;start=0#msg73619 date=1091376532]
When would color codes work?
[/quote]

WTF? All the time...
[/quote]

No Chr0nic, they wouldn't work all of the time. As I recall, REALBasic is a Mac equivalent of Visual Basic.

As I recall, the "color codes" information is actually a bug with the way Windows handles UTF-8 encoding. Thus, color codes would NOT work on a Mac.
[/quote]

I believe it's a problem with Blizzard's UTF-8 implementation.
August 1, 2004, 7:55 PM
ChR0NiC
[quote author=K link=board=17;threadid=7954;start=0#msg73665 date=1091390119]
I believe it's a problem with Blizzard's UTF-8 implementation.
[/quote]

Yeah that's what I was thinking, I thought it was a problem in the client, not the OS's event handlers.
August 1, 2004, 8:16 PM
Kp
K & Chr0nic are correct. Blizzard wrote their own implementation of a UTF8 decoder for their games, rather than use the one supplied by the operating system. As is fairly obvious, the Blizzard one has some bugs. Thus, it's quite likely the bug will work on a Mac, since I suspect they compiled the same broken code for both Windows and Mac targets.
August 1, 2004, 9:08 PM
tA-Kane
They probably do work on Blizzard's Mac clients, I don't know... I've never checked. But I do know that they don't work in REALbasic.
August 2, 2004, 3:52 AM
Myndfyr
[quote author=Kp link=board=17;threadid=7954;start=0#msg73673 date=1091394533]
K & Chr0nic are correct. Blizzard wrote their own implementation of a UTF8 decoder for their games, rather than use the one supplied by the operating system. As is fairly obvious, the Blizzard one has some bugs. Thus, it's quite likely the bug will work on a Mac, since I suspect they compiled the same broken code for both Windows and Mac targets.
[/quote]

I stand corrected; I haven't looked into the color codes information much, but I'm relatively certain that I once read that it was a Windows issue. I could be mistaken though (I'm saying that I read that, not that the information that I read was correct :-P).
August 2, 2004, 7:48 AM
Kp
[quote author=Myndfyre link=board=17;threadid=7954;start=0#msg73743 date=1091432926][quote author=Kp link=board=17;threadid=7954;start=0#msg73673 date=1091394533]K & Chr0nic are correct. Blizzard wrote their own implementation of a UTF8 decoder for their games, rather than use the one supplied by the operating system. As is fairly obvious, the Blizzard one has some bugs. Thus, it's quite likely the bug will work on a Mac, since I suspect they compiled the same broken code for both Windows and Mac targets.[/quote]I stand corrected; I haven't looked into the color codes information much, but I'm relatively certain that I once read that it was a Windows issue. I could be mistaken though (I'm saying that I read that, not that the information that I read was correct :-P).[/quote]

You might've read someone speculating that the issue only affected clients written for use on Windows. Bear in mind that my comment about the bug working on Macs is just speculation based on Blizzard's past practices and that I know the issue lies in Blizzard's code, rather than in some system library.
August 2, 2004, 2:37 PM
Fleet-
I havn't looked hard, but I havn't seen any coding posted public for this yet...so I've decided to release mine for all you beginners. Its simple and quick.


[code]
'##################
'## At the end of your addChat sub put
'##################
If InStr(.Text, "Á") > 0 Then CheckColors

'##################

Private Sub CheckColors()
Dim sOne As String, iOne As Long

With Form1.RTB
Do Until InStr(.Text, "Á") = 0
iOne = InStr(.Text, "Á"): .SelStart = iOne: .SelLength = 1: sOne = .SelText: .SelStart = iOne - 1: .SelLength = Len(.Text)

Select Case sOne
Case "R": .SelColor = vbGreen
Case "P": .SelColor = vbWhite
Case "S": .SelColor = vbYellow
Case "T": .SelColor = vbCyan
Case "Q": .SelColor = &H808080
Case "V": .SelColor = vbCyan
Case "U": .SelColor = vbCyan
Case "Y": .SelColor = vbRed
End Select
.SelStart = iOne - 1: .SelLength = 2: .SelText = ""
Loop
End With


End Sub

'###############
[/code]
Enjoy. This is my own coding, I figured this out myself. So if you use it credit would be appreciated, thanks.
August 5, 2004, 12:43 PM
St0rm.iD
Quick optimization might run checkcolors only on new text added
August 5, 2004, 3:07 PM
Fleet-
I'm not sure if that was a suggestion...or what. But it does only run when text is added.
August 5, 2004, 8:54 PM
Myndfyr
[quote author=Fleet- link=board=17;threadid=7954;start=0#msg74238 date=1091739265]
I'm not sure if that was a suggestion...or what. But it does only run when text is added.
[/quote]

What the kind Storm is trying to tell you is that you shouldn't try to scan over *all* of the text in Rtb.Text, but rather just the text that you are adding.
August 5, 2004, 8:59 PM
LordNevar
It works correct, but it doesn't stop at the end of the text. I stops at the start of the new line of text. Which also colors the beginning line of the new text to whatever the last color call is.
August 5, 2004, 9:47 PM

Search