Another reason to have aliases on the MUD is in case there is some semantic value to them that the client wouldn't be aware of. This would be coupled with a character-by-character mode I mentioned a while ago. Imagine you had an alias "potion" that took as an argument the name of a potion and executed something like "get [potion] bag; drink [potion]". A MUD client could do that, yes, but the server alias could be aware that the argument is supposed to be an object or potion; it could then enable tab-completion (the client would have to send the tab character to the MUD) to autocomplete the argument to an appropriate string.
Basically, if your MUD implemented something like a shell instead of just a string interpreter, it could be useful to move things like aliases to the MUD-shell level. But without, the only advantage I see for MUD-side aliases is what Darwin mentioned.
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
I had the alias snippet added to my source, but I recoded it to use Lua instead. I also tried to allow multiple commands but I ran into the exploit David mentioned and removed that feature before I ran the code live. What I was able to do though was to allow setting variables.
The only reason I can see that the alias snippet should be used is for people who play from work or other places where they don't have access to a MUD client and have to rely on using a basic telnet client instead. Having aliases loaded by the MUD instead of client allows players to play from anywhere and still have their aliases available to them.
As for the question, why bother? If someone is sophisticated enough to use aliases, they will probably have one of the MUD clients that supports them anyway (and command stacking).
After all, MUSHclient is free, that sort of stuff is implemented in that. There are also other good MUD clients around which are free or cheap.
Not sure if anybody has done it, but it would be easy enough to do. Just iterate over the string looking for semi-colons, and then interpret the command up till then, and so forth.
But note that you might introduce exploits into your game. Some commands have delays based on handling incoming network data; an alias that just interprets them all in one go will remove that delay.
Also note that this should probably be in the SMAUG section, not the general programming section. :-)
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
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.