Page 1 of 1

Is there a better way to generate aliases from command line?

Posted: Wed Sep 22, 2010 9:01 am
by Sintor
So far, this is what I'm doing to overcome porting 3 years of Lusternia aliases in CMUD to mudlet (with a serious addiction to command line functionality):

Quick Alias - For full alias creation

Pattern: ^qalias (.*)-- (.*)-- (.*)$

Body: permAlias(""..matches[2], "", ""..matches[3], [[deleteLine();]]..matches[4])

Creates an alias without name, customized pattern, and whatever LUA output is needed.

Example: qalias p3, ^p3$, send("pyramid solve 3")

Creates an alias called p3, pattern ^p3$, sends pyramid solve 3 to the mud and deletes the text I entered but shows the alias text.

I further refined the concept for my own quick entry alias for things that require one action, two actions, three actions, and all the same except pointed at my "target" variable for easy offensive alias generation. The fruit:

Name: Quick Send 1 Alias

Pattern: ^qs (.*)-- (.*)$

Body: permAlias(""..matches[2], "", "^"..matches[2].."$", [[deleteLine();send("]]..matches[3]..[[")]])

Example: qs sh-- stand;;evoke pentagram

Does all the same but is an extremely short way of creating said alias (;; is my stacked command mod) from the command line.

So is there a better way of doing this? Also, what about having to use deleteLine to get rid of my matched text for the alias? Finally, how would I add error checking to not overwrite old aliases, or preferably to MODIFY the existing alias if it does exist and create a new one if it doesn't.

Thanks!

Re: Is there a better way to generate aliases from command line?

Posted: Wed Sep 22, 2010 4:23 pm
by Vadi
You can use killAlias to clear the previous alias for that name, so that way you can modify.

I don't believe you can hide the original user input selectively yet from within an alias - although that's something that sounds useful.

Re: Is there a better way to generate aliases from command line?

Posted: Wed Sep 22, 2010 10:48 pm
by demonnic
For checking if the alias exists or not, you should have a look here:

http://mudlet.git.sourceforge.net/git/g ... EAD#exists


This should help you with checking if it exists and replacing or adding.