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 out 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.

A command which sends a message with randomized colors every time

Discussion in 'Skript' started by KroterPvP, Jul 8, 2017.

Thread Status:
Not open for further replies.
  1. KroterPvP

    KroterPvP Active Member

    Joined:
    Apr 10, 2017
    Messages:
    178
    Likes Received:
    7
    Hello, I'm trying to do code a command which sends a message with ramdonized colors. Every time a player executes the command, it sends a message with a random color. How can I do this?

    I tried using this, but I can't fix it. I don't know how to make skript read it as color and not as text, because the expresion parsed as color can't be used here.
    Code (Skript):
    1.  
    2.         set {_&} to "1|2|3|4|5|6|7|8|9|0|a|b|c|d|e|f"
    3.         set {_x::*} to {_&} split at "|"
    4.         set {_&x} to "%random element out of {_x::*}%"
    5.         send "&%{_&x}%-------------------------------"
    6.  
    The message apears like that: "&x -------------------------------"
    (The x is replaced with a color code)
     
    #1 KroterPvP, Jul 8, 2017
    Last edited: Jul 8, 2017
  2. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    Try this

    Code (Skript):
    1. %colored &%{_&x}%
     
  3. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    do better
    Code (Skript):
    1.         set {_&} to "&1|&2|&3|&4|&5|&6|&7|&8|&9|&0|&a|&b|&c|&d|&e|&f"
    2.         set {_x::*} to {_&} split at "|"
    3.         set {_&x} to "%random element out of {_x::*}%"
    4.         send "%colored {_&x}%-------------------------------"
     
  4. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    Code (Skript):
    1. return colored "<%a random element out of all enum values of color%>"
     
  5. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    you don't need make it harders. >_<
     
  6. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    Forgive me because I cannot add tabs on my phone but, this should work.

    Code (Skript):
    1. Command /text:
    2. Trigger:
    3. Set {_&} to 0 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or a or b or c or d or e or f
    4.  
     
  7. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    That's literally easier
     
  8. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    for you maybe. :emoji_grinning: for new guys or like me... (I don't like the code what you did D: )
     
Thread Status:
Not open for further replies.

Share This Page

Loading...