[Home] [Downloads] [Search] [Help/forum]

Log on
Register forum user name Search FAQ

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  alias with consecutive characters

alias with consecutive characters

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


Posted by Jesse P Bunker   (1 post)  [Biography] bio
Date Fri 16 Oct 2020 12:38 PM (UTC)
Message
I would like to make an alias as follows and can't seem to figure it out or find a reference on the forums.

r* returns
r%1
r%2
r%3

so rstc returns
rs
rt
rc

I can't figure out how to make a wildcard that only matches a single character.


Also, Nick, thank you so much for all your hard work!
[Go to top] top

Posted by Fiendish   USA  (2,315 posts)  [Biography] bio   Global Moderator
Date Reply #1 on Fri 16 Oct 2020 03:14 PM (UTC)
Message
Use a regular expression pattern instead.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Nick Gammon   Australia  (22,556 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Fri 16 Oct 2020 11:26 PM (UTC)
Message
A little bit of scripting lets you break up the wildcard (stc) into individual letters:


<aliases>
  <alias
   match="r*"
   enabled="y"
   send_to="12"
   sequence="100"
  >
  <send>

for c in string.gmatch ("%1", "%a") do
  Send ("r" .. c)
end -- for

</send>
  </alias>
</aliases>


Template:pasting For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,556 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Sat 17 Oct 2020 12:54 AM (UTC)

Amended on Sat 17 Oct 2020 06:57 AM (UTC) by Nick Gammon

Message
If it was always 3 letters then Fiendish's suggestion would work, that is a regular expression:


^r(.)(.)(.)$


That would match 3 characters and each one would be their own wildcard (ie. %1, %2, %3).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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.


1,197 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]