I told in the last topic I was looking for an alias snippet.
I found it here: http://www.smaugmuds.org/index.php?a=files&s=viewfile&fid=19
I want to know:
Someone ever used this mod?
It's working quite well, but I want to make possible the use of more than one command in an alias. Someone have ever done this before?
For example:
<10hp 10mn 10mv> alias gohome n ; n ; e ; ne ; n
Player goes north twice, east, northeast and north with the alias "gohome".
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. :-)
I have moved your thread to the SMAUG section.
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.
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.
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.