Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Lua ➜ Lua Newbie - Need help finishing script

Lua Newbie - Need help finishing script

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by CrazyPaladin   (12 posts)  Bio
Date Thu 22 Mar 2018 07:09 PM (UTC)
Message
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!
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #1 on Thu 22 Mar 2018 07:13 PM (UTC)
Message

Send ("%1 " .. s .. "`w")

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by CrazyPaladin   (12 posts)  Bio
Date Reply #2 on Thu 22 Mar 2018 07:40 PM (UTC)
Message
Most excellent, thank you!!
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


10,444 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.