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 ➜ Alias to send color codes in emotes

Alias to send color codes in emotes

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


Posted by Dubrak   (3 posts)  Bio
Date Wed 24 Oct 2012 03:03 PM (UTC)
Message
What I manually type now:

emote looks around and says "`9Ahh, this looks nice`6" and takes a seat. Turning, he asks "`9Do you need anything else?`6" in a confused voice.

What I'd like to be able to do:

<alias> looks around and says "Ahh, this looks nice" and takes a seat. Turning, he asks "Do you need anything else?" in a confused voice.

I would need to have a way to parse everything after the alias, and insert a color code after the first " then another after the second " , then...I guess loop to continue looking for more sets? I'm just starting to dabble in LUA, so please excuse my lack of proper terminology.

Thanks for any help/pointers you may can provide!
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 24 Oct 2012 08:43 PM (UTC)
Message
Have you read the introduction to aliases?

http://www.gammon.com.au/forum/?id=8084

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Dubrak   (3 posts)  Bio
Date Reply #2 on Thu 17 Jan 2013 07:32 PM (UTC)
Message
I have, but I am confused as to the syntax I'd use. Since I'll have a string of text after the alias, how do I tell MUSH to replace the first " with "`9, and the second " with "`6, then do it again for any other sets of quotes? I tried this, but it didn't work.


<aliases>
  <alias
   match="mote * &quot;*&quot; * &quot;*&quot; * &quot;*&quot; *"
   enabled="y"
   sequence="1"
  >
  <send>emote %1 `9%2`6 %3 `9%4`6 %5 `9%6`6 %7</send>
  </alias>
</aliases>
Top

Posted by Dubrak   (3 posts)  Bio
Date Reply #3 on Thu 17 Jan 2013 08:56 PM (UTC)
Message
Ok, I got it to work this way...but there's GOT to be a script way to make this cleaner...


<aliases>
  <alias
   match="mote (.+) \&quot;(.+)\&quot; (.+) \&quot;(.+)\&quot; (.+) \&quot;(.+)\&quot; (.+)"
   enabled="y"
   group="motesay"
   regexp="y"
   sequence="1"
  >
  <send>emote %1 "`9%2`6" %3 "`9%4`6" %5 "`9%6`6" %7</send>
  </alias>
  <alias
   match="mote (.+) \&quot;(.+)\&quot; (.+) \&quot;(.+)\&quot; (.+) \&quot;(.+)\&quot;"
   enabled="y"
   group="motesay"
   regexp="y"
   sequence="2"
  >
  <send>emote %1 "`9%2`6" %3 "`9%4`6" %5 "`9%6`6"</send>
  </alias>
  <alias
   match="mote (.+) \&quot;(.+)\&quot; (.+) \&quot;(.+)\&quot; (.+)"
   enabled="y"
   group="motesay"
   regexp="y"
   sequence="3"
  >
  <send>emote %1 "`9%2`6" %3 "`9%4`6" %5</send>
  </alias>
  <alias
   match="mote (.+) \&quot;(.+)\&quot; (.+) \&quot;(.+)\&quot;"
   enabled="y"
   group="motesay"
   regexp="y"
   sequence="4"
  >
  <send>emote %1 "`9%2`6" %3 "`9%4`6"</send>
  </alias>
  <alias
   match="mote (.+) \&quot;(.+)\&quot; (.+)"
   enabled="y"
   group="motesay"
   regexp="y"
   sequence="5"
  >
  <send>emote %1 "`9%2`6" %3</send>
  </alias>
  <alias
   match="mote (.+) \&quot;(.+)\&quot;"
   enabled="y"
   group="motesay"
   regexp="y"
   sequence="6"
  >
  <send>emote %1 "`9%2`6"</send>
  </alias>
  <alias
   match="mote (.+)"
   enabled="y"
   group="motesay"
   regexp="y"
   sequence="7"
  >
  <send>emote %1</send>
  </alias>
</aliases>
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.


15,863 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.