1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Is it possible to merge two strings

Discussion in 'Skript' started by ImMeh, Jul 14, 2019.

  1. I

    ImMeh Member

    Joined:
    Jul 14, 2019
    Messages:
    3
    Likes Received:
    0
    Hello, I'm in the middle of making a chat color skript. I was wondering if it's possible to merge two strings like
    Code (Skript):
    1. set {chatcolor.%arg 1%} to "&"+"%arg 2%"
    Full code
    Code (Skript):
    1. command /chatcolor [<player>] [<text>]:
    2.    trigger:
    3.        if {rank.%player%} is "owner":
    4.            if arg 1 is not set:
    5.                send "{@p} &8» &7/chatcolor [player] [color]"
    6.                stop
    7.            if arg 2 is not set:
    8.                send "{@p} &8» &7/chatcolor [player] [color]"
    9.                stop
    10.            if arg 1 is set:
    11.                if arg 2 is set:
    12.                    set {chatcolor.%arg 1%} to "&"+"%arg 2%"
    13.        else:
    14.            send "{@p} &8» &7You are not allowed to do that"
     
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,879
    Likes Received:
    127
    try
    Code (Skript):
    1. set {chatcolor.%arg 1%} to "&%arg 2%"
     
  3. I

    ImMeh Member

    Joined:
    Jul 14, 2019
    Messages:
    3
    Likes Received:
    0
    Thanks for the reply but it didn't quite work.
    I use this for my chat
    Code (Skript):
    1. if {rank.%player%} is "default":
    2.        broadcast "&8Default &7%{name.%player%}% &8» %{chatcolor.%player%}%%message%"
    It says
    Default ImMeh » &3Test
     
  4. T

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    1,202
    Likes Received:
    69
    Medals:
    Use the colored expression on the full string
     
  5. I

    ImMeh Member

    Joined:
    Jul 14, 2019
    Messages:
    3
    Likes Received:
    0
    Like this
    Code (Skript):
    1. set {_message} to "%{chatcolor.%player%}%%message%"
    2. if {rank.%player%} is "default":
    3.    broadcast "&8Default &7%{name.%player%}% &8» %{_message}%"
    It doesn't work
     
    #5 ImMeh, Jul 14, 2019
    Last edited: Jul 14, 2019
  6. T

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    1,202
    Likes Received:
    69
    Medals:
    When you have a string where there is still a color code not formatted, so you can see the &3 for example, you need to use the colored expression (might be broken on 2.3.7/2.4-alpha4, build yourself if you want to fix that).
     
Loading...