Jump to content

RBC skript EDIT by altfox


altfox

Recommended Posts


options:
    prefix: RainbowChat
    NoPerm Message: &nYou don't have permission for this command!

    ActivateMessage: &eRainbowChat has been enabled!
    DeactivateMessage: &eRainbowChat has been disabled

    ActivateOtherMessage: &e%player% has enabled your RainbowChat
    ActivateOtherMessagePlayer: &eYou have enabled %arg%'s RainbowChat

    DeactivateOtherMessage: &e%player% has disabled your RainbowChat
    DeactivateOtherMessagePlayer: &eYou have disabled %arg%'s RainbowChat

    # Rainbow Options:
    #Saturation is recommended to let it at 1

    # lightness allows you to make it brighter or darker. between 0 and 1
    # Stretch allows you to define how fast it changes the color, higher stretch, means faster changes
    # offset allows you to start at another color instead of Red (0)

    saturation: 1       # between 0 and 1
    lightness: 0.6      # between 0 and 1
    stretch: 5          # recommended not making it too high, looks ugly then 
    offset: 355           # This allows you to offset the color, 0-360

command rainbowchat [<player>]:
    trigger:
        # No Perm message, put here so i can use format the message
        send colored "&6[%rainbow2(""{@prefix}"")%&6]&r %gradient(""{@NoPerm Message}"",(150,0 and 0),(255,0 and 50))%" if player does not have permission "rainbow.use"
        player has permission "rainbow.use"

        if arg-1 is not set:
            if {rainbowchat::%player's uuid%} is true:
                set {rainbowchat::%player's uuid%} to false
                send colored "&6[%rainbow2(""{@prefix}"")%&6]&r {@DeactivateMessage}"
            else:
                set {rainbowchat::%player's uuid%} to true
                send colored "&6[%rainbow2(""{@prefix}"")%&6]&r {@ActivateMessage}"
        else:

            player has permission "rainbow.use.admin":
                if {rainbowchat::%arg-1's uuid%} is true:
                    set {rainbowchat::%arg-1's uuid%} to false
                    send colored "&6[%rainbow2(""{@prefix}"")%&6]&r {@DeactivateOtherMessage}" to arg
                    send colored "&6[%rainbow2(""{@prefix}"")%&6]&r {@DeactivateOtherMessagePlayer}"
                else:
                    set {rainbowchat::%arg-1's uuid%} to true
                    send colored "&6[%rainbow2(""{@prefix}"")%&6]&r {@ActivateOtherMessage}" to arg
                    send colored "&6[%rainbow2(""{@prefix}"")%&6]&r {@ActivateOtherMessagePlayer}"
            else:
                send colored "&6[%rainbow2(""{@prefix}"")%&6]&r %gradient(""{@NoPerm Message}"",(150,0 and 0),(255,0 and 50))%"

on load:
    set {hex::*} to "0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","k","l","m","n" and "o"
    

function rgbToHex(values: numbers) :: string:
    loop {_values::*}:
        set {_r} to "%{_r} ? ""<##""%%{hex::%(( (round(loop-value)) - mod((round(loop-value)), 16)) / 16 + 1)%} ? """"%%{hex::%mod((round(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)
    broadcast "%{_h}% %{_s}% %{_l}% %round(min(255, (255 * {_g})))%" if round(min(255, (255 * {_b}))) > 255
    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 ({_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:
    {rainbowchat::%player's uuid%} is true
    set message to rainbow2(message,{@saturation},{@lightness},{@stretch},{@offset}) if player does not have permission "rainbow.use.format" , else "%rainbow2(colored message,{@saturation},{@lightness},{@stretch},{@offset})% "

Link to comment
Share on other sites

On 12/31/2020 at 6:40 PM, altfox said:


options:
    prefix: RainbowChat
    NoPerm Message: &nYou don't have permission for this command!

    ActivateMessage: &eRainbowChat has been enabled!
    DeactivateMessage: &eRainbowChat has been disabled

    ActivateOtherMessage: &e%player% has enabled your RainbowChat
    ActivateOtherMessagePlayer: &eYou have enabled %arg%'s RainbowChat

    DeactivateOtherMessage: &e%player% has disabled your RainbowChat
    DeactivateOtherMessagePlayer: &eYou have disabled %arg%'s RainbowChat

    # Rainbow Options:
    #Saturation is recommended to let it at 1

    # lightness allows you to make it brighter or darker. between 0 and 1
    # Stretch allows you to define how fast it changes the color, higher stretch, means faster changes
    # offset allows you to start at another color instead of Red (0)

    saturation: 1       # between 0 and 1
    lightness: 0.6      # between 0 and 1
    stretch: 5          # recommended not making it too high, looks ugly then 
    offset: 355           # This allows you to offset the color, 0-360

command rainbowchat [<player>]:
    trigger:
        # No Perm message, put here so i can use format the message
        send colored "&6[%rainbow2(""{@prefix}"")%&6]&r %gradient(""{@NoPerm Message}"",(150,0 and 0),(255,0 and 50))%" if player does not have permission "rainbow.use"
        player has permission "rainbow.use"

        if arg-1 is not set:
            if {rainbowchat::%player's uuid%} is true:
                set {rainbowchat::%player's uuid%} to false
                send colored "&6[%rainbow2(""{@prefix}"")%&6]&r {@DeactivateMessage}"
            else:
                set {rainbowchat::%player's uuid%} to true
                send colored "&6[%rainbow2(""{@prefix}"")%&6]&r {@ActivateMessage}"
        else:

            player has permission "rainbow.use.admin":
                if {rainbowchat::%arg-1's uuid%} is true:
                    set {rainbowchat::%arg-1's uuid%} to false
                    send colored "&6[%rainbow2(""{@prefix}"")%&6]&r {@DeactivateOtherMessage}" to arg
                    send colored "&6[%rainbow2(""{@prefix}"")%&6]&r {@DeactivateOtherMessagePlayer}"
                else:
                    set {rainbowchat::%arg-1's uuid%} to true
                    send colored "&6[%rainbow2(""{@prefix}"")%&6]&r {@ActivateOtherMessage}" to arg
                    send colored "&6[%rainbow2(""{@prefix}"")%&6]&r {@ActivateOtherMessagePlayer}"
            else:
                send colored "&6[%rainbow2(""{@prefix}"")%&6]&r %gradient(""{@NoPerm Message}"",(150,0 and 0),(255,0 and 50))%"

on load:
    set {hex::*} to "0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","k","l","m","n" and "o"
    

function rgbToHex(values: numbers) :: string:
    loop {_values::*}:
        set {_r} to "%{_r} ? ""<##""%%{hex::%(( (round(loop-value)) - mod((round(loop-value)), 16)) / 16 + 1)%} ? """"%%{hex::%mod((round(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)
    broadcast "%{_h}% %{_s}% %{_l}% %round(min(255, (255 * {_g})))%" if round(min(255, (255 * {_b}))) > 255
    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 ({_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:
    {rainbowchat::%player's uuid%} is true
    set message to rainbow2(message,{@saturation},{@lightness},{@stretch},{@offset}) if player does not have permission "rainbow.use.format" , else "%rainbow2(colored message,{@saturation},{@lightness},{@stretch},{@offset})% "

1. Please use the code block or pastebin instead of pasting your skript into the post.

2. Post skripts in skript releases

3. This is alot like a rainbow chat skript by @Sorbon

Edited by AgentGamerPro

 

 

image.png.bc433d6489d70ad831075fe76809b993.png
 

Owner of Lifestealed, Labs, 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...