Color chat for custom messages in world

AtomSeis

New member
Joined
Sep 2, 2023
Messages
4

The Code​

Image​

1705507095963.png1705507099875.png
1705507103534-png.564
1705490174833.png
The cancel event and send message is omitted from the table

Pseudocode​

Player Event Chat Message
{
‎ ‎ ‎ ‎ Game Action Cancel Event;

‎ ‎ ‎ ‎ // In set variable block, go to General>>Set Variable
‎ ‎ ‎ ‎ Dynamic Variable World_ToReplace = "&";
‎ ‎ ‎ ‎ // Replace "&" above with any character you want

‎ ‎ ‎ // In set variable block, go to Text>>Replace Characters In Text
‎ ‎ ‎ ‎ Set Variable Replace Chars
‎ ‎ ‎ ‎ (
‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ Dynamic Variable %player%msg_color,
‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ Game Value Player Message,
‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ Dynamic Variable World_ToReplace,
‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ Text "&"
‎ ‎ ‎ ‎ );

‎ ‎ ‎ ‎ // In set variable block, go to Text>>Combine Text
‎ ‎ ‎ ‎ Set Variable Combine Text
‎ ‎ ‎ ‎ (
‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ Dynamic Variable %player%msg_out,
‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ Switch Text Separation = No seperation,
‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ Text "%player &8» &f",
‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ Dynamic Variable %player%msg_color
‎ ‎ ‎ ‎ );
‎ ‎ ‎ ‎ // In player action block, go to Communication>>Send Message
‎ ‎ ‎ ‎ Player Action Send Message ALL (%player%msg_color);

}
You may also customize the color code tag as shown in the code above. For example, you can have "\" as a color code tag.
&bblue hair = blue hair
\bblue hair = blue hair

How it works​

When a player sends a message with color codes, the message content is accessible through Game Value Player's
Message. The content of the message in the game value is raw text (meaning, no color, strikethrough, etc). This also
means the color code tag '&' in the message is in the game value

The Set Variable functions however, does take into account the color code formatting. By replacing color code tag
"&" (or anything else you would like, example "\") with "&", it will properly parse the color code and show the color
Happy coding!

Been almost two years since I last did a guide (quality a bit bad), hi again
 

Attachments

  • 1705507103534.png
    1705507103534.png
    16.2 KB · Views: 23

Aalus

Big Bandar
Joined
May 20, 2023
Messages
455

The Code​

Image​

View attachment 556
The cancel event and send message is omitted from the table

Pseudocode​


You may also customize the color code tag as shown in the code above. For example, you can have "\" as a color code tag.

How it works​

When a player sends a message with color codes, the message content is accessible through Game Value Player's
Message. The content of the message in the game value is raw text (meaning, no color, strikethrough, etc). This also
means the color code tag '&' in the message is in the game value

The Set Variable functions however, does take into account the color code formatting. By replacing color code tag
"&" (or anything else you would like, example "\") with "&", it will properly parse the color code and show the color
Happy coding!

Been almost two years since I last did a guide (quality a bit bad), hi again
When did you join the ML Forums
 
Top