Gammon Forum
Entire forum
MUSHclient
General
Aliases: Where to match
It is now over 60 days since the last post. This thread is closed.
  Refresh page
Posted by
| MsHeatherMam
(2 posts) bio
|
Date
| Sat 16 Aug 2003 08:45 AM (UTC) |
Message
| I want to make it so my alises will work anywhere on a line. I have tried reading the help files, but I don't know a lot about scripting, if anything. Please help. | top |
|
Posted by
| Nick Gammon
Australia (22,973 posts) bio
Forum Administrator |
Date
| Reply #1 on Sat 16 Aug 2003 08:46 AM (UTC) |
Message
| They can do that, with regular expressions, but it isn't clear what you are trying to do.
Can you give an example? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| MsHeatherMam
(2 posts) bio
|
Date
| Reply #2 on Sat 16 Aug 2003 09:07 AM (UTC) |
Message
| The exact problem is this. My friend on the MUD i go to has a long name, Defenestrator. I wanted to make an alias for his name, and I chose Def. If I type just def, his full name goes into the screen. But if type somthing such as Tickle Def, than it does not recognize the Alias. I belive the program is currently set to only make an alias work at the begining of a line. I want to edit it so that I can use an alias at any point on the line. How do I do this? | top |
|
Posted by
| Meerclar
USA (733 posts) bio
|
Date
| Reply #3 on Sat 16 Aug 2003 09:25 AM (UTC) |
Message
| Actually, you're on the right track, but only partially. Aliases are afaik only processed as the beginning of a line in order to prevent matching midword later in a sentence. To do what it sounds like you are trying to do, you need to actually assign his name to a variable - something less common than "def" or it *will* bite you in the ass - and use that variable whenever you want to direct something toward him. You will of course need to have the expand variables option enabled for this trick to be of any use.
Hope that helps and if I've muddled something with my 4AM response, I'm counting on someone more coherent to correct me. |
Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org | top |
|
Posted by
| Poromenos
Greece (1,037 posts) bio
|
Date
| Reply #4 on Sat 16 Aug 2003 08:17 PM (UTC) |
Message
| Or, just type def and press tab. If his name is recent in the buffer, "def" will turn into "Defenestrator". I love tab completion. |
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | top |
|
Posted by
| Nick Gammon
Australia (22,973 posts) bio
Forum Administrator |
Date
| Reply #5 on Sat 16 Aug 2003 08:50 PM (UTC) |
Message
| The tab-completion is a good idea - you could add the name "Defenestrator" to the tab-completion defaults, which will guarantee that it will find a match to "def" as "Defenestrator" rather than some other nearby word (like defence).
However to do it with aliases you could take a couple of approaches. One that springs to mind is 3 aliases like this:
def *
* def *
* def
Those 3 aliases would match "def" (and the space around the word) in the 3 places it is likely to be: start of line, middle of line, end of line.
eg. tickle def
That is the end of the line.
tell def hi
That is the middle of the line.
Now set up the appropriate alias response. ie.
Alias: def *
Send: Defenestrator %1
Alias: * def *
Send: %1 Defenestrator %2
Alias: * def
Send: %1 Defenestrator
The %1 (and %2) will be replaced by whatever matched wildcard 1 and 2. |
- 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.
13,709 views.
It is now over 60 days since the last post. This thread is closed.
  Refresh page
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.