Solved Help with making a moving gradient for a name.

  • 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!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.
Jun 11, 2020
14
0
1
56
Hello.
I would like to have a rainbow-ish coloured name tag in my Minecraft server.
For example, my name tag would be:
WilliamPlays0402
0.5s later:
WilliamPlays0402
0.5s later:
WilliamPlays0402
etc..

This is what I've achieved so far:
Code:
every 5 tick:
  add 1 to {60ticktime}
  if {60ticktime} is greater than 9:
    set {60ticktime} to 1

function rainbowName(t: text, n: integer) :: text:
  set {_stages::*} to "<##fa3ca8>", "<##ff42ec>", "<##f242ff>", "<##c942ff>", "<##aa42ff>", "<##c942ff>", "<##f242ff>", "<##ff42ec>" and "<##fa3ca8>"
  if {_n} is greater than 10:
    set {_modifier} to mod({_n},10)
  else:
    set {_modifier} to {_n}
  set {_output} to "%{_stages::%{_modifier}%}%%{_t}%"
  return {_output}
every 2 ticks:
  loop all players:
    if loop-player has permission "op":
      set {_rb} to rainbowName("", {60ticktime})
      set {_header} to "%{_rb}% "
    set loop-player's tab list name to "%{_header}%%loop-player%

The only problem is that I do not know how to split the player's name's letters into a list variable. From there I can just loop through the list variable, add 1 to a modifier on the function for each letter, and add that to a variable that can replace "%loop-player%".

Any help is appreciated.

Additional info:
- Skript Version: 2.6-beta2
- Minecraft Version: 1.16.5
 
Maybe you can do something with that, it kinda splits the letters
Code:
set {_alphabet::*} to split "message" by ""
set {_message} to ""
loop {_alphabet::*}:
    set {_message} to "%{_message}%%loop-value%"
    send "%{_message}%
 
I am having a problem, {ticktime} and {_time} do not add together:

Code:
function gradientify(t: text) :: text:
  set {_alphabet::*} to split {_t} by ""
  set {_message} to ""
  set {_e} to 0
  loop {_alphabet::*}:
    add 1 to {_e}
    if {_e} is greater than 9:
      set {_e} to 1
    set {_time} to {_e}+{ticktime}
    set {_output} to rainbowName("%loop-value%", {_time})
    set {_message} to "%{_message}%%{_output}%"
  set {_out} to {_message}
  return {_out}


every 5 tick:
  add 1 to {ticktime}
  if {ticktime} is greater than 9:
    set {ticktime} to 1

function rainbowName(t: text, n: integer) :: text:
  set {_stages::*} to "<##fa3ca8>", "<##ff42ec>", "<##f242ff>", "<##c942ff>", "<##aa42ff>", "<##c942ff>", "<##f242ff>", "<##ff42ec>" and "<##fa3ca8>"
  if {_n} is greater than 10:
    set {_modifier} to mod({_n},10)
  else:
    set {_modifier} to {_n}
  set {_output} to "%{_stages::%{_modifier}%}%%{_t}%"
  return {_output}
[doublepost=1627582737,1627579284][/doublepost]Ok, I found a solution that works, but barely. There is some problems still with the animation. Here is the code:

Code:
function gradientify(t: text, ti: integer) :: text:
  set {_alphabet::*} to split {_t} by ""
  set {_message} to ""
  set {_e} to 0
  loop {_alphabet::*}:
    add 1 to {_count}
    if {_count} is greater than 9:
      set {_count} to 1
    set {_time} to round(({_count}+{_ti}-2)/2)
    set {_output} to rainbowName("%loop-value%", {_time})
    set {_message} to "%{_message}%%{_output}%"
  return "%{_message}%"


every 5 tick:
  add 1 to {rainbow}
  if {rainbow} is greater than 20:
    set {rainbow} to 2
 
 

function rainbowName(t: text, n: integer) :: text:
  set {_stages::*} to "<##fa3ca8>", "<##ff42ec>", "<##f242ff>", "<##c942ff>", "<##aa42ff>", "<##c942ff>", "<##f242ff>", "<##ff42ec>" and "<##fa3ca8>"
  if {_n} is greater than 9:
    set {_modifier} to mod({_n},9)
    if {_modifier} is 0:
      set {_modifier} to 1
  else:
    set {_modifier} to {_n}
  set {_output} to "%{_stages::%{_modifier}%}%%{_t}%"
  return {_output}
 
Status
Not open for further replies.