Skript: Code colors in the chat

Created on 4 Nov 2017  路  14Comments  路  Source: SkriptLang/Skript

Hello, With Skript, when a player stands out for example "&c" in the chat, the message is transformed with the color code that goes with it. Would it be possible to have an option to deactivate that ? I would like that colors are not available in the chat, for example: when the player wants to write "&cTest" it marks "&cTest" and not "test". (with the red color)
I would not want that the players can have access to colors. :/

My skript version : 2.2-dev28c

bug completed low

All 14 comments

If you do uncolored %text% it will not use the formatting codes, but they will still be parsed so for example send uncolored "&cTest" will still send as just "Test" without the &c, but it will be colored white. Does that work for your needs or do you really need it to still display the code?

In fact, I would want that the players cannot utilser colors in the chat, here is my code of chat: http://prntscr.com/h6cw1v

When I use the "uncolored message " that makes for me really discolor all the message, there is no way means to discolor only the message ? (Except the mentions)

You don't have to do it on the whole message, you can do it to any piece of text, so in your case, you'd probably update the line where you set {_message} to:

set {_message} to "%uncolored message%"

That way any formatting you do yourself is preserved but their message is uncolored before you do stuff to it, removing the color codes.

Here we are, I used as said higher " %uncolored message% ", but it does not still work :/

My code: http://prntscr.com/h6dhve

Screen (When i put "&cTest" in the chat) : http://prntscr.com/h6di89

dev28 is broken... especially about chat https://github.com/bensku/Skript/releases

Good catch, I missed that this was dev28. You should try updating.

I took the last version of skript, and always the same problem :/

@Vulc4n Please send your server version (/ver) and full on chat event with https://hastebin.com.
Also make sure about Skript version with /ver Skript.

Weird... Looks like it should work. Remove the on chat event fully and try this to see what happens:

on chat:
    cancel event
    loop all players:
        message "&7%player%&r : &f%uncolored message%" to loop-value

Can someone test this and verify if this is still an issue?

It still exists but it's not really an issue, it's more of an issue with how it's inputted, because

on chat:
    cancel event
    loop all players:
        set {_message} to "&7%player%&r : &f%uncolored message%"
        message {_message} to loop-player

This will provide the exact string that was being looked for in this issue.

For anyone confused on the issue: Skript will parse %uncoloured message% normally like &a&lStuff but when it gets inserted into the message effect, it gets re-parsed again and the colours return.

I think this is just a user error and should be closed as there is no clean way to fix this without testing if the uncoloured expression is contained within the given string expression, or removing it completely from parsing like this, or making a Utility class to check if the uncoloured expression is contained in the string.

The variable doesn't check for colours after the uncoloured message was placed and gives its raw input for the message effect, where as if a string is defined the message effect will parse the string, another option could be removing this automatic parsing and just make the user do %coloured message% then it gets stupid aswell.

All of which shouldn't be cared for.

Fixed with the recent chat updates if I'm not wrong...

Using

on chat:
    cancel event
    loop all players:
        set {_message} to "&7%player%&r : &f%uncolored message%"
        message {_message} to loop-player

And typing in
image

Will yield
image

Showing that %uncolored message% is now fixed.
Tested using Skript 2.4-beta5
@TheBentoBox close?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Eryk1983S picture Eryk1983S  路  3Comments

Anoniempje1234 picture Anoniempje1234  路  3Comments

GiraffeCubed picture GiraffeCubed  路  3Comments

Romitou picture Romitou  路  3Comments

ghost picture ghost  路  3Comments