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

Post Reply
Sintor
Posts: 1
Joined: Wed Sep 22, 2010 8:51 am

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

Post 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!

User avatar
Vadi
Posts: 4842
Joined: Sat Mar 14, 2009 3:13 pm

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

Post 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.

User avatar
demonnic
Posts: 662
Joined: Sat Dec 05, 2009 3:19 pm

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

Post 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.

Post Reply