Colour in Echo text.
Posted: 27 Jun 2011, 14:39
So I've been learning Lua recently, its been fine for the most part, but now this:
*These are just the important parts of my code.
R255 etc. are the player's colours in 0-255 (instead of 0-1 as given by Spring.teamColor)
**Originally I tried other methods, with the same result:
This is my latest attempt. It works as you would expect except the colour of the player name doesn't work properly.
As far as I can tell, it doesn't interpret the nameColorizer string in the same way as it does for messageColorizer (which makes the rest of the message white). Any ideas on how to get this to work?
Code: Select all
nameColorizer = string.format("\255\%s\%s\%s", R255, G255, B255)
messageColorizer = string.format("\255\255\255\255")
message1 = nameColorizer .. myPlayerName .. messageColorizer .. " has now sent " .. DM*10 .. " of his machines to metalhell"
Spring.Echo(message1)
R255 etc. are the player's colours in 0-255 (instead of 0-1 as given by Spring.teamColor)
**Originally I tried other methods, with the same result:
Code: Select all
nameColorizer = "\255\" .. R255 .. "\" .. G255.. "\" .. B255
As far as I can tell, it doesn't interpret the nameColorizer string in the same way as it does for messageColorizer (which makes the rest of the message white). Any ideas on how to get this to work?