Solved How can remove colorcode?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

TheRazorGod

Member
Jun 9, 2018
17
0
0
24
code_language.skript:
command /test <text>:
    trigger:
        set {_msg} to arg 1
        replace all "&1" with "" in {_msg}
        replace all "&2" with "" in {_msg}
        replace all "&3" with "" in {_msg}
        replace all "&4" with "" in {_msg}
        replace all "&5" with "" in {_msg}
        replace all "&6" with "" in {_msg}
        send "%{_msg}%"
This code not run.

How can remove color code?

Notes:
Skript: Bensku 2.2 (dev-25)
Server: 1.8.8 PaperSpigot​
 
This should work but for me not.. try it yourself:
code_language.skript:
command /test <text>:
    trigger:
        set {_msg} to uncoloured arg-1
        send "%{_msg}%" to player
Unless, try this, but you will need TUSKE addon:
code_language.skript:
command /test <text>:
    trigger:
        set {_msg} to arg-1
        regex replace "(§\d|§[a-fA-F])+$" with "" in {_msg}
        send "%{_msg}%" to player
 
Last edited:
The expression
code_language.skript:
uncolored %text%
should work fine (it works fine for me)
 
code_language.skript:
command /test <text>:
    trigger:
        set {_msg} to arg 1
        replace all "&1" with "" in {_msg}
        replace all "&2" with "" in {_msg}
        replace all "&3" with "" in {_msg}
        replace all "&4" with "" in {_msg}
        replace all "&5" with "" in {_msg}
        replace all "&6" with "" in {_msg}
        send "%{_msg}%"
This code not run.

How can remove color code?

Notes:
Skript: Bensku 2.2 (dev-25)
Server: 1.8.8 PaperSpigot​
TPGamesNL reply should work, anyways u need to replace "§" not "&", because skript actually converts "&" into "§"
 
Thank you for your help, but I have not solved the problem.
What I want to do is:
code_language.skript:
Player: /nick &a&lMyNick
The skript will record "arg 1"in a log.


In Log:
code_language.skript:
[2/11/16 6:37 PM] Player: TheRazorGod Nick: &a&lMyNick  RemovedColorCode: MyNick
 
Try this:
code_language.skript:
set {_msg} to uncolored colored arg-1
 
Thank you for your help, but I have not solved the problem.
What I want to do is:
code_language.skript:
Player: /nick &a&lMyNick
The skript will record "arg 1"in a log.


In Log:
code_language.skript:
[2/11/16 6:37 PM] Player: TheRazorGod Nick: &a&lMyNick  RemovedColorCode: MyNick
Try:
set {_log} to "Player: %player% Nick %arg-1% RemovedColorCode: %uncoloured arg-1%"
I Think that's what do you want to do.
 
MY Code:
code_language.skript:
command /nick [<text>]:
    permission: essentials.nick
    trigger:
        if arg 1 is not set:
            send "&8[&6Ikonia&8] &b/nick (New nickname"
            stop
        execute "SELECT id FROM Essentials_userdata WHERE player_name=%arg 1%" in {sql} and store the result in {_output::*}
        execute "SELECT nick FROM nickname WHERE nick=%arg 1%" in {sql} and store the result in {_nickname::*}
        if {_output::id::*} is set:
            send "&8[&6Ikonia&8] &bThis nick is used."
        else:
            if {_nickname::nick::*} is set:
                send "&8[&6Ikonia&8] &bThis nick is used."
            else:
                if arg 1 is "off":
                    execute console command "enick %player% %arg 1%"
                    execute "DELETE FROM nickname WHERE player_name =%name of player%" in {sql}   
                    stop   
                else:
                    set {_msg} to arg 1
                    execute "DELETE FROM nickname WHERE player_name =%name of player%" in {sql}   
                    execute console command "enick %player% %arg 1%"
                    execute "INSERT INTO nickname (`uuid`, `player_name`, `nick`, `nick_uncolored`) VALUES (%uuid of player%, %name of player%, %arg 1%, %{_msg}%)" in {sql}
                    stop

MySQL Image:
http://prntscr.com/juz4qg

I want this:
http://prntscr.com/juz4vr

 
MY Code:
code_language.skript:
command /nick [<text>]:
    permission: essentials.nick
    trigger:
        if arg 1 is not set:
            send "&8[&6Ikonia&8] &b/nick (New nickname"
            stop
        execute "SELECT id FROM Essentials_userdata WHERE player_name=%arg 1%" in {sql} and store the result in {_output::*}
        execute "SELECT nick FROM nickname WHERE nick=%arg 1%" in {sql} and store the result in {_nickname::*}
        if {_output::id::*} is set:
            send "&8[&6Ikonia&8] &bThis nick is used."
        else:
            if {_nickname::nick::*} is set:
                send "&8[&6Ikonia&8] &bThis nick is used."
            else:
                if arg 1 is "off":
                    execute console command "enick %player% %arg 1%"
                    execute "DELETE FROM nickname WHERE player_name =%name of player%" in {sql}  
                    stop  
                else:
                    set {_msg} to arg 1
                    execute "DELETE FROM nickname WHERE player_name =%name of player%" in {sql}  
                    execute console command "enick %player% %arg 1%"
                    execute "INSERT INTO nickname (`uuid`, `player_name`, `nick`, `nick_uncolored`) VALUES (%uuid of player%, %name of player%, %arg 1%, %{_msg}%)" in {sql}
                    stop

MySQL Image:
http://prntscr.com/juz4qg

I want this:
http://prntscr.com/juz4vr
You still don't using the uncoloured expression
Replace this (Line 20):
code_language.skript:
set {_msg} to arg 1
To this:
code_language.skript:
set {_msg} to uncoloured arg 1
 
Status
Not open for further replies.