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.
Aliases: Where to match
Posted by MsHeatherMam on Sat 16 Aug 2003 08:45 AM — 6 posts, 20,925 views.
They can do that, with regular expressions, but it isn't clear what you are trying to do.
Can you give an example?
Can you give an example?
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?
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.
Hope that helps and if I've muddled something with my 4AM response, I'm counting on someone more coherent to correct me.
Or, just type def and press tab. If his name is recent in the buffer, "def" will turn into "Defenestrator". I love tab completion.
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.
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.