So I made an expression for rainbow text/words (Uses Skript-Mirror) and also did the same thing in a function (for those that dont want to use Skript-Mirror.
Just added an expression to create a string of random characters
[doublepost=1535059791,1534929763][/doublepost]Thanks to @KingAlterIV for changing one line in this.... which speeds up the expression/function quiet a bit. Based on my testing it's about 8 times faster.
Edited ... thanks to a suggestion by donut!
Just added an expression to create a string of random characters
Expression:
code_language.skript:
#!EXPRESSION -- Rainbow Words / Letters in text
expression rainbow [(1¦word[s]|2¦letter[s])] %string%:
get:
if parse mark is 1 or 0:
set {_col::*} to "&4" and "&c" and "&6" and "&e" and "&2" and "&a" and "&b" and "&9" and "&d" and "&5"
set {_newcol::*} to {_col::*}
set {_text::*} to expression-1 split at " "
loop {_text::*}:
if loop-value is not " ":
if {_newcol::*} is not set:
set {_newcol::*} to {_col::*}
set {_col} to first element of {_newcol::*}
set {_newword::%loop-index%} to "%{_col}%%loop-value%"
remove {_col} from {_newcol::*}
else:
set {_newword::%loop-index%} to loop-value
set {_newword} to join {_newword::*} with " "
return {_newword}
else if parse mark is 2:
set {_col::*} to "&4" and "&c" and "&6" and "&e" and "&2" and "&a" and "&b" and "&9" and "&d" and "&5"
set {_newcol::*} to {_col::*}
set {_text::*} to expression-1 split at ""
loop {_text::*}:
if loop-value is not " ":
if {_newcol::*} is not set:
set {_newcol::*} to {_col::*}
set {_col} to first element of {_newcol::*}
set {_newword::%loop-index%} to "%{_col}%%loop-value%"
remove {_col} from {_newcol::*}
else:
set {_newword::%loop-index%} to loop-value
set {_newword} to join {_newword::*} with ""
return {_newword}
code_language.skript:
#! Function for individually colored letters
function rainbowLetters(t: text) :: text:
set {_col::*} to "&4" and "&c" and "&6" and "&e" and "&2" and "&a" and "&b" and "&9" and "&d" and "&5"
set {_newcol::*} to {_col::*}
set {_text::*} to {_t} split at ""
loop {_text::*}:
if loop-value is not " ":
if {_newcol::*} is not set:
set {_newcol::*} to {_col::*}
set {_col} to first element of {_newcol::*}
set {_newword::%loop-index%} to "%{_col}%%loop-value%"
remove {_col} from {_newcol::*}
else:
set {_newword::%loop-index%} to loop-value
set {_newword} to join {_newword::*} with ""
return {_newword}
#! Function for colored words
function rainbowWord(t: text) :: text:
set {_col::*} to "&4" and "&c" and "&6" and "&e" and "&2" and "&a" and "&b" and "&9" and "&d" and "&5"
set {_newcol::*} to {_col::*}
set {_text::*} to {_t} split at " "
loop {_text::*}:
if loop-value is not " ":
if {_newcol::*} is not set:
set {_newcol::*} to {_col::*}
set {_col} to first element of {_newcol::*}
set {_newword::%loop-index%} to "%{_col}%%loop-value%"
remove {_col} from {_newcol::*}
else:
set {_newword::%loop-index%} to loop-value
set {_newword} to join {_newword::*} with " "
return {_newword}
code_language.skript:
#! SYNTAX
random string of %integer% [capital[ized]] character[s]
#! EXPRESSION - Random string of letters
expression random string of %integer% [(1¦capital[ized])] character[s]:
get:
set {_let} to "abcdefghijklmnopqrstuvwxyz"
set {_letters::*} to {_let} split at ""
loop expression-1 times:
add random element of {_letters::*} to {_newstring::*}
set {_newstring} to join {_newstring::*} by ""
if parse mark is 0:
return {_newstring}
if parse mark is 1:
return capitalized {_newstring}
#! EXAMPLE
command /random <integer> [<text>]:
trigger:
if arg-2 is not set:
send "&aTEST: %random string of arg-1 characters%"
else:
if arg-2 is "cap":
send "&aTEST: %random string of arg-1 capital characters%"
Last edited: