Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
aliensurfer
Beginner


Joined: 11 Apr 2005
Posts: 17

PostPosted: 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
Reply with quote
adamwalker
Apprentice


Joined: 12 Mar 2005
Posts: 195

PostPosted: 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
Reply with quote
tye
Beginner


Joined: 24 Feb 2005
Posts: 27

PostPosted: 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.
Reply with quote
Private
Adept


Joined: 10 Jan 2002
Posts: 264
Location: USA

PostPosted: Wed Sep 14, 2005 9:10 pm   
 
#ALIAS throw {wield %1;~throw %1 %2}

>throw dagger north
wield dagger
throw dagger north
Reply with quote
xenapan
Wanderer


Joined: 26 May 2004
Posts: 68

PostPosted: 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!
Reply with quote
Vodoc
Apprentice


Joined: 11 Apr 2003
Posts: 119
Location: Sweden

PostPosted: 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.
Reply with quote
aliensurfer
Beginner


Joined: 11 Apr 2005
Posts: 17

PostPosted: Fri Sep 16, 2005 1:17 pm   
 
Thanks guys, thats great, and simple too, which is nice...
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net