|
aliensurfer Beginner
Joined: 11 Apr 2005 Posts: 17
|
Posted: Wed Sep 14, 2005 2:02 pm
Two line Alias help... |
Is there a way of having a two line alias, were the last command you enter into the command line is placed in the 2nd line of the alias? Not very clear, but I hope you can understand
Example.
In my MUD, I need to wield something before throwing it, and I need to specify the direction.
I would like to use the alias td to wield and throw Dagger, so td n would throw the dagger north:
td n
wield dagger
throw dagger north
td u
wield dagger
throw dagger up
etc
The only way I can think of doing this is to have an alias for each directional throw possibilty, which seems a little much to me.
Anyone have any ideas?
I can think of a way to add the direction my target went to a varible, but that requires me to see them leave, which means I can't use it to sneak up on people..
Thanks |
|
|
|
adamwalker Apprentice
Joined: 12 Mar 2005 Posts: 195
|
Posted: Wed Sep 14, 2005 3:05 pm answer |
does N also equal north in your mud? if so the easyest way to do it is...
make alias TD
wield dagger
throw dagger %1
If it HAS to output THROW DAGGER NORTH (rather then throw dagger n) you can do it this way.
make alias TD
wield dagger
#if (%1 = n) {throw dagger north}
#if (%1 = ne) {throw dagger northeast}
and so on
hope thats what you want |
|
|
|
tye Beginner
Joined: 24 Feb 2005 Posts: 27
|
Posted: Wed Sep 14, 2005 3:36 pm |
If you want the single line, command-line equivalent of the above, rather than going through the config screen, I believe it would look something like:
#alias td {wield dagger;#if (%1 = n) {throw dagger north}; #if (%1 = u) {throw dagger up} }
with additional #ifs as required.
I've always found creating multiple-command aliases, triggers, etc. to be simpler using the full interface, though. |
|
|
|
Private Adept
Joined: 10 Jan 2002 Posts: 264 Location: USA
|
Posted: Wed Sep 14, 2005 9:10 pm |
#ALIAS throw {wield %1;~throw %1 %2}
>throw dagger north
wield dagger
throw dagger north |
|
|
|
xenapan Wanderer
Joined: 26 May 2004 Posts: 68
|
Posted: Fri Sep 16, 2005 5:35 am |
wouldnt that cause a infinite loop private? command = alias =BOOM!
|
|
_________________ Player on Realms of Despair. realms.game.org port 4000. Join us today! |
|
|
|
Vodoc Apprentice
Joined: 11 Apr 2003 Posts: 119 Location: Sweden
|
Posted: Fri Sep 16, 2005 6:16 am |
xenapan wrote: |
wouldnt that cause a infinite loop private? command = alias =BOOM! |
No, see the alias again:
Code: |
#ALIAS throw {wield %1;~throw %1 %2} |
Inside the alias is the command ~throw. The ~ sign tells the parser to stop there and just send the command as it is and skip trying to evaluate it further. |
|
|
|
aliensurfer Beginner
Joined: 11 Apr 2005 Posts: 17
|
Posted: Fri Sep 16, 2005 1:17 pm |
Thanks guys, thats great, and simple too, which is nice...
|
|
|
|
|
|