Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: c0ol on June 08, 2003, 07:25 PM

Title: Color Codes
Post by: c0ol on June 08, 2003, 07:25 PM
After a buncha people started joining the channel  and using starcraft color codes, i decided it would look cooler if my bot parsed them, than just seeing the ascii, so i did a little research and mapped them out.  If anyone else is interested in this feature, here: http://c0ol.servebeer.com/~c0ol/colorcodes.html
Title: Re:Color Codes
Post by: Skywing on June 08, 2003, 08:12 PM
Quote from: c0ol on June 08, 2003, 07:25 PM
After a buncha people started joining the channel  and using starcraft color codes, i decided it would look cooler if my bot parsed them, than just seeing the ascii, so i did a little research and mapped them out.  If anyone else is interested in this feature, here: http://c0ol.servebeer.com/~c0ol/colorcodes.html
You're wrong about the Starcraft color codes.  As I've noted previously, Starcraft now UTF-8 processes data.  All of the SC in-chat listbox codes are very low characters, which is what those turn out to be if you UTF-8 decode them.

This is the result of a multilevel flaw in Battle.net; first of all, the Battle.net server does not properly translate (indeed, it does not translate at all) UTF-8 to/from clients which do and don't support it.  Secondly, Storm.dll's UTF-8 implementation is flawed, and incorrectly decodes redundant encodings, which the UTF-8 specification expressly forbids.  If Storm.dll's UTF-8 implementation worked properly, redundant sequences would be rejected instead of possibly being turned into low-characters as is the case here.
Title: Re:Color Codes
Post by: Camel on June 09, 2003, 03:35 PM
you forgot ÿC: for dark green
btw, it's probably better to think of it as ('0') to ('0'+12) than a byte because after '9' comes ':' ';' and '<'
and also, d2 shadows go from '!' to ('!'+13)
Title: Re:Color Codes
Post by: indulgence on June 09, 2003, 09:59 PM
http://128.242.116.18/schackit/wbb/thread.php?threadid=127&boardid=15&styleid=2&sid=fb96e45a3526a94c212d0cc3c58f2b86

There is a patch i made to enable the SC Client to send the colors in bnet channels.  I made it a little easier on people by making #X where X is the color identifier.  It will work as many times as you log on/off battle.net... but, if you restart sc, you must repatch...

At any rate, its fairly self-explanitory
Title: Re:Color Codes
Post by: c0ol on June 10, 2003, 12:55 AM
Quote from: Camel on June 09, 2003, 03:35 PM
you forgot ÿC: for dark green
btw, it's probably better to think of it as ('0') to ('0'+12) than a byte because after '9' comes ':' ';' and '<'
and also, d2 shadows go from '!' to ('!'+13)
IIRC < is dark green, and i have all that on the url.
Title: Re:Color Codes
Post by: Camel on June 10, 2003, 03:41 PM
Quote from: c0ol on June 10, 2003, 12:55 AM
Quote from: Camel on June 09, 2003, 03:35 PM
you forgot ÿC: for dark green
btw, it's probably better to think of it as ('0') to ('0'+12) than a byte because after '9' comes ':' ';' and '<'
and also, d2 shadows go from '!' to ('!'+13)
IIRC < is dark green, and i have all that on the url.

2 is light green, : is green, < is dark green
here's a bitmap:

(http://camel.ik0ns.com:84/images/d2colors.bmp)
Title: Re:Color Codes
Post by: OcTaViuS on June 10, 2003, 04:03 PM
so is there any ez way to do the sc colours with a special char like the d2 ones?
Title: Re:Color Codes
Post by: Camel on June 10, 2003, 04:28 PM
       x = InStr(x + 1, mytext, "ÿC")
       If x > 0 Then
           color = 0
           Select Case (Mid(mytext, x + 2, 1))
               Case "0": color = D2White
               Case "1": color = D2Red
               Case "2": color = D2Green
               Case "3": color = D2Blue
               Case "4": color = D2Beige1
               Case "5": color = D2Gray
               Case "6": color = D2Black
               Case "7": color = D2Beige2
               Case "8": color = D2Orange
               Case "9": color = D2LtYellow
               Case ":": color = D2Green 'fixme: medium green
               Case ";": color = D2Purple
               Case "<": color = D2Green 'fixme: dark green
           End Select


       x = InStr(x + 1, mytext, "Á")
       If x > 0 Then
           color = 0
           Select Case (Mid(mytext, x + 1, 1))
               Case "P": color = SCWhite
               Case "Q": color = SCGray
               Case "R": color = SCGreen
               Case "S": color = SCYellow
               Case "T": color = SCCyan
               Case "U": color = SCCyan
               Case "V": color = SCCyan
               Case "W": color = SCWhite
               Case "X": color = SCYellow
               Case "Y": color = SCRed
               Case "Z": color = SCYellow
               Case "[": color = SCRed
           End Select
Title: Re:Color Codes
Post by: c0ol on June 10, 2003, 05:37 PM
Quote from: Camel on June 10, 2003, 03:41 PM
2 is light green, : is green, < is dark green
here's a bitmap:

yes if u actually went to the url i posted, u can see those colors and the RGB hex codes for them.
Title: Re:Color Codes
Post by: Camel on June 10, 2003, 06:16 PM
Quote from: c0ol on June 10, 2003, 05:37 PM
Quote from: Camel on June 10, 2003, 03:41 PM
2 is light green, : is green, < is dark green
here's a bitmap:

yes if u actually went to the url i posted, u can see those colors and the RGB hex codes for them.

i did go. : was and still is missing.
Title: Re:Color Codes
Post by: Super on June 13, 2003, 12:02 PM
What about the War2BNE, the Diablo 1, and the Warcraft 3 color codes what are they?
Title: Re:Color Codes
Post by: OcTaViuS on June 13, 2003, 02:30 PM
Quote from: Super on June 13, 2003, 12:02 PM
What about the War2BNE, the Diablo 1, and the Warcraft 3 color codes what are they?

heres an idea, log onto b.net with one of those games, and try to type in all the symbols in Charector Map. if those games are anything like d2 then u shouldnt be able to use a symbol, that symbol being the 1 in the color code. (like how in the d2 chat screen u cant type in a ÿ since its part of the code)
Title: Re:Color Codes
Post by: OcTaViuS on June 13, 2003, 02:53 PM
if ur desperate enough to try my suggestion heres a hint...

for WC3 "€" (Alt+0128) is the only char that cannot be typed in. so try a bunch of combinations with that and see if u can figure it out.

i have no clue whether my Charector Map method will work, its just an idea i got off the top of my head.
Title: Re:Color Codes
Post by: iago on June 13, 2003, 06:09 PM
WC2 should be the same as Starcraft, and War3 I forget, it's something like |cxxyyzz where xx = red, yy = green, and zz = blue, but it's filtered out everywhere except in player names in custom games (see: www.backstab.ca's namespoofer for war3 ingame colors, assuming it works with the current version).  

Title: Re:Color Codes
Post by: OcTaViuS on June 13, 2003, 08:32 PM
wc2 isnt the same as sc
Title: Re:Color Codes
Post by: Skywing on June 13, 2003, 11:07 PM
Quote from: OcTaViuS on June 13, 2003, 08:32 PM
wc2 isnt the same as sc
Actually, it is; You'd know this if you took the time to read the second post in this thread.
Title: Re:Color Codes
Post by: iago on June 14, 2003, 04:55 AM
Quote from: Skywing on June 13, 2003, 11:07 PM
Quote from: OcTaViuS on June 13, 2003, 08:32 PM
wc2 isnt the same as sc
Actually, it is; You'd know this if you took the time to read the second post in this thread.

He just might be ignorant and not realize that starcraft and wc2 use the same storm.dll.

Actually, they aren't the exact same; same codes, different colors.  
Title: Re:Color Codes
Post by: OcTaViuS on June 14, 2003, 01:39 PM
skywing i personally went on wc2 and tested it. if its the same .dll then i cant explain y it doesnt work, but i did not get any colour using SC's code.

Edit:

Steps i took to test it:

#1 Placed BW cd into first cd-rom
#2 Logged onto Battle.net with BW
#3 Went into my home channel
#4 Placed WC2 cd into second cd-rom
#5 Logged onto Battle.net with WC2
#6 Went into my home channel
#7 Logged onto Battle.net with my bot
#8 Went into my home channel
#9 Used my bot to type in "ÁR Hey, testing"
#10 Maximized BW and read "Hey, testing" in green text
#11 Minimized BW
#12 Maximized WC2 and read "ÁR Hey, testing" in plain white text
#13 Minimized WC2

At first i figured that 'ÁR' in WC2 was for some reason the code for white text instead of green. Then i realised that if that was true then it wouldnt have displayed the 'ÁR' part.

I am open to suggestions as to how my test may have been faulty. It is possible since there was 13 steps, and 13 is an unlucky number after all.  But from what i saw, i am definitly to believe that SC and WC2 color codes are not the same.
Title: Re:Color Codes
Post by: Skywing on June 15, 2003, 04:44 PM
Quote from: OcTaViuS on June 14, 2003, 01:39 PM
skywing i personally went on wc2 and tested it. if its the same .dll then i cant explain y it doesnt work, but i did not get any colour using SC's code.

Edit:

Steps i took to test it:

#1 Placed BW cd into first cd-rom
#2 Logged onto Battle.net with BW
#3 Went into my home channel
#4 Placed WC2 cd into second cd-rom
#5 Logged onto Battle.net with WC2
#6 Went into my home channel
#7 Logged onto Battle.net with my bot
#8 Went into my home channel
#9 Used my bot to type in "ÁR Hey, testing"
#10 Maximized BW and read "Hey, testing" in green text
#11 Minimized BW
#12 Maximized WC2 and read "ÁR Hey, testing" in plain white text
#13 Minimized WC2

At first i figured that 'ÁR' in WC2 was for some reason the code for white text instead of green. Then i realised that if that was true then it wouldnt have displayed the 'ÁR' part.

I am open to suggestions as to how my test may have been faulty. It is possible since there was 13 steps, and 13 is an unlucky number after all.  But from what i saw, i am definitly to believe that SC and WC2 color codes are not the same.
Once again, if you had read my post, you'd see that Starcraft introduces UTF-8 processing on text (thus implying that older games, such as Warcraft II don't UTF-8 process text).

Both games do use the same color codes - what you are inputting are UTF-8 encoded versions of them, as I explained earlier.  Due to a flaw in Starcraft's UTF-8 processing, redundant encodings are not dropped, and the given text is incorrectly decoded into what becomes color codes.