AgentGamerPro Posted September 28, 2020 Share Posted September 28, 2020 (edited) I've been having trouble with this, and i'm sure some other people have too. But after a while i finally got it running and working. Here it is. Rainbow chat! Most of the skript was made by Sorbon, but he never told us how to put them together, so i did. In addition, i made a custom /rbc command so you can type in rainbow. This is supported by RGB colors and is all plain skript. No addons like SkRayfall, SkQuery, nothing. Here is the skript, free to use. Again, credit goes to Sorbon. Spoiler 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} 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) Please let me know what you think of the skript. And if you see Sorbon, tell him I said hi :D EDIT: For some reason, you do need to be opped. At least for me. I have other lines in my skript that aren't supposed to be used in what im doing, so i don't know. The command works fine, it's the color that needs work EDIT 2: Thanks to Sorbon himself, the skript issue has been solved! No errors will appear any longer. The skript above has been changed. Edited October 1, 2020 by Agentgamer100YT New skript 1 Lifestealed | Minecraft Servers 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 - Present Link to comment Share on other sites More sharing options...
Sorbon Posted September 30, 2020 Share Posted September 30, 2020 Huhu, I updated the ColorUtils; https://forums.skunity.com/threads/colorutils-1-16.12134/ Has a new feature btw, the command in your example is intended one too much. Link to comment Share on other sites More sharing options...
aashumc Posted April 29, 2021 Share Posted April 29, 2021 it dont work..... it just dont work Link to comment Share on other sites More sharing options...
Migins Posted April 30, 2021 Share Posted April 30, 2021 If you need help please create another post rather than commenting on threads that have been inactive for over a month. ► Support July 29, 2020 → November 3, 2020 ► Helper November 3, 2020 → February 22, 2021 ► Moderator February 22, 2021 → May 17, 2021 ► I might not always respond to forum dms, however I am always contactable on discord (mig#0069) Link to comment Share on other sites More sharing options...
Recommended Posts