Lua Newbie - Need help finishing script

Posted by CrazyPaladin on Thu 22 Mar 2018 07:09 PM — 3 posts, 13,998 views.

#0
So I found this script to randomize color on an input string, but I need to be able to end it with a "return to normal" color code. The input I need to add at the end of the send is: `w

Here is what I have so far:

<aliases>
  <alias
   match="^rand (.+?) (.+)$"
   enabled="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>local randcolors = {
   "`b", 
   "`c",
   "`g",
   "`m",
   "`y",
   "`w",
   "`r",
   "`B",
   "`C",
   "`G",
   "`M",
   "`Y",
   "`W",
   "`R",
   "`N",
 }

local message = "%2"

local s = ""

for i = 1, #message do
  s = s .. randcolors  [math.random (1, #randcolors)] .. message:sub (i, i)
end -- for

Send ("%1 " .. s)
</send>
  </alias>
</aliases>


Any help is greatly appreciated!
USA Global Moderator #1

Send ("%1 " .. s .. "`w")
#2
Most excellent, thank you!!