Alias to send color codes in emotes

Posted by Dubrak on Wed 24 Oct 2012 03:03 PM — 4 posts, 16,667 views.

#0
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!
Australia Forum Administrator #1
Have you read the introduction to aliases?

http://www.gammon.com.au/forum/?id=8084
#2
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>
#3
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>