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.
 Entire forum ➜ MUSHclient ➜ General ➜ aliases and wildcards

aliases and wildcards

Posting of new messages is disabled at present.

Refresh page


Posted by Tspivey   Canada  (54 posts)  Bio
Date Thu 06 Apr 2006 10:57 PM (UTC)
Message
Hello. When I used Tintin, I could do something like:
#alias {h} {cast heal}
and the following would result:
h: cast heal
h argon: cast heal argon
I tried doing the same thing in Mush, but couldn't figure out how to do it without writing two aliases for each one I wanted to create this way. Is there something I'm missing? Since writing
match on: h
send: cast 'cure light'
only works if I type h, without any extra args, and "h *" in match only works if I type h with an arg or a space after it.
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 06 Apr 2006 11:21 PM (UTC)
Message
A simple regular expression will do that:


<aliases>
  <alias
   match="^h( .*){0,1}$"
   enabled="y"
   regexp="y"
   sequence="100"
  >
  <send>cast 'cure light'%1</send>
  </alias>
</aliases>


That would match on "h" on its own or "h" followed by a space and then anything. The "anything" might be too broad, so this might be better:


<aliases>
  <alias
   match="^h( [A-Za-z]{1,}){0,1}$"
   enabled="y"
   regexp="y"
   sequence="100"
  >
  <send>cast 'cure light'%1</send>
  </alias>
</aliases>



This would only match on "h <something alphabetic>" assuming your names are like A-Z and a-z, however if other things like underscore can be in names you just put that inside the square brackets.

The notation {0,1} means "zero or 1 of these things", and {1,} means "one or more".

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #2 on Thu 06 Apr 2006 11:22 PM (UTC)
Message
See my post about using regular expressions:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=5089

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 08 Apr 2006 12:38 AM (UTC)
Message
See this new post:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=6442

I have made an alias that will create aliases "like tintin" for you.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


14,145 views.

Posting of new messages is disabled at present.

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.