Jump to content

Rainbow Chat Toggle Nonfunctional


Pryzmm

Recommended Posts

I'm trying to make a command that toggles rainbow chat (i already have the skript) but it wont work. please help.

The Error:

The 1st argument given to the function 'rainbow' is not of the required type text. Check the correct order of the arguments and put lists into parentheses if appropriate (e.g. 'give(player,(iron ore and gold ore))'). Please note that storing the value in a variable and then using that variable as parameter will suppress this error, but it still won't work. (Rainbow Chat.sk, line 169: make player say colored rainbow(colored text)')

The Skript:

command /rbctoggle:
    permission: Skript.Rbc
    permission message: &8&l[&6&lColor&8&l] &c&lError: &4You don't have the required permission to perform this command
    trigger:
        if {RBC} is not set:
            set {RBC} to true
            send "&aRainbow Chat Has Been Enabled!"
        else:
            clear {RBC}
            send "&cRainbow Chat Has Been Disabled!"

on chat:
    if {RBC} is true:
        set {text} to text
        make player say colored rainbow(colored text)

 

 

image.png.bc433d6489d70ad831075fe76809b993.png
 

Owner of Lifestealed, Exploratory, Encore, UNOfficially and Observed
 

OG [VIP] 12/26/20 - 10/27/2021
OG [PRO] 12/27/21 - 11/18/2022
OG [LEGEND] 11/18/2022 - 3/14/2023
[DEFAULT] 3/14/2023 - 5/8/2024

[MOD] 5/8/2024 - Present

 

Link to comment
Share on other sites

What is the function you used? Make sure the first parameter in the function is text. Maybe try just message as the parameter in the function. 

Discord - tarna256

In-game name - _Tarna_

Website - https://tarna.dev
Paste Site: https://paste.tarna.dev

---------------------------------------------------------

[VIP] - 7/27/2020

Community Support - 7/8/20 | 11/3/20

Helper  - 11/3/20 - 2/21/21

Moderator - 2/21/21 - 5/17/21

❤️ - 5/17/21 - now

Moderator - 12/20/22 - now

---------------------------------------------------------

image.png.70849a9b84e0347ce107b8e3eaee312c.pngimage.png.2111009afbd8bef10966ba9ede35a199.png

Link to comment
Share on other sites

I think when i tried to replace (colored text) with (message) it crashed my server @_Tarna_ Here is the whole skript:

What I Changed Is On The Last Line:

Spoiler

options:
    c: {chatcolor.%player%}
    n: {name.%player%}
 
on join:
    if {chatcolor.%player%} is not set:
        set {chatcolor.%player%} to "&8"
    if {name.%player%} is not set:
        set {name.%player%} to "&7"

on load:
    set {hex::*} to split "0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|k|l|m|n|o|r" at "|"
function rgbToHex(values: numbers) :: string:
    loop {_values::*}:
        set {_r} to "%{_r} ? ""<##""%%{hex::%((loop-value - mod(loop-value, 16)) / 16 + 1)%} ? """"%%{hex::%mod(loop-value, 16) + 1%} ? """"%"
    return colored "%{_r}%>"
function hslToRgb(h: number, s: number, l: number) :: integers: #
    set {_h} to {_h}/360
    if {_s} = 0:
        set {_r}, {_g} and {_b} to {_l}
    else:
        set {_q} to (({_l} * ({_s} + 1)) if {_l} < 0.5, else ({_l} + {_s} - {_l} * {_s}))
        set {_p} to (2 * {_l}) - {_q}
        set {_r} to hueToRgb({_p}, {_q}, {_h} + 1 / 3)
        set {_g} to hueToRgb({_p}, {_q}, {_h})
        set {_b} to hueToRgb({_p}, {_q}, {_h} - 1 / 3)
    return round(min(255, (255 * {_r}))), round(min(255, (255 * {_g}))) and round(min(255, (255 * {_b})))
function hueToRgb(p: number, q: number, t: number) :: number:
    add 1 to {_t} if {_t} < 0
    remove 1 from {_t} if {_t} > 1
    return {_p} + ({_q} - {_p}) * 6 * {_t} if {_t} < 1 / 6
    return {_q} if {_t} < 1/2
    return {_p} + ({_q} - {_p}) * (2 / 3 - {_t}) * 6 if {_t} < 2 / 3
    return {_p}
function gradient(input: string, color-from: integers, color-to: integers) :: string:
    loop {_color-from::*}:
        set {_i::%loop-index%} to round(({_color-to::%loop-index%} - loop-value) / length of {_input})
    loop length of {_input} times:
        if subtext of {_input} from indices loop-number - 1 to loop-number - 1 = "§":
            set {_format} to "%{_format} ? """"%&%subtext of {_input} from indices loop-number to loop-number%" if {hex::*} contains subtext of {_input} from indices loop-number to loop-number
            clear {_format} if subtext of {_input} from indices loop-number to loop-number = "r"
            continue loop
        set {_r} to "%{_r} ? """"%%rgbToHex({_color-from::*})%%{_format} ? """"%%subtext of {_input} from indices loop-number to loop-number%"
        set {_color-from::*} to ({_color-from::1} + {_i::1}), ({_color-from::2} + {_i::2}) and ({_color-from::3} + {_i::3})
    return colored {_r}
function rainbow(input: string, saturation: number = 1, lightness: number = 0.5) :: string:
    loop (length of {_input}) times:
        if subtext of {_input} from indices loop-number - 1 to loop-number - 1 = "§":
            set {_format} to "%{_format} ? """"%&%subtext of {_input} from indices loop-number to loop-number%" if {hex::*} contains subtext of {_input} from indices loop-number to loop-number
            clear {_format} if subtext of {_input} from indices loop-number to loop-number = "r"
            continue loop
        set {_l} to 360 / (length of {_input})
        set {_r} to "%{_r} ? """"%%rgbToHex(hslToRgb((loop-number * ({_l} if loop-number != 1, else 1)), {_saturation}, {_lightness}))%%{_format} ? """"%%subtext of {_input} from indices loop-number to loop-number%"
    return colored {_r}
function rainbow2(input: string, saturation: number = 1, lightness: number = 0.5, stretch: number = 5, offset: number = 0) :: string:
    loop (length of {_input}) times:
        # ---- Remove the part below to remove color formatting  
        if subtext of {_input} from indices loop-number - 1 to loop-number - 1 = "§":
            set {_format} to "%{_format} ? """"%&%subtext of {_input} from indices loop-number to loop-number%" if {hex::*} contains subtext of {_input} from indices loop-number to loop-number
            clear {_format} if subtext of {_input} from indices loop-number to loop-number = "r"
            continue loop
        # ---- Remove the part above to remove color formatting  
        set {_l} to loop-number * {_stretch}+{_offset} if loop-number*{_stretch}+{_offset} <= 360, else mod(loop-number*{_stretch}+{_offset}, 360)
        set {_r} to "%{_r} ? """"%%rgbToHex(hslToRgb({_l}, {_saturation}, {_lightness}))%%{_format} ? """"%%subtext of {_input} from indices loop-number to loop-number%"
    return colored {_r}
       
on chat:
    cancel event
    broadcast "%{name.%player%}%%player's display name%: %{chatcolor.%player%}%%message%"
   
command /color [<text>]:
    aliases: /c
    permission: Color.Text
    permission message: &8&l[&6&lColor&8&l] &c&lHey! &r&4Sorry but you are not allowed to use this command!
    trigger:
        if arg-1 is not set:
            send "&8&l[&6&lColor&8&l] &6/color &0Black, &1Blue, &2DarkGreen, &3DarkAqua, &4DarkRed, &5DarkPurple, &6Gold, &7Gray, &8DarkGray, &9Blue, &aGreen, &bAqua, &cRed, &dLightPurple, &eYellow, &fWhite, &lBold&r, &oItalic&r, &nUnderline&r, &mStrike&r, &kMagic &r(Magic)" to player
            stop
        set {_check} to "%{@c}%"
        set {@c} to "" if arg-1 is "Clear", "Reset" or "Default"
        set {@c} to "&0" if arg-1 is "Black" or "&0"
        set {@c} to "&1" if arg-1 is "DarkBlue" or "&1"
        set {@c} to "&2" if arg-1 is "DarkGreen" or "&2"
        set {@c} to "&3" if arg-1 is "DarkAqua" or "&3"
        set {@c} to "&4" if arg-1 is "DarkRed" or "&4"
        set {@c} to "&5" if arg-1 is "DarkPurple" or "&5"
        set {@c} to "&6" if arg-1 is "Gold" or "&6"
        set {@c} to "&7" if arg-1 is "Gray" or "&7"
        set {@c} to "&8" if arg-1 is "DarkGray" or "&8"
        set {@c} to "&9" if arg-1 is "Blue" or "&9"
        set {@c} to "&a" if arg-1 is "Green" or "&a"
        set {@c} to "&b" if arg-1 is "Aqua" or "&b"
        set {@c} to "&c" if arg-1 is "Red" or "&c"
        set {@c} to "&d" if arg-1 is "LightPurple" or "&d"
        set {@c} to "&e" if arg-1 is "Yellow" or "&e"
        set {@c} to "&f" if arg-1 is "White" or "&f"
        set {@c} to "%{@c}%&l" if arg-1 is "Bold" or "&b"
        set {@c} to "%{@c}%&o" if arg-1 is "Italics" or "&o"
        set {@c} to "%{@c}%&n" if arg-1 is "Underline" or "&n"
        set {@c} to "%{@c}%&m" if arg-1 is "Strike" or "&m"
        set {@c} to "%{@c}%&k" if arg-1 is "Magic" or "&k"
        replace all "&l" in {@c} with "" if {@c} contains "&l&l"
        replace all "&o" in {@c} with "" if {@c} contains "&o&o"
        replace all "&n" in {@c} with "" if {@c} contains "&n&n"
        replace all "&m" in {@c} with "" if {@c} contains "&m&m"
        replace all "&k" in {@c} with "" if {@c} contains "&k&k"
        send "&8&l[&6&lColor&8&l] &cError. Invalid color!" to player if {_check} is "%{@c}%"

command /name [<text>]:
    aliases: /n
    trigger:
        if arg-1 is not set:
            send "&8&l[&6&lColor&8&l] &6/name &0Black, &1Blue, &2DarkGreen, &3DarkAqua, &4DarkRed, &5DarkPurple, &6Gold, &7Gray, &8DarkGray, &9Blue, &aGreen, &bAqua, &cRed, &dLightPurple, &eYellow, &fWhite, &lBold&r, &oItalic&r, &nUnderline&r, &mStrike&r, &kMagic &r(Magic)" to player
            stop
        set {_check} to "%{@n}%"
        set {@n} to "" if arg-1 is "Clear", "Reset" or "Default"
        set {@n} to "&0" if arg-1 is "Black" or "&0"
        set {@n} to "&1" if arg-1 is "DarkBlue" or "&1"
        set {@n} to "&2" if arg-1 is "DarkGreen" or "&2"
        set {@n} to "&3" if arg-1 is "DarkAqua" or "&3"
        set {@n} to "&4" if arg-1 is "DarkRed" or "&4"
        set {@n} to "&5" if arg-1 is "DarkPurple" or "&5"
        set {@n} to "&6" if arg-1 is "Gold" or "&6"
        set {@n} to "&7" if arg-1 is "Gray" or "&7"
        set {@n} to "&8" if arg-1 is "DarkGray" or "&8"
        set {@n} to "&9" if arg-1 is "Blue" or "&9"
        set {@n} to "&a" if arg-1 is "Green" or "&a"
        set {@n} to "&b" if arg-1 is "Aqua" or "&b"
        set {@n} to "&c" if arg-1 is "Red" or "&c"
        set {@n} to "&d" if arg-1 is "LightPurple" or "&d"
        set {@n} to "&e" if arg-1 is "Yellow" or "&e"
        set {@n} to "&f" if arg-1 is "White" or "&f"
        set {@n} to "%{@n}%&l" if arg-1 is "Bold" or "&b"
        set {@n} to "%{@n}%&o" if arg-1 is "Italics" or "&o"
        set {@n} to "%{@n}%&n" if arg-1 is "Underline" or "&n"
        set {@n} to "%{@n}%&m" if arg-1 is "Strike" or "&m"
        set {@n} to "%{@n}%&k" if arg-1 is "Magic" or "&k"
        replace all "&l" in {@n} with "" if {@n} contains "&l&l"
        replace all "&o" in {@n} with "" if {@n} contains "&o&o"
        replace all "&n" in {@n} with "" if {@n} contains "&n&n"
        replace all "&m" in {@n} with "" if {@n} contains "&m&m"
        replace all "&k" in {@n} with "" if {@n} contains "&k&k"
        send "&8&l[&6&lColor&8&l] &cError. Invalid color!" to player if {_check} is "%{@n}%"

command /rbc [<text>]:
    permission: Skript.Rbc
    permission message: &8&l[&6&lColor&8&l] &c&lError: &4You don't have the required permission to perform this command
    trigger:
        if arg-1 is not set:
            send "&8&l[&6&lColor&8&l] &c&lError: &4Please say what you want to say in chat!"
        else if arg-1 is set:
            set {text} to arg-1
            make player say colored rainbow(colored arg-1)

command /rbctoggle:
    permission: Skript.Rbc
    permission message: &8&l[&6&lColor&8&l] &c&lError: &4You don't have the required permission to perform this command
    trigger:
        if {RBC} is not set:
            set {RBC} to true
            send "&aRainbow Chat Has Been Enabled!"
        else:
            clear {RBC}
            send "&cRainbow Chat Has Been Disabled!"

on chat:
    if {RBC} is true:
        set {text} to text
        make player say colored rainbow(message)

 

 

 

image.png.bc433d6489d70ad831075fe76809b993.png
 

Owner of Lifestealed, Exploratory, Encore, UNOfficially and Observed
 

OG [VIP] 12/26/20 - 10/27/2021
OG [PRO] 12/27/21 - 11/18/2022
OG [LEGEND] 11/18/2022 - 3/14/2023
[DEFAULT] 3/14/2023 - 5/8/2024

[MOD] 5/8/2024 - Present

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...