HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How to add colered Text.

01-17-2007, 07:50 PM#1
darkened-angel
I need it for game text. like when player 1(Red) unit kills a unit. I have so the message itself works but i wanted to color code it for players. So whe n blues units kills a unit. The test is in blue. Sorry if i did not explain it well. IF you need me to explain more i can.
01-17-2007, 07:54 PM#2
Av3n
... So use If/Then/else action codition is th onwer of the killing unit, then your text in the actions

-Av3n
01-17-2007, 07:59 PM#3
darkened-angel
I know that lol i got it to work. But i need to know how to add color code. So when red kills a unit the message itself is in red. And i have no idea how to make the text in the color that i want.
01-17-2007, 08:07 PM#4
Av3n
Player 1: |c00FF0303|r
Player 2: |c000042FF|r
Player 3: |c001CE6B9|r
Player 4: |c00540081|r
Player 5: |c00FFFC01|r
Player 6: |c00FEBA0E|r
Player 7: |c0020C000|r
Player 8: |c00E55BB0|r
Player 9: |c00959697|r
Player 10: |c007EBFF1|r
Player 11: |c00106246|r
Player 12: |c004E2A04|r

There you go!

-Av3n
01-17-2007, 08:19 PM#5
wyrmlord
In case it's not clear, you use color codes. You would do the color code like: |cAARRGGBBText goes next|r Where AA is the alpha value ranging from 0 to 255 (hexadecimal), usually best to leave this at 255. Next is the red/blue/green each in hexadecimal as well followed by the text which is then followed by a |r
01-17-2007, 09:12 PM#6
WILL THE ALMIGHTY
OR just download the Magos model editor and look in Extras. it has a neato color code generator.
01-17-2007, 09:31 PM#7
darkened-angel
Thx a lot guys. Also is there a way to chance the angle of a build when i place it on map.
01-17-2007, 09:38 PM#8
WILL THE ALMIGHTY
I think you can set "default building facing angle" in the gameplay constants to -1, then the buildings can rotate freely.

I think.
01-17-2007, 09:44 PM#9
Av3n
... Or you can just create buildings...

-Av3n
01-17-2007, 09:49 PM#10
darkened-angel
Ok i wll tell you my issue and you can tell me how to fix it is possible. Ok so the build face West and the enemy come from th east so the attack animation shows on the west side firing at the east. So i am not sure how to fix it. If i could make the building face east that would work. Or when they attack the build would turn to fire and show the animation to the east.
01-18-2007, 03:19 AM#11
DioD
Code:
function ColoredName takes player Who returns string
    local string array Table   
    set Table[0]  = "|c00FF0303" 
    set Table[1]  = "|c000042FF" 
    set Table[2]  = "|c001CE6B9" 
    set Table[3]  = "|c00540081" 
    set Table[4]  = "|c00FFFC01"
    set Table[5]  = "|c00FEBA0E" 
    set Table[6]  = "|c0020C000"
    set Table[7]  = "|c00E55BB0"
    set Table[8]  = "|c00959697" 
    set Table[9]  = "|c007EBFF1" 
    set Table[10] = "|c00106246" 
    set Table[11] = "|c004E2A04"
    
    return Table[GetPlayerId(Who)] + GetPlayerName(Who) + "|r"
endfunction

function PlayerColor takes string Color returns player
    local string array Table
    local integer L = 0
    set Table[12]= StringCase(Color,true)
    set Table[0] =  "RED"
    set Table[1] =  "BLUE"
    set Table[2] =  "TEAL"
    set Table[3] =  "PURPLE"
    set Table[4] =  "YELLOW"
    set Table[5] =  "ORANGE"
    set Table[6] =  "GREEN"
    set Table[7] =  "PINK"
    set Table[8] =  "GRAY"
    set Table[9] =  "CYAN"
    set Table[10] = "AQUA"
    set Table[11] = "BROWN"
    loop
        exitwhen L > 11 or Table[12] == Table[L]
        set L = L + 1
    endloop
    if L == 12 then
        return null
    endif
    return Player(L)
endfunction

1) Takes player and returns its colored name
2) Takes color and returns player if color correct

for using with fixed player colors, eg player(0) is always red

second function will drop string case eg

PlayerColor("ReD") == PlayerColor("rEd")

but

PlayerColor(" ReD") != PlayerColor("ReD")

soo you have to filter strings before pass to this function
01-20-2007, 07:16 PM#12
darkened-angel
Yup i more rless did it that way. But gui based not jass. Because i don't know jass
01-20-2007, 07:26 PM#13
oNdizZ
Quote:
Originally Posted by darkened-angel
Thx a lot guys. Also is there a way to chance the angle of a build when i place it on map.

as in placing it in World Editor?
-place the building
-set the "Is a Building" boolean in the object editor, obviously on your building, to false.
-go back to the building in the main window
-double-click it
-change angle
-set the "Is a Building" boolean to true again.