Warcraft III resources & community, 2003–2006 · archived

ColorIntegerToColorString

not rated
Submitted by PepparConversion0 downloads
Converts color integer ci to a color string.

Source

function ColorIntegerToColorString takes integer ci returns string
    local string charMap = "0123456789abcdef"
    local string cs
    local integer c
    if ci < 0 then
        set ci = ci + 0x80000000
        set c = ci / 0x10000000 + 0x8
    else
        set c = ci / 0x10000000
    endif
    set cs = SubString(charMap, c, c + 1)
    set c = ModuloInteger(ci / 0x1000000, 16)
    set cs = cs + SubString(charMap, c, c + 1)
    set c = ModuloInteger(ci / 0x10, 16)
    set cs = cs + SubString(charMap, c, c + 1)
    set c = ModuloInteger(ci, 16)
    set cs = cs + SubString(charMap, c, c + 1)
    set c = ModuloInteger(ci / 0x1000, 16)
    set cs = cs + SubString(charMap, c, c + 1)
    set c = ModuloInteger(ci / 0x100, 16)
    set cs = cs + SubString(charMap, c, c + 1)
    set c = ModuloInteger(ci / 0x100000, 16)
    set cs = cs + SubString(charMap, c, c + 1)
    set c = ModuloInteger(ci / 0x10000, 16)
    return cs + SubString(charMap, c, c + 1)
endfunction

Comments

0

No comments.