Text Colors

09/27/2010 05:46 peterpiper99#1
Alright i've been trying to do this for a little bit but am not doing very well, here is what I got.

Code:
public static void SendMSG(string Name, string Colors, string Message, ushort ChatType, uint Mesh)
        {
            try
            {
                foreach (DictionaryEntry DE in H_Chars)
                {
                    Character C = (Character)DE.Value;
                    C.MyClient.AddSend(Packets.ChatMessage(C.MyClient.MessageID, Name, "ALL", Message, ChatType, Mesh));
                }
            }
            catch { }
        }
Code:
 static class Colors
    {
        public const uint
            Black = 0x00000000,
            White = 0x00FFFFFF,
            Red = 0x00FF0000,
            Blue = 0x0000FF00,
            Green = 0x000000FF,
            Yellow = 0x00FFFF00,
            Pink = 0x00FF00FF,
            Teal = 0x0000FFFF;
    }
And here is a test command I made:
Code:
if (Cmd[0] == "/testmsg")
                    {
                        Game.World.SendMSG("GM", Colors.Red, "Test Test Test Test Test Test Test Test", 2011, 0);
                    }
But the message still comes out normal. Can you tell me what I'm doing wrong? Thank you.
09/27/2010 06:25 Arcо#2
The hell?
uint Mesh is the color.
09/27/2010 06:27 pro4never#3
You are not even writing the chat color to the packet...

ChatMessage = your packet. There is no field for chat color input. You will have to add one to write the 4bytes that holds the RGB color info at the correct offset in the packet (if you don't know the offset I suggest in your command you actually ask for an offset.

Eg:

/testchat 16711935 offset

then change your packet so 16711935 is the uint32 representation of color (FF00FF) and offset is where in the packet it's being written to. Shouldn't take long at all to find the correct offset.


<edit>

or as arco apparently said. Write the color value to the mesh offset.
09/27/2010 07:05 peterpiper99#4
Quote:
Game.World.SendMsgToAll("GM", "Test Test Test Test Test Test Test Test", 2011, 0x00FF0000);
Didn't work, where can I get the colors?
09/27/2010 07:11 Arcо#5
Then you're doing it wrong.
Is that even the right hex for a color o.O
09/27/2010 07:13 peterpiper99#6
I couldn't have did it wrong, that's what I did right there ^^, just that command. Is anything wrong with it?
09/27/2010 12:45 Korvacs#7
Quote:
Originally Posted by Аrco View Post
Then you're doing it wrong.
Is that even the right hex for a color o.O
Conquer doesnt take a few set values, it takes a full argb value, of which any should be valid i beleive.
09/27/2010 16:21 peterpiper99#8
Does anyone know how I can get the colors?
09/27/2010 16:31 pro4never#9
Quote:
Originally Posted by peterpiper99 View Post
Does anyone know how I can get the colors?
They are hexidecimal

0-255 for red green and blue (0-ff). Use a html color chart or a rgb converter to get the rgb values for diff colors
09/27/2010 16:48 teroareboss1#10
its 4 bytes
Code:
        public static byte[] ChatMessage(uint MessageID, string From, string To, string Message, ushort Type, uint Mesh, [COLOR="Red"]System.Drawing.Color color[/COLOR])
        {
            byte[] Packet = new byte[8 + 34 + Message.Length + From.Length + To.Length];
            COPacket P = new COPacket(Packet);
            P.WriteUshortAddPos2((ushort)(Packet.Length - 8));
            P.WriteUshortAddPos2((ushort)0x3ec);
            [COLOR="Red"]P.WriteUintAddPos4((uint)color.ToArgb());[/COLOR]
Code:
        public void LocalMessage(ushort Type, System.Drawing.Color _color, string Message)
        {
            SendPacket(Packets.ChatMessage(MessageID, "SYSTEM", MyChar.Name, Message, Type, MyChar.Mesh, _color));
        }

GC.LocalMessage(2005, System.Drawing.Color.Red, "Test");
09/27/2010 17:47 peterpiper99#11
Quote:
Originally Posted by pro4never View Post
They are hexidecimal

0-255 for red green and blue (0-ff). Use a html color chart or a rgb converter to get the rgb values for diff colors
Can you give me an example?
09/27/2010 22:10 Arcо#12
Quote:
Originally Posted by peterpiper99 View Post
Can you give me an example?
......
Quote:
Originally Posted by pro4never View Post
Use a html color chart or a rgb converter to get the rgb values for diff colors
09/27/2010 23:11 peterpiper99#13
[Only registered and activated users can see links. Click Here To Register...]

I used tera's. But now I'm trying to do the /c command.

Quote:
if (Cmd[0] == "/c")
{
Game.World.SendMsgToAll(GC.MyChar.Name, ": " + Message.Remove(0, 3), 2011, 0);
}
But it uses the same packet.

Quote:
public static void SendMsgToAll(string Name, string Message, ushort ChatType, uint Mesh)
{
try
{
foreach (DictionaryEntry DE in H_Chars)
{
Character C = (Character)DE.Value;
C.MyClient.AddSend(Packets.ChatMessage(C.MyClient. MessageID, Name, "ALL", Message, ChatType, Mesh));
}
}
catch { }
}
Does anyone know how I could do this?
09/28/2010 02:39 Arcо#14
By sending the correct mesh, as I see you are setting the mesh as 0.
09/28/2010 04:53 peterpiper99#15
Quote:
Originally Posted by Аrco View Post
By sending the correct mesh, as I see you are setting the mesh as 0.
I don't understand that. What's an example of numbers, how many numbers?