So after my color gradient thing, I decided to improve my rainbow echoes, so I can get truly beautiful rainbow crit echoes. Came across some stuff in my gradient work and bookmarked it, and now I've finished it.
Comes in three types. Type 0, the default, starts from one random color, and slowly moves across the spectrum back to itself when it hits the last color. A smooth, single cycle rainbow effect. Looks great, my personal favorite for crits.
Type 1 gives you the option of setting a frequency. This is basically how big of a step in color each character should take. Lower numbers mean bigger steps. A freq of 1 (and looks like 2) are solid colors. 4 gets a nice random version of that gradient thing I wrote earlier. Higher numbers mean fewer colors shown in return for repeating that cycle across the string. Take a look at the examples.
Type 2 is the old, ugly version I used to use for my crits, and which I posted here a long while back. It's basically a hard-coded type 1 with not-great colors. The other two are much slicker. Kept it mostly because I hate throwing things away.
Called like such:
rainbow("Hey there") -- type 0
rainbow("Hey there", 1) -- type 1, freq is 15
rainbow("Hey there", 1, 5) -- type 1, freq is 5
rainbow("Hey there", 2) -- type 2, if you really must
Edit to add that, some might/be the same on that example. It's because of Lua's sucky random number generator, which is actually C's sucky random number generator, and even though I built in a better version to use I found in the Lua docs, it's still not going to be perfect. That said, you won't be able to tell unless you're rainbowing everything.
. Code below. Just throw in a script thing in Mudlet.